Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help  Weird Solver Behaviour
#6
Hi there!

Answered to your email, and sent you a fixed version of your script. The issue is that you were not flagging the constraints dirty when adding or removing colliders. I'm pasting my answer here for reference too:

In the Rope.cs file, you're creating a rope and placing a couple pin constraints manually at its ends. You're passing the "from" and "to" colliders to it. When a pin constraint is created, the current indices of the colliders you pass to it are stored in the solver, since the solver deals with particle and collider indices. If colliders are later created or destroyed, these indices might change so you need to flag the constraints as dirty.

When using attachments this is handled automatically, but if you're managing pin constraints manually you must take care of flagging them dirty when necessary, so they're rebuilt. Check the manual's "Scripting constraints" page, specifically "Adding/Removing constraints":

http://obi.virtualmethodstudio.com/manua...aints.html

Quote:After you've added or removed particles/colliders, you will need to call actor.SetConstraintsDirty(). This rebuilds all solver batches of the given constraint type.

I've modified your Rope script to account for this.
Reply


Messages In This Thread
Weird Solver Behaviour - by Reydans - 15-12-2021, 01:33 PM
RE: Weird Solver Behaviour - by Reydans - 15-12-2021, 02:44 PM
RE: Weird Solver Behaviour - by josemendez - 15-12-2021, 03:00 PM
RE: Weird Solver Behaviour - by Reydans - 16-12-2021, 10:05 AM
RE: Weird Solver Behaviour - by josemendez - 16-12-2021, 10:50 AM
RE: Weird Solver Behaviour - by josemendez - 17-12-2021, 11:09 AM
RE: Weird Solver Behaviour - by Reydans - 20-12-2021, 09:25 AM