Swimming: Rotate plus animation
by Luke Jones · in Torque Game Engine · 11/24/2003 (7:30 pm) · 2 replies
Ok, so Im trying to make proper swimming for torque.
What I need is a node that the Player Model is linked to (like a root node).
Then I need to somehow rotate that node, so the whole model tilts forward/back with the mouse direction (like Alt+C cam) and *swims* in tha direction when in a water block.
I started off by modifying/copying the mHead stuff in player.cc, but Im not sure if thats the way to go.
And adding the swimming animation?
Not quite sure how to do this either.
Is anyone kind enough to make a .dsq swim anim? SOmething thats like a dog-paddle perhaps. (and an updated orc/torque-guy with swimNode)
Theres also the problem of the player appearing to stand on the water, how could this be fixed?
Can someone explain the code under "// Update current orientation" in player.cc a little better?
AND, in player.cc
there is "shadowNode = spineNode[0];"
in shapebase.cc
S32 shadowNode = mDataBlock->shadowNode;
if (shadowNode>=0)
{
// adjust for movement of shape outside of bounding box by tracking this node
Point3F offset; mShapeInstance->mNodeTransforms[shadowNode].getColumn(3,&offset);
offset -= mShapeInstance->getShape()->defaultTranslations[shadowNode];
offset.z = 0.0f;
pos += offset;
}
Could that be used for the swimNode (where the model will rotate)
Mouse will control the model rotation. ie, move mouse forward to pitch/tilt forward, back to pullup/lookup.
I think thats it.
What I need is a node that the Player Model is linked to (like a root node).
Then I need to somehow rotate that node, so the whole model tilts forward/back with the mouse direction (like Alt+C cam) and *swims* in tha direction when in a water block.
I started off by modifying/copying the mHead stuff in player.cc, but Im not sure if thats the way to go.
And adding the swimming animation?
Not quite sure how to do this either.
Is anyone kind enough to make a .dsq swim anim? SOmething thats like a dog-paddle perhaps. (and an updated orc/torque-guy with swimNode)
Theres also the problem of the player appearing to stand on the water, how could this be fixed?
Can someone explain the code under "// Update current orientation" in player.cc a little better?
AND, in player.cc
there is "shadowNode = spineNode[0];"
in shapebase.cc
S32 shadowNode = mDataBlock->shadowNode;
if (shadowNode>=0)
{
// adjust for movement of shape outside of bounding box by tracking this node
Point3F offset; mShapeInstance->mNodeTransforms[shadowNode].getColumn(3,&offset);
offset -= mShapeInstance->getShape()->defaultTranslations[shadowNode];
offset.z = 0.0f;
pos += offset;
}
Could that be used for the swimNode (where the model will rotate)
Mouse will control the model rotation. ie, move mouse forward to pitch/tilt forward, back to pullup/lookup.
I think thats it.
About the author
Core developer using Rust lang at Sphere Identity.
#2
And prevent the player coming too far out of the water when swimming, like being in the middle of the water block and looking like a dolphin doing tricks.
Maybe implement some swim up/down buttons for the z-axis.
No need for pivot points or anything, no new nodes, nada!
All done with the eye vector, which i finaly learnt how to use.
Now can anyone do a swim animation for us?
Might see if, in/out transitions could be done.
11/25/2003 (3:18 pm)
Well, made soem good progess, porper directional swimming is in place. Now just need to float up/down with waves, or do a quick hack for it(something like using a sine wave).And prevent the player coming too far out of the water when swimming, like being in the middle of the water block and looking like a dolphin doing tricks.
Maybe implement some swim up/down buttons for the z-axis.
No need for pivot points or anything, no new nodes, nada!
All done with the eye vector, which i finaly learnt how to use.
Now can anyone do a swim animation for us?
Might see if, in/out transitions could be done.
Torque Owner Luke Jones
Ideally, I want to play the swim animation constantly when in a waterblock at coverage 0.8 or something, and just rotate/pivot the model around the swimNode.