vector3df CAntCharacter::faceTarget(vector3df targetpos, vector3df nodepos)
{
core::vector3df posDiff = targetpos - nodepos;
f32 degree = nodepos.Y; //keep current rotation if nothing to do
posDiff.normalize();
if (posDiff.X != 0.0f || posDiff.Z != 0.0f)
degree = atan2(posDiff.X,posDiff.Z) * core::RADTODEG;
f32 degreeX = 0;
//for example:
//if degreeX is -40 the ant bends over up
//if degreeX is 40 the ant bends over downwards
//I need to detect a climb or slope to set the value of degreeX
return vector3df(degreeX,degree,0);
}
void CAntCharacter::moveto(ISceneNode *node, vector3df vel)
{
irr::core::matrix4 m;
m.setRotationDegrees(node->getRotation());
m.transformVect(vel);
vector3df nodePosition = node->getPosition();
node->setPosition(nodePosition + vel);
node->updateAbsolutePosition();
}
But the thing is when the ant rises a climb I can´t do that the ant bend over up and when the ant descend a slope bend over downwards.
In the code I explain this...
Someone have any idea?
Hello, I need to know what is the better physic engine to use following the next points:
- Easy to use
- No extra installations for distribution
- As I am using a terrain loaded from irr file I need to collide with it using the physic engine.