Game Development Community

Eye rotation with animation

by Jacob Dankovchik · in Torque Game Engine · 10/10/2005 (8:06 am) · 9 replies

Wondering if someone possibly has info about making your eye rotate with an animation. Right now it only effects the position of the eye but I need it to rotate as well. Thanks.

#1
10/10/2005 (8:40 am)
Scratch that, just figured it out finally after seceral hours of messing around. And I could kick myself in the ass for how simple it is. But on the good side.. I've now found an unheard of level of realism.. This should make for some very intense things.
#2
10/10/2005 (8:49 am)
How did you do it? :)
#3
10/10/2005 (8:54 am)
In player.cc around line 3050, the functions
Player::getEyeTransform(MatrixF* mat)
and
Player::getRenderEyeTransform(MatrixF* mat)

Find the line that says
mat->mul(getRenderTransform(), pmat);

And change it to
mat->mul(getRenderTransform(), mShapeInstance->mNodeTransforms[mDataBlock->eyeNode]);

And there ya go. I'm thinkin about adding this to my More Realistic First Person resource, but this is a verry big change to looks and I KNOW many people wouldn't want to add this to their game. Beware when doing this, things are going to thrown into chaos from it. The Orc model is far from setup right for this kinda thing and it makes something as simple as walking hard and confusing.
#4
10/10/2005 (8:57 am)
Thanks, I'll put in on my list of things to try out! :)
#5
10/10/2005 (9:03 am)
Well, I just noticed a bit of a jittering issue.. Not sure what would cause that though or how to correct it.
#6
10/10/2005 (9:07 am)
Damn, nevermind.. Found it already. Change getTransform() to getRenderTransform()
;)
#7
10/10/2005 (6:16 pm)
Sorry for all the in-a-row posts, but if interested in seeing how all this looks together, my resource and this, see this video here. Keep in mind, the Orc wasn't made for this. ;)
Uses DivX 5.2.1 codec

www.planetgargoyle.com/dm/bouncy.avi
#8
10/10/2005 (7:49 pm)
@Jacob: I think the effect would be great for immersion. Reminds me of 'Saving Private Ryan' footage.

EDIT: I added a rotateCamWithNode boolean value to the player datablock, to toggle to effect. The toggle works, but I'm wondering if you didn't make some additional changes. The eye node doesn't seem to animate during the run. I tried setting mShapeInstance->animateNodeSubtrees(true), but that didn't help either. I am using a modified 1.3 base, so I'll try it on a stock code base when I get a chance to see if that's the issue.

UPDATE: Added the changes to 1.4; 3rd person works, but 1st person just does one initial 'tilt' and 'tilts' back when you stop running. Nice effect though.


B--
#9
10/11/2005 (3:01 am)
Ya, I figured it wouldn't work right by itself. I think you'll have to try runnin through a few of the changes I have in my First Person resource.

www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=8397

That should definatly work for you there.