Jump to content

engine.world.updateSpatial


photo

Recommended Posts

Posted
Hello,

 

 

Updates the BSP tree. This function is automatically called each frame. This function is called manually if a new object was added through the script and it needs to participate in spatial intersection during one and the same frame. Or if you have moved the node, and then want to get callbacks on basis of changed position in the same frame.

You may want to call updateSpatial() before:

You can call updateSpatial() several times during one frame, but do not use it once too many times.It is more rational to change position of all required nodes first and only after that call updateSpatial().

 

Hello,

 

I'd like to confirm my understanding of this passage. Does this mean that if I move an object via say:

 

object.setVelocityTransform()

 

And in the same frame, call

 

engine.world.updateSpatial()

 

I will be able to receive the collision callback within the same frame?

Allowing me to respond to a collision before a render.

 

 

 

 

Thanks,

Michael

Posted

No, as physics is simulated later on, after update() and flush() functions of the script. Collision callbacks are always fired after the simulation is over: before the next flush() if there is one more physics iteration; or before the next world script update().

×
×
  • Create New...