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:
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:
I changed that to the following, doing the same for the "getSecondGeometry()" section too:
...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.
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.