Jump to content
  • Advertisement
Sign in to follow this  
templewulf

Looking at Eyes with Irrlicht

This topic is 4353 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I've been using Irrlicht in my project for a couple of months, but I'm still fairly new to 3d programming. I'm starting to script some scenes with Lua, and I need characters to look each other in the eyes for close-ups, but I'm not sure how to go about this. I'd like character A's head to orient toward a point between the eyes of character B. Is there an easy way to derive this point, keeping in mind my characters are of multiple sizes and may not be bipedal? How would you do this in Irrlicht? How would you do this with an API like OpenGL or DX? Thanks, Justin

Share this post


Link to post
Share on other sites
Advertisement
No offence but your putting the horse WAYYYY before the cart on this one. You are going to need to make a great many decisions before the one you face. What kind of animation system you are going to choice, are you going to model pieces or as a single mesh, etc...

Once you get your animation system in place, etc... If you use a heirarchical system ( aka, head rooted to neck, neck rooted to shoulders etc. ) you best bet would be to have a dummy object representing where the character is looking. This object would control the rotation/animation of the eyes and head in general. Hell, with the right IK system, it could control most of the body. Just translate the dummy object to the location of the other persons head and your animation system should respond accordingly.

That said, you are a long ways from need to ask this question. You simple wont be able to get an answer to it on these forums either, unless someone is wanting to post 1000's of lines of code.

Share this post


Link to post
Share on other sites
A *simple* but inexact method would be to use the bounding box. Get the top centre point of the box then move it in the direction the character is facing by half the box width. Maybe move it down a little...

If you want it exact do as Serapth suggested, maybe a named joint and use node->getXJointNode("jointname")->getPosition() although i'm not sure about this...

Also take a look at this: http://people.freenet.de/abusoft/Irrlicht/IrrBones2.htm

Share this post


Link to post
Share on other sites
Use simple trigonometry to find the Euler angle differnce of the vectors (from the head bone of character A to the head bone of character B) and the face normal, then add-to the Euler angles used to calculate the head rotation matrix.

In other words, translate the target point (character B's head) into character A's head coordinate system, find the Euler angles of that vector, add them to the head rotation values, recalculate your head matrix.

edit: if the above steps executed correctly, when you translate the target (character B's head) into character a's head space again, the vector should lie parallel to the character a's face normal vector.

You're stepping into the world of IK.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!