problem setPosition geometry

bounci

23-08-2007 22:54:44

Hi,
I have created a scene node an attached here an entity and a geometry (OgreOde).
The geometry and the visualized mesh does not have the same position. Why?

I want to generate a geometry that is at the same position as the mesh, because I want collision with that mesh.
Do someone has an idea how I can generate the geometry for the entity at the same position and scaled the same and so on like I've done with the node before?

Here is my code:

Entity* entity = mSceneMgr->createEntity( objName, meshName);
SceneNode* node;
node = mSceneMgr->getRootSceneNode()->createChildSceneNode(objName+"Node");
node->scale(0.2,0.2,0.2);
node->attachObject(entity);
node->setPosition(newPos);
entity->setNormaliseNormals(true);
OgreOde::EntityInformer ei(entity,node->_getFullTransform());
OgreOde::Geometry *geom = ei.createStaticTriangleMesh(mWorld,mSpace);
geom->setPosition(node->getWorldPosition());

rewb0rn

25-08-2007 03:27:06

try

Entity* entity = mSceneMgr->createEntity( objName, meshName);
SceneNode* node;
node = mSceneMgr->getRootSceneNode()->createChildSceneNode(objName+"Node");
node->attachObject(entity);
entity->setNormaliseNormals(true);
OgreOde::EntityInformer ei(entity,node->_getFullTransform());
OgreOde::Geometry *geom = ei.createStaticTriangleMesh(mWorld,mSpace);
node->setPosition(newPos);
node->scale(0.2,0.2,0.2);
geom->setPosition(node->getWorldPosition());
geom->setScale(node->getScale());

bounci

26-08-2007 17:20:03

There is no method setScale for Geometry.

I only want to create a TriMesh Object, entity for visualization and geom for collision detection. So they should be at one position, with the same scale and orientation.

I thought that should work because of that one:

OgreOde::EntityInformer ei(entity,node->_getFullTransform());
OgreOde::Geometry *geom = ei.createStaticTriangleMesh(mWorld,mSpace);

But what is the reason that the geom is not at the same position?
It seems that the geom is always at (0,0,0).