NXOgre with PLSM2

Grom

30-03-2007 20:00:17

I've been working on something really cool lately (not related to nx) and I realized I hadn't given any word about my PLSM2 with NXOgre progress. I have a manager system right now which works beautifully; it will generate a database of heightmap shapes (if necessary) and stream them from the disk as you move around the map. There is barely any change in frame-rate when moving from heightmap shape to heightmap shape. It also includes support for a debug mesh, a translucent contour of the landscape that sits a half-meter above the terrain.

The reason I haven't released it yet is that there are still a couple of issues that keep it from really being *complete*. The main problem is what happens when a shape slides off of the heightmap shapes surrounding the player. I have a basic system working where if you move the camera and a heightmap is pulled out from beneath an object that you've registered with the manager class, the object will be set at the height of the terrain beneath it and be put to sleep. The problem is when an object moving of its own accord rolls outside the region encompassed by the heightmaps. I don't want to have to personally track each object per-frame, but I'm getting the feeling I might have to (if it falls off the edge of the heightmap, and then you move forward and load a heightmap where it is, it will go flying violently off into the stratosphere).

kungfoomasta

30-03-2007 21:24:35

Every dynamic (moving of its own accord) entity will have to have a heightmap underneath it. So you essentially make your player into an NPC class, and have a lot of NPCs running around. NPC may not be the best description..

KungFooMasta

Dibalo

30-03-2007 21:30:30

Way to go m8! Keep up good going! :D

And your problem: hmmm... it´s quite annoying.. Has NxOgre some callback when the body is moved? If so, you could set a callback: when the character moves, it fires the callback which calculate if the character is inside the "collision area". If not, you have to do something to it. You´d have to update only moving characters, not all per frame. Is this silly solution? :?

betajaen

30-03-2007 21:41:41

I suppose you could keep the heighfields "on" (but don't render) for any bodies active in the non-centered heightfields. At least then you won't have to keep a track of everything. Then put the bodies to sleep/serialise to disk when they do, and turn of the heightfield.

I would assume triggers, or intersections would do the trick.

Perhaps when you release it to the world, I could implement mesh paging and some of the other advanced features of terrain that comes with PhysX.

Dibalo

30-03-2007 21:47:15

I suppose you could keep the heighfields "on" (but don't render) for any bodies active in the non-centered heightfields. At least then you won't have to keep a track of everything.
But doesn´t that cosume too much memory? How about if heightmap is around 2kx2k? That´s a huge amount of physics data.... :o

CaseyB

30-03-2007 21:55:13

I would assume triggers, or intersections would do the trick.That sounds feasible! Maybe you could put them to sleep just before they exit the "Known World"

mikeInside

30-03-2007 21:57:18

Way to go m8! Keep up good going!

ditto to that :)

betajaen

30-03-2007 22:47:34

I would assume triggers, or intersections would do the trick.That sounds feasible! Maybe you could put them to sleep just before they exit the "Known World"

I don't think they would go to sleep if whilst moving (someone could prove it right now if they wanted), but I can't see many NxActor's falling asleep in mid air. But they would sleep once they settle.

However, making the bodies going to sleep much quicker could be achieved by increasing the damping. Of course this can be easily achieved by a trigger. Once the number of bodies asleep equal the amount of bodies in the trigger, then the heightmap can be turned off.

However; to turn them into a coma - turn them into kinematic bodies. They won't fall downwards when the heightmap disappears from underneath them ;)

Grom

31-03-2007 07:32:33

Every dynamic (moving of its own accord) entity will have to have a heightmap underneath it. So you essentially make your player into an NPC class, and have a lot of NPCs running around.

The camera is centered on a "tile" (not necessarily equivalent to a PLSM2 tile, really a physx heightmap), and there are 8 "tiles" surrounding it. I considered having any active shape also be in possession of 9 tiles, but it seems like it would cause a huge slowdown when there are numerous active objects in the world. Better to just shut things down when they are out of range of the player.

I would assume triggers, or intersections would do the trick.

I (shame-facedly) haven't looked into triggers too much. Could I have a trigger that comes to life as soon as an object is a certain distance from the camera? I kind of thought triggers were only based on possible collisions.

Dibalo

11-04-2007 14:30:12

Is there any change to get some code already? It doesn´t matter if it is still in progress... ;)

Lexx

13-04-2007 15:49:27

any news?

daedar

19-05-2007 13:35:34

still nothing? :cry: