How to use MaximumLinearSpeedConstraint

Discuss any questions about BEPUphysics or problems encountered.
Post Reply
flyingbag
Posts: 2
Joined: Wed Oct 27, 2010 3:23 pm

How to use MaximumLinearSpeedConstraint

Post by flyingbag »

Hi,

Anyone knows how to use MaximumLinearSpeedConstraint to constraint linear speed limit to the entities in a simulation island? I'm using bepu in my own billiard game and occasionally a ball can go insanely fast.

This MaximumLinearSpeedConstraint is the only clue I've found so far but I found no example associated with it.

Appreciate it if anyone can help.

Thanks.
Gao Yang
Norbo
Site Admin
Posts: 4929
Joined: Tue Jul 04, 2006 4:45 am

Re: How to use MaximumLinearSpeedConstraint

Post by Norbo »

Here's an example:

Code: Select all

                    //Create the constraint and give it the affected entity and maximum speed.
                    var maximumSpeedConstraint = new MaximumLinearSpeedConstraint(entity, 10);
                    //Weaken the constraint a bit.  This is completely optional; it just shows one of the ways to further configure the constraint.
                    maximumSpeedConstraint.Softness *= 10;
                    //Add the constraint.
                    Space.Add(maximumSpeedConstraint);
However, if you are seeing invalid behavior, I would recommend tracking down the source of the invalid behavior first before patching it with maximum speed constraints.
Post Reply