Hi.
I have this situation:
and I dont know how to get direction vector (marked on red). I need it to show Newton dynamics the direction in which the cannonball will fly.
Thanks for help
How to get direction vector
I had the same problem with a character model.
I've created a frontDirection vector that shows the initial rotation and rotated it with the SceneNode.
If the getRotation() method doesn't work you could try this:
Create an empty SceneNode. Set position as initial direction (direction of your meshSceneNode):
Set that empty node as child of your meshSceneNode. If the meshSceneNode is rotated, the empty node is rotated too.
You can get the direction vector like this:
not sure if it works.
I've created a frontDirection vector that shows the initial rotation and rotated it with the SceneNode.
If the getRotation() method doesn't work you could try this:
Create an empty SceneNode. Set position as initial direction (direction of your meshSceneNode):
Code: Select all
x=1,y=0,z=0 => direction vector showing along +X-axis.
You can get the direction vector like this:
Code: Select all
vector3df dir = emptyNode->getAbsolutePosition() - meshNode->getAbsolutPosition();
dir.normalize();
-
- Posts: 275
- Joined: Fri May 12, 2006 6:37 pm
- Location: Germany
uhm.. why simple if its possible to do it the hard way??
(dunno if everything is spelled correct.. so if it doesn´t work, just havge a look for the correct spelling).
Code: Select all
vector3df dir(1,0,0);
node->getAbsoluteTransformation().rotateVect(dir);