I have set up an function to set all my objects load in the irrlicht engine in the ground
Code: Select all
void ECSS_StaticObject::fixGround(void)
{
f32 middleObject = (objectMeshNode->getTransformedBoundingBox().MaxEdge.Y) - (objectMeshNode->getTransformedBoundingBox().getCenter().Y);
vector3df start = objectMeshNode->getPosition();
vector3df end = start;
cout << "Start " << start.Y << endl;
end.Y=end.Y- 20000.0;
cout << "End " << end.Y << endl;
triangle3df triangle;
line3d<f32> line(start, end);
device->getSceneManager()->getSceneCollisionManager()->getCollisionPoint(line, terrainSelector, end, triangle);
cout << "Collision at " << end.Y << endl;
f32 distance = (start.Y-end.Y);
start.Y = start.Y - distance;
cout << "Distance height" << start.Y << endl;
objectMeshNode->setPosition(start);
objectMeshNode->setDebugDataVisible(true);
}
It's just doing a collision bettwen the object and the ground and set the position to the meshNode.
Is it becase setPosition is setting the relative position??? how to do because there aren't setAbsolutePosition function
Thank for help!!