Vehicle Wheel Contact Parameters Have No Effect

Pryo

01-03-2010 14:12:32

The parameters "bouncyness", "friction" and "fds" in .ogreode vehicle prefab config files seem to have no effect, even in the GrandTurismOgre demo.

E.g. in the file "jeep.ogreode" these lines have no effect:

<contact bouncyness="0.9" friction="1.5" fds="0.004" />

I did some tweaking of the OgreOde code and got it working. I wonder if this is a bug, or if I am doing something wrong.

Here is the original code, beginning at line 638 of OgreOdeVehicle.cpp:

bool Vehicle::handleTyreCollision(OgreOde::Contact* contact)
{
Geometry *geom = contact->getFirstGeometry();
Ogre::Any a = geom->getUserAny();
if (!a.isEmpty () && a.getType() == typeid(OgreOde_Prefab::Object))
{
OgreOde_Prefab::Object* pObject = static_cast<OgreOde_Prefab::Object *> (any_cast<OgreOde_Prefab::Object *> (a));
if (pObject &&
(pObject->getObjectType() == OgreOde_Prefab::ObjectType_Wheel))
{
((OgreOde_Prefab::Vehicle::Wheel*)(pObject))->setupTyreContact(contact);
return true;
}
}
[...]


I changed that to the following, doing the same for the "getSecondGeometry()" section too:

bool Vehicle::handleTyreCollision(OgreOde::Contact* contact)
{
Geometry *geom = contact->getFirstGeometry();
Ogre::Any a = geom->getUserAny();
if (!a.isEmpty () && a.getType() == typeid(OgreOde_Prefab::Vehicle::Wheel*))
{
OgreOde_Prefab::Vehicle::Wheel* pWheel = static_cast<OgreOde_Prefab::Vehicle::Wheel *> (any_cast<OgreOde_Prefab::Vehicle::Wheel *> (a));
pWheel->setupTyreContact(contact);
return true;
}
[...]


...and everything now seems to work properly.

I didn’t dig too deep, but I can say that with the original code, no object was ever triggering true for: "a.getType() == typeid(OgreOde_Prefab::Object)". So I just tried specifically testing for Vehicle::Wheel* at the first if statement and it seems to work.

dermont

04-03-2010 00:23:50


I did some tweaking of the OgreOde code and got it working. I wonder if this is a bug, or if I am doing something wrong.

I don't think you are doing anything wrong, the original code appears wrong to me. You should submit a patch to the tracker.

Bludo

26-03-2010 18:15:55

This is, in fact, broken as you suggest. I'm working on it now. Thanks for picking it up. If there are more changes, feel free to post a patch - it would probably save some time.

Bludo