Page 16 of 17

Posted: Tue Nov 16, 2004 12:14 pm
by notatoa
hi monster! I would like to say that your OgreOde is fantastic !! :D I've had trouble using vanilla ODE and it is a sight for sore eye! can I send you a thank you card for that ? :D

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 :(

Posted: Tue Nov 16, 2004 1:46 pm
by monster
It just seemed strange that if they are both trimesh objects that the jeep is fine but the boxstack with terrain isn't.
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.
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.
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.
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?
Take a look at the code for MeshInformer::createStaticTriangleMesh, which looks something like this;

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;
}
How can I use the addTorque(const Vector3& torque) method to apply torque only to the vehicle's Z axis
Use Body::addRelativeTorque. See the ODE docs for more details.
You're not going to die on us are you?
Not now, apparently, no.
:D

Posted: Tue Nov 16, 2004 6:25 pm
by KeaponLaffin
monster wrote:
You're not going to die on us are you?
Not now, apparently, no.
:D
That's good to hear. :D

Posted: Sat Nov 20, 2004 9:41 am
by Goosey
Hi, I am trying to come up with a movement system for my fps OgreODE game. Right now I have an ODE sphere and I am floating a camera above it. I am setting the sphere's orientation to be the same as the player's orientation every frame, and this seemed to work pretty well for controlling movement with addRelativeTorque.

The problem I ran into was I couldn't set a ceiling for the movement speed. getTorque() seemed to not work, it always returned the same value for every axis(-1.0737418e+008). The function seems broken.. I thought maybe manually setting orientation was screwing it up, but I discovered it behaved the same even when I didn't mess with it's orientation.

So I thought it might be better to set the sphere's linear velocity directly, but the issue I am having with that is that there is no way to do it relatively... Or is there? I imagine there is some way to use the data of the sphere's orientation Quaternion to make a Vector3 that will 'point' the velocity in the right direciton.. But I just don't know the math behind it :|

Any suggestions?

Posted: Sat Nov 20, 2004 1:42 pm
by Falagard
All the code you need for setting linear velocity directly can be found here:

http://www.larabie.net/ogre/LOTGameInterface.cpp

and

http://www.larabie.net/ogre/LOTGameInterface.h

Those files are temporary and posted just for you! :-)

Note that much of this code was inspired by code from here:

http://www.vrac.iastate.edu/~streeter/m ... round.html


Clay

Posted: Sat Nov 20, 2004 5:43 pm
by rastaman
has anyone made linux makefile for this yet ?

Posted: Sat Nov 20, 2004 10:15 pm
by Troglodit
Hi !

Question 1:
how I can detect ONLY COLLISION (without jumping away objects)

Question 2:
how correctly do setPosition()/setOrientation() to Entyties with Bodyes without forces.

I just try to correctly detect an entity (with Body) in a center of screen.
at first i was tried to use RayQuery of Ogre, but it detect only bounding box, and I need to detect it more correctly.

Thank you.

Posted: Sat Nov 20, 2004 11:11 pm
by rastaman
Well i started to make linux makefiles for OgreOde. I don't know how to make it work in the scripts directory, so the top (where configure.in)is ogrenew/OgreOde. Anyway OgreOde compiles, haven't tested install, but I'm having trouble with the demo SimpleScenes. When it compiles i get a bunch of errors about "undefined reference to `OgreOde::..." not sure why.

If anyone wants to take a look get the files here http://www.ceejs.com/eric/ogreode.makefiles.tgz

Heres a snip of the errors... it goes on for about 200 lines.

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()'

Posted: Sun Nov 21, 2004 12:11 am
by Goosey
@Falagard: Thanks a ton! I'll check these out tonight.

EDIT: Tried it out and it works great. Nice job! :)

@Troglodit:
Troglodit wrote:Question 1:
how I can detect ONLY COLLISION (without jumping away objects)
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 :)

Posted: Sun Nov 21, 2004 3:50 am
by monster
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'?
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.
Question 2:
how correctly do setPosition()/setOrientation() to Entyties with Bodyes without forces.
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.

Posted: Sun Nov 21, 2004 9:06 am
by Troglodit
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'? I havn't done this, but it sounds like it should work
Thanks. I will try.
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.
I was afraid of it :shock: . This SetPosition/SetOrientation I must apply to CAMERA+ray. I think it is simpler to shoot oneself than correctly calculate the forces to move/rotate/stop the camera. May be anyone has a sample ?
May be I can dinamically create thar ray every frame, detect collision (if it present) and remove it ?

Posted: Sun Nov 21, 2004 4:04 pm
by monster
I must apply to CAMERA+ray... May be anyone has a sample ?

Isn't that what Falagard's code does?

Meanwhile, here's a in-development shot of the Ragdoll "Prefab" (as I'm now calling them) - The geometries and joints are set up automatically (although you can configure them to a certain extent) based on the current state of the animation of the skeleton. So when you shoot something that's walking the ragdoll will take over from wherever they currently are in the "walk" animation.

Kill the zombie!
Image

