by date
3rd person camera implemenation borks animation playback
3rd person camera implemenation borks animation playback
| Name: | Ben Mathis | |
|---|---|---|
| Date Posted: | Jul 25, 2007 | |
| Rating: | 2.5 out of 5 | |
| Public: | YES | |
| Comments: | YES | |
| RSS Feed: | or Subscribe with . | |
| Profile Page: | View profile page for Ben Mathis |
Blog post
Tried to create an external 3rd person sideways camera. Had lots of problems with using the camera object (as well as the AdvancedCamera resource, it does not work) as it seems that the camera object is only used when it is set as the control object (useful??). As a solution to that I tried to change the getRenderEyeTransform function that is used to render the scene by creating another function called getRenderCameraTransform and use that one instead of getRenderEyeTransform in ShapeBase::getCameraTransform and modify the rotation and location of the render caption. Setting the character up as the control object seems to mess up the animation sequence of our character. When the Camera is set as a control object instead of the character, our character's animation runs correctly, when our character (with the changed render function) is the control object, the animation gets scewed. Here's what I did in getRenderCameraTransform (red text is code I changed):
Even only changing the y offset (to see the character from behind) shows that the animation is crooked, but only when the character is the control object.
Here is an image of the problem. See how the feet seem to detach? In Showtools, this place perfectly (ankles stay connected and she seems to just be breathing heavily)

void Player::getRenderCameraTransform( MatrixF* mat )
{
MatrixF pmat,xmat,zmat;
xmat.set(EulerF(mHead.x, 0.0f, 0.0f));
zmat.set(EulerF(0.0f, 0.0f, mHead.z-1.5));
pmat.mul(zmat,xmat);
F32 *dp = pmat;
F32* sp;
if( mDataBlock->cameraNode != -1 )
{
sp = mShapeInstance->mNodeTransforms[mDataBlock->cameraNode];
}
else
{
Point3F center;
mObjBox.getCenter(¢er);
MatrixF eyeMat(true);
eyeMat.setPosition(center);
sp = eyeMat;
}
const Point3F& scale = getScale();
dp[3] = sp[3] * scale.x+7;
dp[7] = sp[7] * scale.y+1;
dp[11] = sp[11] * scale.z;
mat->mul(getRenderTransform(), pmat);
}
Even only changing the y offset (to see the character from behind) shows that the animation is crooked, but only when the character is the control object.
Here is an image of the problem. See how the feet seem to detach? In Showtools, this place perfectly (ankles stay connected and she seems to just be breathing heavily)

Recent Blog Posts
| List: | 07/25/07 - 3rd person camera implemenation borks animation playback 06/28/07 - The Escapade: Pictures and Game design Inside |
|---|
Submit your own resources!| Edward F. Maurina III (Jul 25, 2007 at 15:45 GMT) Resource Rating: 2 |
1. Not a plan (blog). OK, pseudo. You are telling us what your working on, but this is really a request for help. We see a lot of requests for help disguised as blogs and folks are kinda getting tired of it since it pushes real blogs off the top 10 (new blogs) list.
2. You shouldn't post source code in the public areas, including plans.
A better spot for this, and likely to get more help is:
http://www.garagegames.com/mg/forums/result.area.php?qa=10
-Ed
PS - When you repost, you might show the original code followed by the new code. Highlighting in a code block doesn't seem to work.
PPS - Nice site BTW http://www.poopinmymouth.com
PPS - Anyone thinking about this problem, it looks like the code Ben started from is present in 1_52. Ben, can you confirm that for us? It probably won't make much of a difference, but it is nice to look at the same code base.
-EFM
Edited on Jul 25, 2007 17:12 GMT
| Ed Johnson (Jul 25, 2007 at 16:06 GMT) |
Ed Maurina is correct though, many in the community simply won't help someone who hasn't gone through "the proper channels", namely the forums. Asking for help in blog posts on the front page is seen as getting on a pedastal screaming "HEEELP MEEEE" and many simply ignore it... even if you are the mighty Ben Mathis!
| Ben Mathis (Jul 25, 2007 at 16:11 GMT) |
It is indeed 1.52 code.
Thanks Ed/Ed for the compliments about my site.
| Edward F. Maurina III (Jul 25, 2007 at 16:12 GMT) Resource Rating: 2 |
Ben,
Yeah, enough with the post scripts....
It occured to me that you might benefit from trying out this resource: Advanced Camera.
It is a smokin' resource which works well in 1_52. In fact, after adding the files in the zip file, you're pretty much done (except for script changes). All of the other code 'fixes' have been incorporated in 1_52.
If you need a side view use the: setTrackMode(). You can then adjust the camera position with: setCameraPosition() and the camera will nicely track your player, while itself remaining stationary.
Alternatively, if you need the camera to track the player from the side and to follow the player use:
setThirdPersonMode(), but don't attach the yaw, pitch, zoom scripts. Instead, adjust them using: setThirdPersonOffset().
-Ed M
Edited on Jul 25, 2007 16:29 GMT
| Aaron Ellis (Jul 25, 2007 at 16:15 GMT) |
www.garagegames.com/mg/forums/result.thread.php?qt=65188
| Anton Bursch (Jul 25, 2007 at 17:48 GMT) |
I posted a message on the new thread about this.
Anton Bursch
| Edward F. Maurina III (Jul 25, 2007 at 20:01 GMT) Resource Rating: 2 |
Your post on the other thread just disappeared? Did you delete it?
-Ed
You must be a member and be logged in to either append comments or rate this resource.


2.5 out of 5


