Page 15 of 38

Posted: Mon Apr 26, 2010 11:37 am
by Eigen
Okay, I thought it was getting stuck because of the player collision sphere but it's not. Instead .. I don't know how to explain it. I trace the line straight ahead from camera position (just like in your demo). And then I convert the 3d position to 2d screen position and draw a crosshair there. When hitting a body, everythings seems to work but when I hit a geom without a body, it doesn't always update the position. It does sometimes, but not always.

I made a video to show what I mean.
http://www.youtube.com/watch?v=f2yDyWjYMXQ

As you can see when I point the "imaginary line from the center of the camera" (later I'll change it to the position of the weapon) to the wall, it doesn't always collide and still keeps the last position. When pointing on the spheres, the crosshair is in the right position.

When I get back from school I'm going to try to add a body to my level but trying to disable its gravity and all other forces when bodies hit it. I guess setting linear velocity to 0 each frame should do it?

Posted: Mon Apr 26, 2010 12:00 pm
by Brainsaw
Hmm ... got no idea what happens there. Maybe you could add some debug information showing whether or not the position is updated every frame. Maybe the ray is not long enough and does therefore not hit anything in some cases.

Posted: Mon Apr 26, 2010 12:41 pm
by Eigen
The number in the top-left corner is the distance to hit point and is updated on each ray event. If that doesn't change there has been no hit. The ray is way longer than it needs to be. I tried different lengths as well.

It's not the level mesh either that causes it. It happens more or less in other levels as well.

I'm out of ideas.

edit: I printed out contact count returned from dCollide in CIrrOdeDevice::handleRayEvent and it prints 0 when it should say 1. So my guess is it's something internal of ODE ..

Posted: Tue Apr 27, 2010 5:30 am
by Brainsaw
I got no new idea either. Maybe you could send me your project so I could take a look into it.

Btw: I don't use the ODE ray much, just in the demo application. For my "Stunt Marble Racers" game I use some Irrlicht functions to control the camera.

Posted: Wed Apr 28, 2010 5:44 am
by Brainsaw
Added a new feature: it is now possible to mark a body as "fast moving". If this is done a ray will be cast from the old position to the new position after each step to detect missing collisions with other bodies. This is a nice feature, but it does have some drawback:
- only body-body collisions are detected
- only linear movement is compensated. Fast rotating bodies can still pass each other
- the collision between two fast moving bodies will not be detected (unless the do a "real ODE collision")

You can use the tank in the IrrOdeCar (yes ... the name ... still wrong ;) ) demo to see the effect. The bullets are now *way* faster than before and they still hit the targets. However, if you shoot at one of the lower targets to the right you will be able to see the second drawback. But it's definetly way better than before :D

Posted: Mon May 03, 2010 5:53 am
by Brainsaw
Hello,

I uploaded a little update yesterday. The IrrodeCar demo does now include a working airplane. It's been there for some time, but now it's activated. The see which controls to use go to the "help" screen with the "F1" key. It's far from being realistic, but it's fun nevertheless (I think it does rather behave like a RC plane than a big one ;) ).

Furthermore: all vehicles except for the cars do now have weapons. The tank had it from the beginning, but now the helicopter can launch missiles and the plane can drop bombs. Imho it's real fun.

Next step will be to extract the methods for the plane and the missiles from the demo and integrate them directly into the IrrOde lib.

Another thing I noticed: the projectiles are removed from the simulation after they collide with somthing (or after a certain amount of time - whatever comes first). First I tried to do that in the IrrOdeEventBodyMoved event, but as this event is posted during ODE's stepping function it just gave me an error and exited the program. Now I mark the projectiles that are to be removed and remove them later in the IrrOdeEventStep event which is posted right after the step is done.

Happy downloading.

Posted: Mon May 03, 2010 6:55 am
by netpipe
you should put this into a repository rather than us downloading it every time.

Posted: Mon May 10, 2010 5:53 am
by Brainsaw
And another little update: Moved the functionality of the airplane from the IrrOdeCar demo to the IrrOde lib. Created 3 new motors:

- CIrrOdeAeroDrag
- CIrrOdeImpulseMotor
- CIrrOdeTorqueMotor

all these new motors are subclasses of the new interface IIrrOdeStepMotor. These are additions to ODE, these motors add a force or impulse before every single ODE step. They are directly attached to bodies, not to joints like the normal ODE motor/servo.

I am also working on another tutorial where I explain everything about the IrrOdeCar demo (modelling the vehicles and coding it), but it's far from being finished so you better ignore it ;)

@tecan: I've been thinking about starting a sourceforge project for quite a while, but I currently don't have the time to check that. Maybe I'll do that in the future as I am aware that this could help a lot, especially because of the history feature.

Posted: Tue May 11, 2010 5:48 pm
by Zurzaza
Sorry...i'm a little late for vc2005 version of your libs...
Download from previous link -> http://stefano.pierotofy.it/libirrode_vs2005.zip

Posted: Wed May 12, 2010 5:40 am
by Brainsaw
No problem ... I'm currently adding some new features (did you try the airplane in the IrrOdeCar demo?). I'll add your lib as soon as I find time to.

Posted: Sat May 15, 2010 9:19 am
by Brainsaw
With the new version the handling of fast moving object collisions is improved. Collision is now not only detected between bodies, but also between bodies and static meshes.

I also added a road to the IrrOdeCar demo that connects the airfield, the car jump and the tank's shooting ground.

Posted: Sun May 16, 2010 10:25 am
by Darkcoder
Sorry for the amazingly long delay in replying, I haven't really touched the physics code that much until yesterday; I finally got around to writing code to switch between levels and noticed the old collision geometry remained.

As a little test, I tried removing the physics node as soon as it's created, but it didn't seem to do anything, again, this is through lua so excuse the syntax:

Code: Select all

blockNode:setParent( phyWorld )
blockColNode = scene:addSceneNode( "CIrrOdeGeomTrimesh", blockNode )
blockColNode:initPhysics()
blockColNode:removeFromPhysics() -- This doesn't do anything?
So is this me being stupid again? Or has this been fixed in the latest update? (I have the same build as of a month ago or so).

Posted: Sun May 16, 2010 6:31 pm
by Brainsaw
Hmm ... a geom or body should be removed this way. The current version doesn't remove a geom automatically if it is attached to a body, but the rest should work.

In my project (Stunt Marble Racers) I always use "CIrrOdeManager::closeODE" to clear all collision data when a new level is loaded, this works fine (at least in my project ;) )

Posted: Tue May 18, 2010 6:19 am
by Darkcoder
Brainsaw wrote:Hmm ... a geom or body should be removed this way. The current version doesn't remove a geom automatically if it is attached to a body, but the rest should work.

In my project (Stunt Marble Racers) I always use "CIrrOdeManager::closeODE" to clear all collision data when a new level is loaded, this works fine (at least in my project ;) )
I see, this solution will work fine for now, but certain game modes of mine will require specific static meshes to be removed and such, so is fixing this planned for the future? Ideally I want everything in my classes to be self contained(as it should be), so relying on some wipe-everything routine makes me feel a little uneasy already!

Posted: Tue May 18, 2010 8:05 am
by Brainsaw
I think I'll do some testing on this issue. It is possible to remove bodies (the Stunt Marble Racer's levels contain four marbles, if less player join a game all unnecessary marbles are removed), but I haven't yet tried it with static objects.