Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help  Obi Rope Constraints not simulated Bug
#5
In case anyone reads this later on: this issue was caused by the project's character controller overwriting the character's velocity in its FixedUpdate():

Code:
character.rigidbody.velocity = inputVelocity;

Since the order in which Unity calls FixedUpdate() for different objects is by default undefined, in cases where Obi was updated first and the character controller last this would happen (pseudocode):

Code:
// Obi applies rope force to the character:
character.rigidbody.velocity += rope.force / character.mass;

// Character controller overwrites velocity, any changes made by other scripts prior to it are lost:
character.rigidbody.velocity = inputVelocity;

As a result any changes made by Obi -or potentially any other script- to character velocity would be overwritten by the character controller. Since update order is undefined this was difficult to reproduce in the project as it would sometimes work somewhat correctly (Obi would modify the velocity after the character controlling writing it) sometimes not.

The fix is to modify the character controller so that it doesn't ignore the character's current velocity.
Reply


Messages In This Thread
RE: Obi Rope Constraints not simulated Bug - by josemendez - 21-02-2022, 11:29 AM