

I have a problem though, How can I use the addTorque(const Vector3& torque) method to apply torque only to the vehicle's Z axis and not the world's Z axis. I tried _getDerivedOrientaton but it didn't work

They're not both trimesh objects. The Terrain demo uses the special terrain collision primitive, which can handle much larger terrains, much more efficiently than using a Trimesh. It does mean that you have to modify ODE though to add that collision primitive. The trimesh demo isn't a terrain, it's just a mesh that looks like a little chunk of terrain.It just seemed strange that if they are both trimesh objects that the jeep is fine but the boxstack with terrain isn't.
You shouldn't need to edit/pick any versions of config.h, as I understand it that's what the configurator.exe (built with "make configure") component of ODE does for you, based on your user settings.There is a config.h file that works and a few that don't for vc7. I had picked/edited the wrong one(s). The correct one(s) are in C:\Program Files\ODE\contrib\msvc7\ode_default or tricollider.
Take a look at the code for MeshInformer::createStaticTriangleMesh, which looks something like this;How do you use the ODE trimesh class. What ODE functions do you need to call and what do you need to pass into them.
Also, how do you count vertices from a mesh?
Code: Select all
TriangleMeshGeometry* MeshInformer::createStaticTriangleMesh(SceneNode* node,Space* space)
{
MeshInformer mi;
TriangleMeshGeometry* geom = 0;
mi.addAllMeshes(node,node->getPosition(),node->getOrientation(),node->getScale());
if(mi.getVertexCount() && mi.getIndexCount())
{
geom = new TriangleMeshGeometry(mi.getVertices(),mi.getVertexCount(),mi.getIndices(),mi.getIndexCount(),space);
}
return geom;
}
Use Body::addRelativeTorque. See the ODE docs for more details.How can I use the addTorque(const Vector3& torque) method to apply torque only to the vehicle's Z axis
Not now, apparently, no.You're not going to die on us are you?
Code: Select all
g++ -g -O2 -o .libs/SimpleScenes ./SimpleScenes.o ./SimpleScenesApplication.o -L/home/rastaman/src/ogre/ogrenew/OgreOde/src -L/home/rastaman/src/ogre/ogrenew/OgreOde/ode-0.5/lib /home/rastaman/src/ogre/ogrenew/OgreOde/src/.libs/libOgreOde -lOgreMain -lz -lm -lode
./SimpleScenes.o(.text+0x81): In function `SimpleScenes::~SimpleScenes [in-charge deleting]()':
/home/rastaman/src/ogre/ogrenew/OgreOde/demos/SimpleScenes/src/SimpleScenes.cpp:162: undefined reference to `OgreOde::World::getCollisionListener()'
./SimpleScenes.o(.text+0x25e): In function `SimpleScenes::~SimpleScenes [in-charge deleting]()':
/usr/include/g++/i586-suse-linux/bits/gthr-default.h:512: undefined reference to `OgreOde::CollisionListener::~CollisionListener [not-in-charge]()'
./SimpleScenes.o(.text+0x384): In function `SimpleScenes::~SimpleScenes [in-charge deleting]()':
/usr/include/g++/bits/basic_string.h:249: undefined reference to `OgreOde::Body::MovableType'
./SimpleScenes.o(.text+0x553): In function `SimpleScenes::~SimpleScenes [in-charge deleting]()':
../../../include/OgreOdeStepper.h:12: undefined reference to `OgreOde::CollisionListener::~CollisionListener [not-in-charge]()'
./SimpleScenes.o(.text+0x59c): In function `SimpleScenes::~SimpleScenes [in-charge deleting]()':
../../../../OgreMain/include/OgreMemoryManager.h:420: undefined reference to `OgreOde::World::setCollisionListener(OgreOde::CollisionListener*)'
./SimpleScenes.o(.text+0x901): In function `SimpleScenes::~SimpleScenes [in-charge]()':
/home/rastaman/src/ogre/ogrenew/OgreOde/demos/SimpleScenes/src/SimpleScenes.cpp:162: undefined reference to `OgreOde::World::getCollisionListener()'
./SimpleScenes.o(.text+0xade): In function `SimpleScenes::~SimpleScenes [in-charge]()':
/usr/include/g++/i586-suse-linux/bits/gthr-default.h:512: undefined reference to `OgreOde::CollisionListener::~CollisionListener [not-in-charge]()'
./SimpleScenes.o(.text+0xbea): In function `SimpleScenes::~SimpleScenes [in-charge]()':
/usr/include/g++/bits/basic_string.h:249: undefined reference to `OgreOde::Body::MovableType'
./SimpleScenes.o(.text+0xdb5): In function `SimpleScenes::~SimpleScenes [in-charge]()':
../../../include/OgreOdeStepper.h:12: undefined reference to `OgreOde::CollisionListener::~CollisionListener [not-in-charge]()'
./SimpleScenes.o(.text+0xdfe): In function `SimpleScenes::~SimpleScenes [in-charge]()':
../../../../OgreMain/include/OgreMemoryManager.h:420: undefined reference to `OgreOde::World::setCollisionListener(OgreOde::CollisionListener*)'
./SimpleScenes.o(.text+0x1161): In function `SimpleScenes::~SimpleScenes [not-in-charge]()':
/home/rastaman/src/ogre/ogrenew/OgreOde/demos/SimpleScenes/src/SimpleScenes.cpp:162: undefined reference to `OgreOde::World::getCollisionListener()'
I think you could do this by altering the collision(OgreOde::Contact* contact) function of your class inheriting from OgreOde::CollisionListener.. Just check which objects are involved in the collision and return false if you don't want them to 'hit'? I havn't done this, but it sounds like it should workTroglodit wrote:Question 1:
how I can detect ONLY COLLISION (without jumping away objects)
Bingo. In fact Falagard's code does exactly this by setting (and checking) the collision bitfield. You could also use the category bitfield, or even the user data value to decide whether or not your collision should be ignored.I think you could do this by altering the collision(OgreOde::Contact* contact) function of your class inheriting from OgreOde::CollisionListener. Just check which objects are involved in the collision and return false if you don't want them to 'hit'?
Don't. If you're needing to manually set positions and orientations (apart from during the set up of your scene) then you're breaking the laws of physics that ODE is designed to preserve. If your body isn't in the right position then you should apply a force to move it towards the position it should be in. If it's not oriented correctly then you should apply a torque until it is.Question 2:
how correctly do setPosition()/setOrientation() to Entyties with Bodyes without forces.
Bingo. In fact Falagard's code does exactly this by setting (and checking) the collision bitfield. You could also use the category bitfield, or even the user data value to decide whether or not your collision should be ignored.
Thanks. I will try.I think you could do this by altering the collision(OgreOde::Contact* contact) function of your class inheriting from OgreOde::CollisionListener.. Just check which objects are involved in the collision and return false if you don't want them to 'hit'? I havn't done this, but it sounds like it should work
I was afraid of itDon't. If you're needing to manually set positions and orientations (apart from during the set up of your scene) then you're breaking the laws of physics that ODE is designed to preserve. If your body isn't in the right position then you should apply a force to move it towards the position it should be in. If it's not oriented correctly then you should apply a torque until it is.
I must apply to CAMERA+ray... May be anyone has a sample ?
That's a cool idea. But there are plenty of other things to worry about first!When ragdoll kicks in, are you actually taking into account the linear/angular velocity of the bones in the animation...
Code: Select all
#ifndef _OGREODEPREREQS_H_
#define _OGREODEPREREQS_H_
#include "Ogre.h"
#include "OgreNoMemoryMacros.h"
#include "ode/ode.h"
#include "OgreMemoryMacros.h"
using namespace Ogre;
// #define OGREODE_TERRAINGEOMETRY
// #define OGREODE_PLANARJOINT
namespace OgreOde
{
#if OGRE_PLATFORM == PLATFORM_WIN32
// Begin Modification
#ifdef __MINGW32__
#define _OgreOdeExport
#else
# if defined( OGREODE_EXPORTS )
# define _OgreOdeExport __declspec( dllexport )
# else
# define _OgreOdeExport __declspec( dllimport )
# endif
#endif
// End Modification
#else
# define _OgreOdeExport
#endif
class World;
class Body;
class Mass;
class JointGroup;
class Joint;
class Space;
class Geometry;
class TriangleMeshGeometry;
class BoxGeometry;
class CollisionListener;
class Contact;
class DebugObject;
class Stepper;
class MaintainedItem;
}
#endif