Jump to content

How to prevent / stop world spatial from updating certain objects


photo

Recommended Posts

Hello,

I noticed that updating the world spatial takes a very long time (about 40 ms), and since it does this every frame, it sort of ruins my frame rate.

The reason that world spatial takes so long is because it performs over 10000 (ten-thousand) calls to WorldSpatial::getIntersection.

The high number of calls is related to the number of extra vehicles I have moving about in the world. With only 1 extra vehicle it only calls WorldSpatial::getIntersection a hundred times during an update. With 5 vehicles it's a 150, 10 vehicles sets it a 300, 20 vehicles at 900, you get the picture.

Is there anyway to tell unigine to completely ignore during a world spatial update. We complete control the vehicles in the software (from where there going to where they appear). We only need Unigine to draw the vehicles and let us do the rest.

The vehicles consists out of several nodes (body, interior, lights and wheels) and a physical trigger (box), that we use for colision detection.

I tried to set the spatial property (node->setSpatial) to 0, but that didn't do anything.

Any help would be appriaciated.

Kind regards,

Kai

P.s.: I'm using Unigine 2.3.

Link to comment

Hi, first of all, need to figure out what is calling getIntersection so often. I assume that it is physics (because you have bodies and physical trigger), is that so?

Check it, and if it's true, check that physics is in threaded mode (console command "physics_threaded = 2"). And maybe you can remove (disable) bodies and perform collision detection on your own by checking distances and manually calling getCollision /getIntersection (perhaps building your own spatial tree)

P.S. Also try to disable Node::setCollision flag

Link to comment

After a little experimenting I can conclude the following:

1) physics are running in threaded mode (we set it in the Unigine.cfg).

2) Playing around with the colision flags has no effect (I've tried setting the collider of all vehicles to 0, as well as the individual surfaces, to no effect).

3) Disabling the wheels (wheel->setEnabled(0)) of all vehicles reduces the number of getIntersections from 10000 to 4000 (about 60%), of course they won't get drawn this way either.

Maybe building my own spatial tree isn't such a strange idea.

For now, this part of the project has low priority (we simply disable other traffic). So unless someone has an easy to implement solution, this part will have to wait. At least I got some insight on what causes the biggest delays in our project.

Thank you for your help.

 

Link to comment
×
×
  • Create New...