Hi for all and congratulations for your great engine.
I have 3 basic questions, (sorry for my bad english)
1.- How to make an object child to another node->addChild(node2) ??
2.- How to get the distance from two objects
3.- How to make an object pointing to another objetc or point in 3d space or how to get the angel beetwen the two objects and modify the axis angle of one to point to another.
thanks a lot in advance.
Jose Luis
3 basic questions
-
Guest
sorry, i edit my message again to get out the errors:
1.- How to make an object child to another: node->addChild(node2) ??
2.- How to get the distance from two objects
3.- How to make an object pointing to another object, or point at ome point in 3d space, or how to get the angle beetwen the two objects, and modify the axis angle?.
thanks a lot in advance.
Jose Luis
1.- How to make an object child to another: node->addChild(node2) ??
2.- How to get the distance from two objects
3.- How to make an object pointing to another object, or point at ome point in 3d space, or how to get the angle beetwen the two objects, and modify the axis angle?.
thanks a lot in advance.
Jose Luis
Yes, this will work. Or, you can assign the parent when you create the node.1.- How to make an object child to another: node->addChild(node2) ??
scenemanager->addAnimatedMeshSceneNode(mesh, parent, id, position, rotation, scale)
I think this would work.2.- How to get the distance from two objects
Code: Select all
irr::vector3df getDelta(irr::vector3df posSource, irr::vector3df posDestination){
irr::vector3df tempVector;
tempVector.X = posSource.X - posDestination.X;
tempVector.Y = posSource.Y - posDestination.Y;
tempVector.Z = posSource.Z - posDestination.Z;
return tempVector;
}
Well, only the camera has "camera->setTarget(vector3df pos)" that you can use to specify the position of the object to be looked at.3.- How to make an object pointing to another objetc or point in 3d space or how to get the angel beetwen the two objects and modify the axis angle of one to point to another.
Looking through the code, it's just some geometry. You could do something like this, or calculate the angle yourself.
Code: Select all
core::vector3df pos = getAbsolutePosition();
core::vector3df tgtv = [color=red]Target[/color] - pos;
tgtv.normalize();
core::vector3df up = UpVector;
up.normalize();
f32 dp = tgtv.dotProduct(up);
if ((dp > -1.0001f && dp < -0.9999f) ||
(dp < 1.0001f && dp > 0.9999f))
up.X += 1.0f;
View.buildCameraLookAtMatrixLH(pos, Target, up);
recalculateViewArea();
Crud, how do I do this again?
-
Guest
thanks a lot.
[/quote]
Code: Select all
core::vector3df pos = getAbsolutePosition();
core::vector3df tgtv = [color=red]Target[/color] - pos;
tgtv.normalize();
core::vector3df up = UpVector;
up.normalize();
f32 dp = tgtv.dotProduct(up);
if ((dp > -1.0001f && dp < -0.9999f) ||
(dp < 1.0001f && dp > 0.9999f))
up.X += 1.0f;
View.buildCameraLookAtMatrixLH(pos, Target, up);
recalculateViewArea();