Mecha Feet animation
by Rivage · in Torque Game Builder · 12/13/2006 (4:41 am) · 2 replies
Hello all ;)
I'm trying to achieve a rather complex movement for legs of my "landing shuttle".
Here it is a scheme of what i try to do :

Red movement (shock absorber too) are less important than black one.
I've choose to add dummies to objects so i can have a pivot point where i want it to.(By the way ? With TGB 1.1.3 does this feature is implemented ?).
The dummies are large enough so i can draw the edge of every feet as a collision polygon inside.
Then i play with angular velocity and a clamp collision answer.
What i need is my object reacting more or less like a IK link with min/man angular movement.
Is this kind of movement is too complicated to be achieve with TGB ?
When i mount dummies to another object they lost all motion. Is this the right way of doing or should i try to do this movement with Math ?
What i don't really understand is the way i can use and adjust the collision answer.
i have resolved the shock absorber like this
Also when feet's encounter collision from side the whole leg should be able to rotate a bit. This is probably possible with rigid body but the physic is too unstable.
Could you help me a little on this ? Thanks.
I'm trying to achieve a rather complex movement for legs of my "landing shuttle".
Here it is a scheme of what i try to do :

Red movement (shock absorber too) are less important than black one.
I've choose to add dummies to objects so i can have a pivot point where i want it to.(By the way ? With TGB 1.1.3 does this feature is implemented ?).
The dummies are large enough so i can draw the edge of every feet as a collision polygon inside.
Then i play with angular velocity and a clamp collision answer.
What i need is my object reacting more or less like a IK link with min/man angular movement.
Is this kind of movement is too complicated to be achieve with TGB ?
When i mount dummies to another object they lost all motion. Is this the right way of doing or should i try to do this movement with Math ?
What i don't really understand is the way i can use and adjust the collision answer.
i have resolved the shock absorber like this
// Mouse position is used to move the entire leg
// 12.50 is the max Y position before leg touch the ankle
// 20 is the max Y feet release position
function updateLeg(%this)
{
if ((getWord(leg.lastMousePos, 1)+12.50)<=ankle.getPositionY()) {
leg.setPosition(leg.lastMousePos);
}
leg.setPositionX(getWord(leg.lastMousePos, 0));
ankle.setPositionX(leg.getPositionX());
if(ankle.getPositionY() <= leg.getPositionY()+20.0)
{
ankle.setConstantForceY(2000.0);
}
else
{
ankle.setConstantForceY(0.0);
ankle.setPositionY(leg.getPositionY()+20.0);
leg.setPosition(leg.lastMousePos);
}
}Also when feet's encounter collision from side the whole leg should be able to rotate a bit. This is probably possible with rigid body but the physic is too unstable.
Could you help me a little on this ? Thanks.
About the author
Leadwerks
#2
What I do is make the "piston" and "cylinder" parts of the shock abosorber legs into separate sprites that slide pase each other. I start with the "foot" sprite mounted some offset from the lander body, with the "piston" mounted to the foot, and the "cylinder" mounted to the lander body. And in the onUpdateScene callback, I set the rotation of the piston and cylinder so that they are pointed in the same direction (based on the angle from the foot to the attach-point on the lander body). When they overlap, with the piston behind the cylinder, it looks to the user like it's just one solid object that looks like a shock absorber. Then, when the foot collides with the ground, I use the onCollision callback to dismount the foot from the lander, and have it "stick" where it hit the ground. Now, when the lander moves (independent of the foot), and the piston and cylinder rotations are kept in synch based on the current angle between the stationary foot and the moving lander, it looks like the piston is sliding into the cylinder and the shock absorber is doing what shock absorbers do. And at this point I went nuts with equations for hydraulic dampers and springs, and applying forces and torques to the lander based on them, basically doing my own IK in script, which is NOT a path I'd recommend, unless you absolutely need it. Most of it can probably be fudged.
From the picture, it looks like you may not even need the rotation synching step (my shock absorbers were mounted on pivots, it looks like yours is rigidly mounted, but your last paragraph seems to say that they pivot a little bit).
Hope this helps.
12/17/2006 (9:21 pm)
I have a similar "lander with shock absorbers" in a project I'm working on (that's currently on hold), so I'll try to tell you how I'm doing it, and maybe it will give you some ideas. First, since TGB doesn't have anything like built-in inverse kinematics, I figured I would have to do it myself. The good news is that since the legs are shock abosorbers, they are mushy, and you therefore don't have to worry about trying to hack into the rigid body code in the engine, you can just approximate.What I do is make the "piston" and "cylinder" parts of the shock abosorber legs into separate sprites that slide pase each other. I start with the "foot" sprite mounted some offset from the lander body, with the "piston" mounted to the foot, and the "cylinder" mounted to the lander body. And in the onUpdateScene callback, I set the rotation of the piston and cylinder so that they are pointed in the same direction (based on the angle from the foot to the attach-point on the lander body). When they overlap, with the piston behind the cylinder, it looks to the user like it's just one solid object that looks like a shock absorber. Then, when the foot collides with the ground, I use the onCollision callback to dismount the foot from the lander, and have it "stick" where it hit the ground. Now, when the lander moves (independent of the foot), and the piston and cylinder rotations are kept in synch based on the current angle between the stationary foot and the moving lander, it looks like the piston is sliding into the cylinder and the shock absorber is doing what shock absorbers do. And at this point I went nuts with equations for hydraulic dampers and springs, and applying forces and torques to the lander based on them, basically doing my own IK in script, which is NOT a path I'd recommend, unless you absolutely need it. Most of it can probably be fudged.
From the picture, it looks like you may not even need the rotation synching step (my shock absorbers were mounted on pivots, it looks like yours is rigidly mounted, but your last paragraph seems to say that they pivot a little bit).
Hope this helps.
Torque Owner Thomas Buscaglia