shen Posted February 23, 2017 Share Posted February 23, 2017 Here is the demo http://www.babylonjs-playground.com/#1B1PUZ#22, press any key to move the mesh with animation and BoneLookController will stop working. It only happens to the first Bone Controller. BoneIKController also has this problem, if it's the first created. Quote Link to comment Share on other sites More sharing options...
adam Posted February 23, 2017 Share Posted February 23, 2017 Thanks for reporting this bug shen. There seems to be a timing issue when using scene.registerBeforeRender and that type of animation. To fix this issue, DeltaKosh just added an onBeforeComputeObservable to the Skeleton class that you can use instead: http://www.babylonjs-playground.com/#1B1PUZ#26 You might need to ctrl-f5 to update the playground with the new code. Quote Link to comment Share on other sites More sharing options...
shen Posted February 23, 2017 Author Share Posted February 23, 2017 Thanks for the quick fix. I keep playing with it and find that If "sphere.parent = mesh" was set, Bone Controller just use the original target position when moving with the animation. http://www.babylonjs-playground.com/#1B1PUZ#29 Did I forget updating the target position somewhere? Quote Link to comment Share on other sites More sharing options...
adam Posted February 25, 2017 Share Posted February 25, 2017 Right now, the BoneLookController doesn't support using meshes as targets. So you will need to do something like this when targeting a parented mesh: http://www.babylonjs-playground.com/#1B1PUZ#34 I'd like to point out that your initial PG is now working. There was an issue in Bone.getPosition() that caused the bug. Quote Link to comment Share on other sites More sharing options...
shen Posted February 27, 2017 Author Share Posted February 27, 2017 Thanks adam! I broke it again. http://www.babylonjs-playground.com/#1B1PUZ#31 When the bone and the target meets at the same position, the head is broken. http://www.babylonjs-playground.com/#1B1PUZ#32 The head turned before the target move to the direction and the animation speed is not right. If line 42 was commented out, the animation speed is right, but Bone Controller is not working. Quote Link to comment Share on other sites More sharing options...
adam Posted February 27, 2017 Share Posted February 27, 2017 For now, try to avoid placing the target on the head bone. edit: you should probably set the target position like this when you need to set the absolute position: http://www.babylonjs-playground.com/#1B1PUZ#33 that doesn't fix the issue, but it might fix some other issue. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.