Welcome to the Oculus Developer Forums!

Your participation on the forum is subject to the Oculus Code of Conduct.

In general, please be respectful and kind. If you violate the Oculus Code of Conduct, your access to the developer forums may be revoked at the discretion of Oculus staff.

CameraRig rotation and Vector3 math

PamelaFFSPamelaFFS Posts: 8 Oculus Start Member
First my disclaimer: I'm really bad at Vector3 math...

I want the player to be able to rotate their play area with the thumbstick. The issue is that my collision detection doesn't work correctly once the player area is rotated.

For example, if I rotate the cameraRig 180 degrees, I notice that the collision detection seems to think the player is in the opposite end of the play area (mirrored). Somehow I know I need to take the cameraRigs rotation into account, but as I said, I'm really bad at Vector3 math.
here is the code.

                    Vector3 p1 = cameraRig.transform.position + playerBodyCollider.center + Vector3.up * (-playerBodyCollider.height);
                    Vector3 p2 = p1 + Vector3.up * (playerBodyCollider.height);
                    colliders = Physics.OverlapCapsule (p1, p2, playerBodyCollider.radius, layerMask);

                    if (colliders.Length > 0) { // if true, player is colliding with wall
                        result = true;


  • PamelaFFSPamelaFFS Posts: 8 Oculus Start Member
    edited May 2019
    Looks like I found the issue...not sure why I didn't see it before...I just needed to remove the cameraRig from the equation
Sign In or Register to comment.