Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Bug / Crash  obi rope breaks after build.
#5
(27-09-2023, 03:42 PM)Alexander34 Wrote: **Preliminary**

The bug is due to RigidBody.velocity on players being changed from other scripts. Thus Obi rope could not affect RigidBody of players.

Hi,

Where do these scripts change the rigidbody velocity? Do they do it in FixedUpdate()?

(27-09-2023, 03:42 PM)Alexander34 Wrote: Now we need to figure out why this has no effect on ObiRope physics before the build, and why it does afterwards

I don't know why yet, but if you manually enable and disable ObiRope FixedUpdater it starts working correctly

This really sounds like your scripts are changing rigidbody velocities in FixedUpdate(), and Obi's FixedUpdater is also doing the same. As I mentioned in the previous post the order in which Unity calls MonoBehavior events for different scripts is undefined by default (essentially random), so either the rope will overwrite the velocities set by your script or the other way around. Depending on things like editor/build, or which component/object gets activated last, the order will change.

To check if this is the case, subscribe to ObiSolver.OnEndStep and place a Debug.Log there, then place a Debug.Log in your script's FixedUpdate. The order in which these are written to the console will probably change between the build and the editor.

Assuming this is the problem, there's many solutions to it. Simplest is to set your script execution order explicitly. Another one would be to subscribe to one of the solver's callbacks and change the rigidbody velocities there, so that the order is consistent.

kind regards,
Reply


Messages In This Thread
obi rope breaks after build. - by Alexander34 - 27-09-2023, 09:22 AM
RE: obi rope breaks after build. - by josemendez - 27-09-2023, 02:01 PM
RE: obi rope breaks after build. - by Alexander34 - 27-09-2023, 02:26 PM
RE: obi rope breaks after build. - by Alexander34 - 27-09-2023, 03:42 PM
RE: obi rope breaks after build. - by josemendez - 27-09-2023, 05:56 PM
RE: obi rope breaks after build. - by Alexander34 - 28-09-2023, 11:09 AM