Posted: Sun Nov 21, 2004 4:21 pm
by sinbad
Wow, that's looking awesome, nice work monster! :D

Posted: Sun Nov 21, 2004 5:12 pm
by Falagard
Oohh.. sweet!

How are you doing it, Monster? Ragdoll usually requires some sort of joint set up with constraints doesn't it?

Are you just using (ball?) joints at each bone location instead, and not worrying about constraints?

When ragdoll kicks in, are you actually taking into account the linear/angular velocity of the bones in the animation, or just turning off the animation and allowing the physics to take over as if the character weren't moving?

Just curious - either way this is cool, and great work :-)

Clay

Posted: Sun Nov 21, 2004 7:11 pm
by Robomaniac
:')

Just Simply Beautiful monster, you come through again!

Posted: Mon Nov 22, 2004 6:44 am
by notatoa
gulp ... AWESOME !!! :shock:

Posted: Mon Nov 22, 2004 7:51 am
by ahmedali
@monster
How capsules are working? And what about Joint Limits?
and
How is the front-end to setup ragdoll geoms for skinned skeleton?

Posted: Mon Nov 22, 2004 8:12 am
by monster
Capsules work fine, why wouldn't they?
You can set the joint limits (and types of joint used, and types of geometry used) programatically.
There isn't a front-end, the idea is that it's as automatic as possible.
When ragdoll kicks in, are you actually taking into account the linear/angular velocity of the bones in the animation...
That's a cool idea. But there are plenty of other things to worry about first!

Posted: Mon Nov 22, 2004 2:36 pm
by Banania
Nice work ! Monster rocks !!!!!

Posted: Tue Nov 23, 2004 4:03 am
by woody
Monster is there any way that you can release your code for the car simulation part of the game that you made? I want to make a car game for fun but I am having a lot of trouble with the ODE joints.

Posted: Tue Nov 23, 2004 5:28 am
by monster
As I said in the other thread, it's all in the "Vehicle" class, see the "Buggy" demo for details.

HTH.
:D

Posted: Tue Nov 23, 2004 1:12 pm
by SpannerMan
Yes! Ragdoll physics demo using ODE and OGRE, now thats something I can not wait to see! Go Monster!

Posted: Fri Nov 26, 2004 5:16 pm
by PJB
Hi Monster,

thanks for the awesome update to OgreODE... the landscape project looks like it should be a great starting point for almost any vehicle based game!

I've been playing around with it a bit and as I didn't like the extreme bouncy feel of the vehicle I was mucking around with the suspension damping factors and not getting the results I wanted... I'm not sure if this is a bug or just a different way of doing things but it seems to me like the damping factor should be range 0.0 -> 1.0 (you have it set at 0.9 currently) should the lines in Vehicle::Wheel::setSuspension that set ERP and CFM use a value of:
_step * _spring / (_step * _spring / _damping)
rather than
_step * _spring / (_step * _spring + _damping)
?

Using a damping value of 0.1 now produces extreme damping, and obviously 0.9 produces almost no damping at all, so maybe (1.0 - _damping) would be better. Of course it should trap the divide by zero elegantly. The jeep feels really solid with this damping set to 0.25.

Oh, while I was at it I set _spring to 100 (rather than 50) in landscape.cpp, and increase the vehicle speed by using a revlimit of 50, and a max torque of 20... this lets the jeep fly across the terrain fast enough to jump over most humps :) Moving the camera back to a follow distance of 18.0 helps reduce travel sickness too!

Quick question... is it possible to deform this landscape type on-the-fly?

Posted: Sat Nov 27, 2004 9:26 pm
by ProfesorX
Hi monster!

i just compile your OgreOde with mingw and the agency version of ogre.

I only want to say that if someone has interest in compiling ogreode with mingw, you have to do the following modification to the OgreOdePreReqs.h file

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
it would be great if this patch is included in the next version of OgreOde :wink:

Posted: Tue Nov 30, 2004 3:45 am
by Goosey
Well I just got the 'final' version of the scene/meshes for our level. It is about a 55k poly city (most textures not on it yet).

I loaded it up (using some additions to the sceneloader to have it create an ODE trimesh) and was a little upset to see i was getting about 20-30fps on my comp. With no textures, and taking into account my comp is much beefier then the comps at school.. I am a bit worried about it running playably there.

To see how much effect ODE was having on performance I disabled the trimesh loading.. About 100fps. Not bad, so it is ODE that is causing the hit. Well I knew trimeshes are expensive, so I can only blame myself.

The thing that is really confusing me though is this: With ODE on when I move out from the city (so that the whole thing is in view) the tricount is about 110k. With ODE off when I move out it is 55k (which my artist claims it should be at). So.. Can anyone explain to me where that extra 55k is coming from?

I thought about the possibility of it generated from the debug info, but it is still 110k when debug info is off.. I realize it could still be maintaining the debug info invisibly. If this is the case, then is there a way I can totally disable the debug info? I am guessing that cutting those extra 55k polys mgiht help my performance a bit.

Thanks.. And Monster that ragdoll pic looks absolutely sweet. I can't wait to see it in motion!