change position when space is freezed

Discuss any questions about BEPUphysics or problems encountered.
Post Reply
Nablabla
Posts: 14
Joined: Wed Mar 18, 2015 12:36 am

change position when space is freezed

Post by Nablabla »

Dear Norbo, author of so many good answers (thanks!!)

In my world it is possible to change thing's position (and orientation) while the world is in an inert state, i.e.
I do not call the Space.Update() method but I want to move around objects by setting Entity.Position = ... .

If I just do so, collision detection does not work (or will not recognise the changes).

I figured to overcome this problem, I have to call the following methods between tha last positional change and a consecutive collision query:
Space.BoundingBoxUpdater.Update();
Space.BroadPhase.Update();

Is that right and is it sufficient?

Best regards,
Your ▼
Nablabla
Posts: 14
Joined: Wed Mar 18, 2015 12:36 am

Re: change position when space is freezed

Post by Nablabla »

ah, and what do I need to do to use the Debug Drawer?
Norbo
Site Admin
Posts: 4929
Joined: Tue Jul 04, 2006 4:45 am

Re: change position when space is freezed

Post by Norbo »

Code: Select all

Space.BoundingBoxUpdater.Update();
Space.BroadPhase.Update();
That will be sufficient to get the broadphase back into a consistent state. If you want updated contact information, call Space.NarrowPhase.Update() after the broadphase update.
ah, and what do I need to do to use the Debug Drawer?
At the moment it uses XNA, so you'll need that or you'll need to replace the dependencies with monogame. Other than that, just create an InstancedModelDrawer, add stuff to it, and call its update and draw.

(The upcoming demos rewrite will drop XNA in favor Vulkan and dx12 backends targeting ~FL11 hardware.)
Nablabla
Posts: 14
Joined: Wed Mar 18, 2015 12:36 am

Re: change position when space is freezed

Post by Nablabla »

very neat, I might want to use contact information, thank you.

Forget the part with the debug drawer, I already use InstancedModelDrawer thanks. (the problem I had with objects not showing off when not updating was caused by myself, i add them in the update for whatever reason)
Norbo wrote:Vulkan and dx12 backends targeting ~FL11 hardware
what is that, can I still use the debug drawer with xna or mono then?
Norbo
Site Admin
Posts: 4929
Joined: Tue Jul 04, 2006 4:45 am

Re: change position when space is freezed

Post by Norbo »

what is that,

Vulkan and DX12 are modern low level graphics APIs. XNA uses DX9, which is relatively ancient.

FL11 is feature level 11, the set of hardware abilities required by DirectX 11. It's supported by virtually any semi-modern desktop hardware, though it's rarer in mobile.
can I still use the debug drawer with xna or mono then?
Ideally, yes. Since the engine itself isn't tied to a particular graphics api, people aren't expected to match the graphics apis of the BEPUphysicsDemos. I'm not yet entirely sure how I'm going to handle that interop, but in the worst case, I can always fall back to copying down to the CPU and reuploading every frame. It won't be nearly as fast or as easy as just using the exact same API device, but it should work.
Nablabla
Posts: 14
Joined: Wed Mar 18, 2015 12:36 am

Re: change position when space is freezed

Post by Nablabla »

or can I just use the old BEPUphysicsDrawer project and a new version of BEPUphysics and BEPUutilities?
Norbo
Site Admin
Posts: 4929
Joined: Tue Jul 04, 2006 4:45 am

Re: change position when space is freezed

Post by Norbo »

That's possible, yes, though it will require some modification. The new versions of BEPUphysics/BEPUutilities will contain pretty huge changes.
Post Reply