18-03-2022, 08:21 AM
(This post was last modified: 18-03-2022, 08:30 AM by josemendez.)
Hi!
The contact list passed to OnCollision is the exact same one used internally by the engine to perform the actual simulation. What I mean by this is that if the particle exists in the scene and is colliding with stuff, then it must appear in the contact list. Internal collisions and collision callbacks aren't two separate systems.
How are you determining hand.SolverIndex? Is it _arm.elements[0].particle1? if so, note that this value is only available when the rope is already instantiated.
I assume you're doing something along the lines of hand.SolverIndex = _arm.elements[0].particle1 this at Start(), Awake(), OnEnable() or a similar event, so it may or may not return a correct value depending on the order in which game objects are instantiated, which as you know if undefined in Unity.
If my assumption is correct, you might want to wait for one frame after instantiating the rope to get the value of hand.SolverIndex.
The contact list passed to OnCollision is the exact same one used internally by the engine to perform the actual simulation. What I mean by this is that if the particle exists in the scene and is colliding with stuff, then it must appear in the contact list. Internal collisions and collision callbacks aren't two separate systems.
How are you determining hand.SolverIndex? Is it _arm.elements[0].particle1? if so, note that this value is only available when the rope is already instantiated.
I assume you're doing something along the lines of hand.SolverIndex = _arm.elements[0].particle1 this at Start(), Awake(), OnEnable() or a similar event, so it may or may not return a correct value depending on the order in which game objects are instantiated, which as you know if undefined in Unity.
If my assumption is correct, you might want to wait for one frame after instantiating the rope to get the value of hand.SolverIndex.