I sucessfully made it in the Cipher engine, but porting the same code to IrrLicht does not work.
First, I made a vector3df_AddScale() function:
Code: Select all
void vector3df_AddScale(const vector3df& a, const vector3df& b, float scale, vector3df& result)
{
result.X = a.X + scale * b.X;
result.Y = a.Y + scale * b.Y;
result.Z = a.Z + scale * b.Z;
}Code: Select all
void MoveSceneNode(ISceneNode* node, float x, float y, float z)
{
matrix4 matrix = node->getRelativeTransformation();
vector3df dest = node->getPosition();
vector3df axis0(matrix.M[0], matrix.M[1], matrix.M[2]);
vector3df axis1(matrix.M[3], matrix.M[4], matrix.M[5]);
vector3df axis2(matrix.M[6], matrix.M[7], matrix.M[8]);
vector3df_AddScale(dest, axis0, x, dest);
vector3df_AddScale(dest, axis1, y, dest);
vector3df_AddScale(dest, axis2, z, dest);
node->setPosition(dest);
}Does anibody know what should I change to make it work?
Thanks in advance.
