sCarr25

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

Share this post


Link to post
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... 

Share this post


Link to post
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...)

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
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.

Share this post


Link to post
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.

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

Hi all. Not sure how to mark the answer given by JCPalmer as the solution. I thought it would be marked as solved if I gave the answer a trophy. 

On 10/22/2018 at 10:02 PM, Deltakosh said:

Pinging @kcoley

Please mark JCPalmer's answer as the solution. Thanks everyone! :)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.