PhysicsSimulator.Add() vs PhysicsSimulator.BodyList.Add() method (FPE 2.1.3)

Topics: Developer Forum, User Forum
Oct 21, 2010 at 4:54 PM

Hi all,

I was wondering what is the difference between PhysicsSimulator.Add() and PhysicsSimulator.BodyList.Add()?

I am asking this question because I need to access a geometry which has been added to the simulator using the PhysicsSimulator.Add() from another class.  I can't access the added geometries when using the PhysicsSimulator.Add() method.

On the other hand when I attempted to add Body/Geom using BodyList.Add() and GeomList.Add() the simulator didn't pick up the collision between the geometries.

 

Therefore whats the difference between them?

How can I access the added bodies/geom using the PhysicsSimulator.Add() method?

How to detect collisions when using the BodyList.Add() and GeomList.Add() method?

 

All input accepted

Thanks

 

Coordinator
Oct 21, 2010 at 5:00 PM

BodyList.Add() access the list of bodies directly and PhysicsSimulator.Add() does some checks and prerequisites for the collisions to work. If you need access to the geometries after using PhysicsSimulator.Add(), try calling PhysicsSimulator.Update() with a timestep of 0. I even think I put in a PhysicsSimulator.ProcessAddedGeometries() or something like that to take care of the limitation.

Oct 23, 2010 at 8:15 AM

Thanks for the reply so far.

 

However I need to acces the geometries  within the simulator so that if two particular bodies collide with each other, the game would play a sound effect.  Any recomendations on how to implement it ?