Page 1 of 1

How to use MaximumLinearSpeedConstraint

Posted: Sun May 27, 2012 11:22 am
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

Re: How to use MaximumLinearSpeedConstraint

Posted: Sun May 27, 2012 2:38 pm
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.