Strange moving

Fred

02-03-2008 00:34:16

Hi there,

I've a very strange problem moving my objects. I have create a player which can be moved by the user and some crates on which the player should move. My problem is that the player don't really can't move on my crates. At the end of one crate and at the beginning of the other crate the player stops. I can't move it further. It is like running against a wall. the player tries to get trough, but it doesn't work.
Of course every crate has the same properties.


My question: What could be wrong?

Because I don't know what code I shall post, here are some excerpts:

Creating Physics:

m_pWorld = new OgreOde::World(m_pSmgr);
m_pWorld->setCFM(10e-5);
m_pWorld->setERP(0.8);
m_pWorld->setAutoSleep(true);
m_pWorld->setAutoSleepAverageSamplesCount(10);
m_pWorld->setContactCorrectionVelocity(1.0);

m_pStepHandler = new OgreOde::ExactVariableStepHandler(m_pWorld, OgreOde::StepHandler::QuickStep);


Creating an object(this is the same procedure for every object(crates are static objects in this case))


m_pEntity = m_Level.getSceneManager()->createEntity(m_ID, m_MeshFilename);
m_pEntity->setCastShadows(true);
m_pEntity->setNormaliseNormals(true);
m_pEntity->setQueryFlags(1<<2);

m_pSceneNode = m_Level.getSceneManager()->getRootSceneNode()->createChildSceneNode(m_ID + std::string("_node"));
m_pSceneNode->attachObject(m_pEntity);
m_pSceneNode->setPosition(m_Position);
m_pSceneNode->rotate(m_RotationDirection, Ogre::Radian(m_RotationDegree));

OgreOde::EntityInformer* pEntInfo;
pEntInfo = m_StaticBody ? new OgreOde::EntityInformer(m_pEntity, m_pSceneNode->_getFullTransform()) : new OgreOde::EntityInformer(m_pEntity);
m_pGeometry = pEntInfo->createStaticTriangleMesh(m_Level.getWorld(), m_Level.getWorld()->getDefaultSpace());

if(!m_StaticBody)
{
m_pBody = new OgreOde::Body(m_Level.getWorld());
m_pGeometry->setBody(m_pBody);
m_pSceneNode->attachObject(m_pBody);

OgreOde::BoxMass mass(m_Mass, pEntInfo->getSize());
mass.setDensity(m_Density, pEntInfo->getSize());
m_pBody->setMass(mass);
}

m_pEntity->setUserObject(m_pGeometry);
m_pGeometry->setUserObject(this);
//m_pGeometry->setDebug(true);


Thanks for help

Fred

rewb0rn

03-03-2008 21:09:36

Are the crates moving? Let show the debug objects of your player and crates by calling setDebug(true); and see if there are any obvious displacements.

Fred

03-03-2008 21:16:27

No they don't move. The crates are static in this case. Accordingly no bodys are created.

I used setDebug true, but there were nothing special to see.
Interesting: If I position one crate into an other crate to make surer that there ist no gap, i nevertheless can't go to the other crate

rewb0rn

03-03-2008 21:22:19

Maybe its not the reason but make sure your collide function returns false when the crates intersect. Also try little gaps between the crates and of course changing values like friction, bouncyness and force dependent slip (also for your player).

Fred

05-03-2008 20:02:14

Mh nothing works. Little gaps between the crates are very disliked by my objects. I have been trying some other player-models and i recognized that if I e.g. have a sphere, it moves a bit better. But if I use e.g. a cube this cube "jumps" around and is not really controllable.

EDIT: Also if I don't use a custome collisionListener it doesn't work.
Do I have to create the whole Level in an 3D-program and after that do I have to import it?

rewb0rn

06-03-2008 09:05:29

No, I import several models in my application and it works fine, the reason has to be something else.

Fred

06-03-2008 13:29:04

Do you have one model for your level or do you also load a lot of objects. How big are the models in your application.

Do you know some _good_ values for fds, friction etc.?

rewb0rn

08-03-2008 11:47:03

I think I am using 4 different models for my level right now and I have no problems doing so. They are quite big but I think that doesn't effect the situation. Good values depend on many different things, e.g. the size of your objects, the weight of the objects etc. Maybe you can try to increase the weight and forces for your player.