18-03-2022, 02:40 PM
(This post was last modified: 18-03-2022, 02:42 PM by VirtualCucumber.)
(18-03-2022, 08:21 AM)josemendez Wrote: 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.
Ah, interesting. Ok, I will give this a try when I am free and come back when I am done testing.
My only concern with this solution is that if the hand.SolverIndex was wrong then I would not be able to add force using Solver.externalForces[SolverIndex] in Hand.cs which works as seen in both gifs.
Another point and this is the main one, is that if I remove the conditionals in OnCollision just so its catching any particle -> collider collisions and log the event, it will never log any event even though that particle is actively colliding. Every other particle will log an event but not that one. No collision event gets fired at all but it still collides accurately with the cube collider.