Game Development Community

Having a player animation affect position

by Bryce · in Torque 3D Professional · 02/27/2013 (6:03 pm) · 12 replies

Hey everyone!

I've been wondering about complicated move animations and how the implementation in Torque 3D works. Say I've got an animation of a character running up a wall, grabbing the ledge, and pulling himself over. At the end of the animation, his position should be at the top of the ledge, so he can continue running around from there (as opposed to the character returning to his rest pose where he started).

Is something like this already possible? I've always been a bit foggy about animating the bounds box and dealing with "ground transform", does the key lie in something like that? I apologize if this has been asked hundreds of times already, I never know what to search the site for.

Help is greatly appreciated!
-Bryce

#1
02/27/2013 (6:48 pm)
Bryce,

Good question. You might want to send an email to the guys over at Ubiq Visuals. Sounds like you are re-inventing the wheel. Since the 3D action adventure kit had to figure that out. Who knows, they might help get you started or point you in the right path. Worst they could do is not reply or say no. Just a thought.

Ron
#2
02/27/2013 (9:04 pm)
To keep it from being glitchy with variable heights I would say discreet animation sequences would be better. If you mess with the shape moving beyond the bounds or even moving the bounds that might disconnect where the object appears from the collision box.
#3
02/27/2013 (11:32 pm)
I'd break it up in to segments to keep things simpler and have the position adjust via a carefully timed script function. Try to break the animation into moments that involve different rates of change of position. Use something like a timed script function that incrementally increases the player's position and at the end of the proper time, triggers the next animation and position modifying function.
#4
02/28/2013 (1:21 am)
I think you're dreaming about having animation driven movement.
In many of the latest games, character motion is generated by the animations. Playing a 'run' animation moves the character forwards according to parameters associated with the animation. Blending the run animation with a turn animation results in a character runnning along a curve etc. Blending a walk animation with the run animation generates various different walk/jog speeds.

This is a complete paradigm shift from the T3D system, which moves the character according to the physics system, and then attempts to pick an animation to match that movement.
#5
02/28/2013 (7:35 am)
If you can code that, the animation should not be the biggest problem, you do not move the character at all while animating him, the character is moved by it's position/bounding box, then depending on what state he is in, a static animation plays.
#6
02/28/2013 (7:50 am)
I've been wishing for animation driven actions myself, to get things like melee combat accuracy, but at the same time, i don't think it's necessarly hopeless. Not relying directly on animations is much more efficient.

The platformer kit might be worth looking at indeed.
#7
02/28/2013 (8:39 am)
My initial thought would be to grab the position of a node placed at the origin of the model (let's call it "groundNode"). Once a certain animation is played all the way through, a callback like animationEndUpdateTransform is called, which simultaneously drops us back into the root pose and sets our transform to where groundNode was at the end of that animation. I just don't know how feasible that is, given that I don't know jack about how animations are handled within Torque.
#8
02/28/2013 (4:22 pm)
you want a callback when the animation has finished, then simply transform the player (see teleporter's in FPS Tutorial)

you could even, hide the player, start a static animated object off at its location and show the player when the static objects animation has finished and delete the object, If the objects animations on start and on end match the player pose you wouldn't tell the difference. That may or may not be easy. However that would only be usable in 3rd person.
#9
02/28/2013 (4:32 pm)
you want a callback when the animation has finished, then simply transform the player (see teleporter's in FPS Tutorial)

you could even, hide the player, start a static animated object off at its location and show the player when the static objects animation has finished and delete the object, If the objects animations on start and on end match the player pose you wouldn't tell the difference. That may or may not be easy. However that would only be usable in 3rd person.
#10
02/28/2013 (4:59 pm)
One thing I think that is being missed is when you animate the character beyond its position then you create a situation where the collision box is separate from the objects visible location. At least that is what I think happens. So if this is an FPS that can be taken advantage of to either evade fire by climbing things and/or watch where someone actually starts climbing a wall and shoot at the ground location where the collision box is sitting. Unless care is taken this can be used as an exploit in game play. I guess one could animate the position of the collision box, but I am not sure if that is possible out of the box on the player or not. A vehicle object could work.

I think using discrete animations and movement based upon physics is the way to go here. The bounds already tries to track animation speed with ground movement.

Here is a question that might spark some ideas:
Can a new player object be created around a physics object to get the effect you are looking for? Like up to and including kinematics? So when a ledge is grabbed and the arm pulls upward it actually applies a physical impulse?
#11
03/01/2013 (4:05 am)
Playing an animation from one a start node to an end node, and then at end of animation changing the transform to the end node position was how CoD did movement animations like climb, etc. I think they also took player collision with static objects off when it happened.
#12
03/01/2013 (4:34 pm)
As steve states this is what I'm working on as well. But I'm also trying to handle the movement transitions when cancel mid movements. As steve mentioned I am first experimenting with a climb animation, up off and drop to make this work. Then this same process will be applied to an attacking animation where attacking combos cam move you from here to there. Of course the collision will have follow the character.

Hard, should not be, lots of testing needed ... yep.