Jump to content

lookAt for bones


santarcade
 Share

Recommended Posts

Hi guys,
I am experiencing an issue in doing something that I thought to be pretty easy: I need the equivalent of lookAt for bones, since I plan to move the eyes of a rigged character via bones.
 
So I created a test rig in blender and tried to workout the code to properly rotate the bones to lookAt a given target and… I failed.
 

I attached a screenshot showing the blend file in Blender.

Babylon file: https://www.dropbox.com/s/fu5fgl5zckqh5dh/testeyes.babylon?dl=1

Blend file: https://www.dropbox.com/s/ybo93nll7na7zyj/testeye.blend?dl=1

 

Playground demo: http://www.babylonjs-playground.com/#18WJHH#2

 

The problem I’m having is that the eye sphere seems rotating using the bone location as pivot point and, in addition, it appears to drift instead of being fixed at its position.

In any case I did not find the proper rotation quaternion to put into the bone matrix.

 

I thought that if a bone is attached to a parent bone (in this case, the one for the head), keeping the x,y,z components of the localMatrix and varying the rotation quaternion, the position should be kept, isn't it?

 

Is it possible the problem comes from the bone origin being at the center of the sphere?

 

Any clues?

Thank you all in advance.

post-16634-0-05591700-1452519987_thumb.p

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...