V2 Simulation lists

Discuss any questions about BEPUphysics or problems encountered.
Post Reply
Darkon76
Posts: 5
Joined: Mon Mar 27, 2017 12:33 pm

V2 Simulation lists

Post by Darkon76 » Fri Apr 27, 2018 6:15 pm

Hi
Looking at the demos, the simulation has now different list.

Checking the block chain demo, it has two ways to make kinematic objects, one with like the top of the link with new BodyInertia(), and another for the ground creating a shape adding it to the shapes list then adding it to the static shapes.

Which is the difference?

What is the function of the shapes list?

Kind Regards.

Norbo
Site Admin
Posts: 4541
Joined: Tue Jul 04, 2006 4:45 am

Re: V2 Simulation lists

Post by Norbo » Sat Apr 28, 2018 3:51 am

Kinematic bodies (i.e. bodies with 0 inverse inertia) have velocity and are capable of velocity-based movement. Static objects, in contrast, have no velocity, cannot move at all (outside of direct user pose modification), and cannot be connected to by constraints.

In the block chain demo, the top box is made kinematic (new BodyInertia()) so that the next box can connect to it using a BallSocket constraint.

The kinematic-static split is mostly just an optimization. For example, contact constraints created between a dynamic body and a static use a dedicated codepath that avoids loading or storing velocity/inertia/projection data for the static. Given that the solver is pretty much always memory bandwidth bound in multithreaded simulation, this can be pretty valuable. There are some other little benefits, too.
What is the function of the shapes list?
In v1, you could create multiple Entity objects that shared the same underlying CollisionShape. That helped avoid pointless duplication sometimes.

In v2, the same idea applies- except now those individual shapes are stored within the Shapes set to get rid of individual GC-tracked allocations. Rather than calling new BoxShape(..) like in v1, you allocate space in the Shapes collection to store your shape.

(That same concept also applies for creating new bodies, statics, and constraints in v2. Objects cannot exist independently of a Simulation; all of them are instantiated by allocating a slot in the Simulation and providing a description.)

Darkon76
Posts: 5
Joined: Mon Mar 27, 2017 12:33 pm

Re: V2 Simulation lists

Post by Darkon76 » Thu May 03, 2018 4:38 pm

Thanks for the answer.

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest