So I am trying to get my character to render in my demonstration. I am importing a .dae file into blender and then exporting it the babylon.js plugin. Why is it rending as a giant though and not as a character where the box should be?
Hi TT! This is a common scaling issue. Your character might have a top-most “node”… a master parent… sometimes called a root or gizmo or handle.
If you can find the root node… after the import (maybe in scene.meshes or its parent)… you can down-scale the entire model.
character.scaling = new BABYLON.Vector3(0.1, 0.1, 0.1)
(Use any numbers that are less-than 1. I find that 0.1 is a nice starting place… making model 1/10 previous size.)
All in all, down-scaling the model… is what you are seeking.
Are you exporting from Blender… as a .babylon file-type? If you could publicly publish that .babylon file in a place where we could see it, or use it in a playground demo, that would be great.
I like publishing .babylon files into my free github account, and then we use a special URL in the playground… to retrieve that .babylon file, and not be blocked by CORs security walls. Like this…
Notice I have a little animated continuous down-scaling happening in lines 16-18. Scaling is the way to make a model get bigger or smaller… dimensions-wise. It stays the same byte-size when scaled, though. I hope this helps.
It depends on the scale factor you use in your model editor (blender, 3ds max …) I guess your model measures 180 m instead of 1.80 m
After, as Wingnut says, you can redefine the scale with Babylon.
Forget the last attachment I sent, it doesn’t work. This attachment does, though.
mixamo1.babylon.zip (793.8 KB)
There ya go. I put the model on my github for now… but it might get deleted in a few weeks.
The .babylon file contained 6 body parts… and a cube/box. I think there was a camera and light in there, too, but I was most-concerned over the character. The 6-part character had no “root” or “gizmo” (master parent)… so I used the cube/box as the parent. Why not, right? I could have created a cube in the BJS scene, too… which would have worked as well.
Anyway, I put a lot of comments in the scene code… of that playground. The character was very large, as you say… so I first made the cube/box very large… too (line 23). Then I sort of “naturalized” the box… with a “bake”. (see comments)
Then I did the parenting of all body parts… TO the box (lines 33-38). Then line 43 tips-up the character, and line 46 shrinks the character MUCH. (by shrinking its new central “parent”)
Notice that… after we parented the 6 body parts… to the box, we were able to do things to the parent, and the body parts did the same actions. This is because .position, .rotation, and .scaling… is inherited by children… from parents. Box is the parent, so when we ‘transform’ the box, we also ‘transform’ all 6 body parts.
Anyway, you might wish to use playground’s down-arrow downloadButton “get zip” choice… to bring the playground code… to your local computer. You might also wish to learn about the playground’s “Inspector” pref/feature… a nice drill-able tree view… of this scene (and thus a view of the insides of your .babylon file). There are also online JSON file viewers… that will do easy-inspection of .babylon files.
I often view other people’s .babylon files using an online JSON viewer… to see if the model has a root/top node (a gizmo already installed). The playground’s Inspector also does this nicely. Windows Notepad works ok, too, but not tree-like view.
Inside your .babylon file, I saw one THING that was interesting… in the “Skeletons” area…
That… is some pretty large sizes. I dunno HOW BJS scene importer treats that, but THOSE values COULD be the initial cause of the largeness of the model. Not sure. Anyway, moving on…
It would have been nice if your 6-part model already had a master “root”… but… we were able to add our own, and by doing that… we got easy down-scaling power… to make character much smaller. I hope this is helpful.