Jump to content

Exporting Blender constraints to BabylonJS


Recommended Posts

Hi guys.

 

I'm new to BabylonJS and blender.
I was trying out animations exported from Blender to Babylonjs. Everything is working correctly more or less. But when I apply a copyLocation constraint to a cube whose target is a bone, it is not taking effect in the babylon scene in the browser. Please help me to know what I'm missing.
Are all the constraints supported in Blender supported in Babylonjs as well? From the docs, I saw only trackTo constraint...

I've attached the .blend file. Plz have a look.

Any help very much appreciated. Thanks!

full-body.ani-boned-posed-rest.animated.constrained.blend

Link to comment
Share on other sites

Hi JCPalmer. Thanks for the quick response.

15 hours ago, JCPalmer said:

BJS does not have constraints.  The trackTo has a couple applications with exported cameras, but it is converted not supported as a constraint.

If constraints are not supported in BJS, how should I implement something like a character holding a sword or gun?

I was reading about joints in BJS. Will that be appropriate for weapon system?

16 hours ago, Deltakosh said:

Pinging @kcoley and moving this thread to the right subforum :)

Thank you for the correction.

And thank you for the great job on the website... 

Link to comment
Share on other sites

Note that I'm not comfortable with animations, so the solution I suggest here could be probably not the perfect workflow...

Before exporting, you can use Bake Action (do not save your file after), so basically, with famous Blender keyboard combo:

  • use your bones as you want, constraints, drivers, whatever
  • you want to test and export your scene, so:
  • select your object(s)
  • Ctrl + S (save)
  • Space > "Bake Action" > (F6 to check bake settings if needed) > Enter
  • Space > "Export .babylon/.gltf" > Enter
  • Ctrl + Shift + O > Enter (re-open your file, to avoid saving with all your keys baked...)
Link to comment
Share on other sites

14 hours ago, JCPalmer said:

There are multiple ways, I think.  The way to do it on the JS side is.

A blender way would be to position the sword where it is to be held.  Make sure the origin matches the character mesh. Parent sword to armature, or add modifier.  Weight paint entire sword to the bone desired.

Ok. Will try this out. Hope you guys don't mind, I'll keep this question open for some time. I'll get back after trying out ASAP.

Link to comment
Share on other sites

20 hours ago, V!nc3r said:

Note that I'm not comfortable with animations, so the solution I suggest here could be probably not the perfect workflow...

Before exporting, you can use Bake Action (do not save your file after), so basically, with famous Blender keyboard combo:

  • use your bones as you want, constraints, drivers, whatever
  • you want to test and export your scene, so:
  • select your object(s)
  • Ctrl + S (save)
  • Space > "Bake Action" > (F6 to check bake settings if needed) > Enter
  • Space > "Export .babylon/.gltf" > Enter
  • Ctrl + Shift + O > Enter (re-open your file, to avoid saving with all your keys baked...)

Hi V!nc3r. I'm following the same procedure for animating characters. But got stuck on combining decoupled meshes.

Link to comment
Share on other sites

On 10/23/2018 at 7:58 PM, JCPalmer said:

There are multiple ways, I think.  The way to do it on the JS side is.

A blender way would be to position the sword where it is to be held.  Make sure the origin matches the character mesh. Parent sword to armature, or add modifier.  Weight paint entire sword to the bone desired.

Tried this out. Somewhat got it to working. I tried with a cube attached to a bone in the leg. While animating in Blender, the cube moves with the leg bone. But after exporting to Babylonjs the moves in place but doesn't have motion along my axis. Anyway, will take sometime to get there, I guess. Thank you for the help.

 

Edit: Going though the link given for handling the decoupled meshes on the JS side. This should be perfect for me. Thanks :)

Edited by sCarr25
Additional details.
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...