IrrODE - an Irrlicht - ODE wrapper (now with SVN)
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?
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?
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.
Dustbin::Games on the web: https://www.dustbin-online.de/
Dustbin::Games on facebook: https://www.facebook.com/dustbingames/
Dustbin::Games on twitter: https://twitter.com/dustbingames
Dustbin::Games on facebook: https://www.facebook.com/dustbingames/
Dustbin::Games on twitter: https://twitter.com/dustbingames
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 ..
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 ..
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.
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.
Dustbin::Games on the web: https://www.dustbin-online.de/
Dustbin::Games on facebook: https://www.facebook.com/dustbingames/
Dustbin::Games on twitter: https://twitter.com/dustbingames
Dustbin::Games on facebook: https://www.facebook.com/dustbingames/
Dustbin::Games on twitter: https://twitter.com/dustbingames
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
- 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
Dustbin::Games on the web: https://www.dustbin-online.de/
Dustbin::Games on facebook: https://www.facebook.com/dustbingames/
Dustbin::Games on twitter: https://twitter.com/dustbingames
Dustbin::Games on facebook: https://www.facebook.com/dustbingames/
Dustbin::Games on twitter: https://twitter.com/dustbingames
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.
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.
Dustbin::Games on the web: https://www.dustbin-online.de/
Dustbin::Games on facebook: https://www.facebook.com/dustbingames/
Dustbin::Games on twitter: https://twitter.com/dustbingames
Dustbin::Games on facebook: https://www.facebook.com/dustbingames/
Dustbin::Games on twitter: https://twitter.com/dustbingames
you should put this into a repository rather than us downloading it every time.
Live long and phosphor!
-- https://github.com/netpipe/Luna Game Engine Status 95%
-- https://github.com/netpipe/Luna Game Engine Status 95%
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.
- 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.
Dustbin::Games on the web: https://www.dustbin-online.de/
Dustbin::Games on facebook: https://www.facebook.com/dustbingames/
Dustbin::Games on twitter: https://twitter.com/dustbingames
Dustbin::Games on facebook: https://www.facebook.com/dustbingames/
Dustbin::Games on twitter: https://twitter.com/dustbingames
Sorry...i'm a little late for vc2005 version of your libs...
Download from previous link -> http://stefano.pierotofy.it/libirrode_vs2005.zip
Download from previous link -> http://stefano.pierotofy.it/libirrode_vs2005.zip
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.
Dustbin::Games on the web: https://www.dustbin-online.de/
Dustbin::Games on facebook: https://www.facebook.com/dustbingames/
Dustbin::Games on twitter: https://twitter.com/dustbingames
Dustbin::Games on facebook: https://www.facebook.com/dustbingames/
Dustbin::Games on twitter: https://twitter.com/dustbingames
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.
I also added a road to the IrrOdeCar demo that connects the airfield, the car jump and the tank's shooting ground.
Dustbin::Games on the web: https://www.dustbin-online.de/
Dustbin::Games on facebook: https://www.facebook.com/dustbingames/
Dustbin::Games on twitter: https://twitter.com/dustbingames
Dustbin::Games on facebook: https://www.facebook.com/dustbingames/
Dustbin::Games on twitter: https://twitter.com/dustbingames
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:
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).
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?
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 )
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 )
Dustbin::Games on the web: https://www.dustbin-online.de/
Dustbin::Games on facebook: https://www.facebook.com/dustbingames/
Dustbin::Games on twitter: https://twitter.com/dustbingames
Dustbin::Games on facebook: https://www.facebook.com/dustbingames/
Dustbin::Games on twitter: https://twitter.com/dustbingames
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!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 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.
Dustbin::Games on the web: https://www.dustbin-online.de/
Dustbin::Games on facebook: https://www.facebook.com/dustbingames/
Dustbin::Games on twitter: https://twitter.com/dustbingames
Dustbin::Games on facebook: https://www.facebook.com/dustbingames/
Dustbin::Games on twitter: https://twitter.com/dustbingames