Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help  Grab Rope - VR
#17
Hey Jose, thanks for the help again. I'm at a bit of a loss now to be honest, I added the above code and it didn't seem to work, so I added some Debug messages into the grab function to show me where the script was having issues:

Code:
public void Grab()
    {
        var world = ObiColliderWorld.GetInstance();

        if (solver != null && collisionEvent != null)
        {
            Debug.Log("Collision");
            foreach (Oni.Contact contact in collisionEvent.contacts)
            {
                if (contact.distance < 0.01f && canGrab)
                {
                    var contactCollider = world.colliderHandles[contact.other].owner;
                    ObiSolver.ParticleInActor pa = solver.particleToActor[contact.particle];

                    Debug.Log(pa +" hit " + contactCollider);
                    if (contactCollider == obiCollider)
                    {
                        Debug.Log("Hand Collision");
                        var batch = new ObiPinConstraintsBatch();
                        int solverIndex = rope.solverIndices[contact.particle];
                        Vector3 positionWS = solver.transform.TransformPoint(solver.positions[solverIndex]); // particle position from solver to world space
                        Vector3 positionCS = obiCollider.transform.InverseTransformPoint(positionWS); // particle position from world to collider space
                        batch.AddConstraint(rope.solverIndices[contact.particle], obiCollider, positionCS, Quaternion.identity, 0, 0, float.PositiveInfinity);
                        newBatch = batch;
                        pinConstraints.AddBatch(newBatch);

                        canGrab = false;

                        // this will cause the solver to rebuild pin constraints at the beginning of the next frame:
                        rope.SetConstraintsDirty(Oni.ConstraintType.Pin);

                    }

                }
            }
        }
    }
Based on that feedback, it seems like there's no collisions being registered between my hand colliders and the rope, despite being able to visibly push the rope around. The only collision feeding from the solver seems to be between the rope and the grappling hook which also has an obi rigidbody for obvious reasons. The rope is set to phase 1, and I reset the hands and the hook to phase 0z so it doesn't appear to be a straightforward issue. I'll add screenshots of the hands, rope and solver inspectors, I hope you can see what's wrong. 

   
   
   
Reply


Messages In This Thread
Grab Rope - VR - by zig420 - 13-08-2020, 05:30 PM
RE: Grab Rope - VR - by Aento - 23-09-2020, 02:53 PM
RE: Grab Rope - VR - by josemendez - 23-09-2020, 02:54 PM
RE: Grab Rope - VR - by josemendez - 23-09-2020, 03:17 PM
RE: Grab Rope - VR - by zig420 - 02-12-2020, 04:08 AM
RE: Grab Rope - VR - by josemendez - 02-12-2020, 08:37 AM
RE: Grab Rope - VR - by zig420 - 02-12-2020, 09:55 PM
RE: Grab Rope - VR - by josemendez - 03-12-2020, 12:57 AM
RE: Grab Rope - VR - by zig420 - 14-12-2020, 04:24 PM
RE: Grab Rope - VR - by josemendez - 15-12-2020, 09:20 AM
RE: Grab Rope - VR - by Xanduffy - 22-01-2021, 08:32 PM
RE: Grab Rope - VR - by Aento - 24-09-2020, 12:47 PM
RE: Grab Rope - VR - by Xanduffy - 27-01-2021, 05:05 PM
RE: Grab Rope - VR - by josemendez - 27-01-2021, 09:03 PM
RE: Grab Rope - VR - by Xanduffy - 31-01-2021, 08:39 PM
RE: Grab Rope - VR - by josemendez - 01-02-2021, 07:38 AM
RE: Grab Rope - VR - by Xanduffy - 04-02-2021, 12:03 PM
RE: Grab Rope - VR - by josemendez - 04-02-2021, 12:09 PM
RE: Grab Rope - VR - by Xanduffy - 04-02-2021, 01:14 PM
RE: Grab Rope - VR - by josemendez - 04-02-2021, 01:52 PM
RE: Grab Rope - VR - by Xanduffy - 04-02-2021, 08:17 PM
RE: Grab Rope - VR - by josemendez - 05-02-2021, 09:43 AM
RE: Grab Rope - VR - by josemendez - 05-02-2021, 09:51 AM
RE: Grab Rope - VR - by Xanduffy - 05-02-2021, 07:25 PM
RE: Grab Rope - VR - by josemendez - 05-02-2021, 08:25 PM
RE: Grab Rope - VR - by Xanduffy - 05-02-2021, 10:10 PM
RE: Grab Rope - VR - by josemendez - 08-02-2021, 11:00 AM
RE: Grab Rope - VR - by Xanduffy - 09-02-2021, 05:17 PM
RE: Grab Rope - VR - by josemendez - 09-02-2021, 09:33 PM
RE: Grab Rope - VR - by Xanduffy - 09-02-2021, 09:04 PM
RE: Grab Rope - VR - by josemendez - 09-02-2021, 09:33 PM
RE: Grab Rope - VR - by Xanduffy - 09-02-2021, 11:10 PM
RE: Grab Rope - VR - by josemendez - 10-02-2021, 12:41 PM
RE: Grab Rope - VR - by Xanduffy - 10-02-2021, 06:29 PM
RE: Grab Rope - VR - by josemendez - 11-02-2021, 09:33 AM
RE: Grab Rope - VR - by tpaslou - 16-02-2021, 01:57 PM
RE: Grab Rope - VR - by josemendez - 16-02-2021, 02:02 PM
RE: Grab Rope - VR - by tpaslou - 16-02-2021, 02:36 PM
RE: Grab Rope - VR - by Xanduffy - 17-02-2021, 05:03 PM
RE: Grab Rope - VR - by polymod - 18-02-2021, 03:40 AM
RE: Grab Rope - VR - by mo1ok - 18-02-2021, 04:16 AM
RE: Grab Rope - VR - by Xanduffy - 19-02-2021, 09:35 PM
RE: Grab Rope - VR - by josemendez - 22-02-2021, 12:28 PM
RE: Grab Rope - VR - by tpaslou - 22-02-2021, 12:11 PM
RE: Grab Rope - VR - by josemendez - 22-02-2021, 12:21 PM
RE: Grab Rope - VR - by tpaslou - 23-02-2021, 12:42 PM
RE: Grab Rope - VR - by josemendez - 23-02-2021, 12:45 PM
RE: Grab Rope - VR - by tpaslou - 24-02-2021, 10:35 AM
RE: Grab Rope - VR - by josemendez - 24-02-2021, 10:39 AM
RE: Grab Rope - VR - by tpaslou - 24-02-2021, 10:56 AM
RE: Grab Rope - VR - by josemendez - 24-02-2021, 11:06 AM
RE: Grab Rope - VR - by josemendez - 24-02-2021, 11:17 AM
RE: Grab Rope - VR - by tpaslou - 24-02-2021, 11:58 AM
RE: Grab Rope - VR - by josemendez - 24-02-2021, 12:14 PM
RE: Grab Rope - VR - by tpaslou - 24-02-2021, 02:00 PM
RE: Grab Rope - VR - by Xanduffy - 04-03-2021, 12:50 AM
RE: Grab Rope - VR - by Xanduffy - 04-03-2021, 02:05 PM