How to take the opposite rotation of the camera in unity 5

3

I wonder how I can move an object in the opposite direction of the camera.

Example: When I move the camera to the right at any position (0,30,0), the object moves in the opposite direction (0, -30,0) to the left.

    
asked by anonymous 17.02.2016 / 01:44

2 answers

2

I got it like this:

void Update ()
{
    rot = Cardboard.SDK.HeadPose.Orientation;
    transform.localEulerAngles = (Vector3.down * rot.eulerAngles.y);
}

Rotating around the camera.

    
17.02.2016 / 18:57
0

You should first access the Camera. It has many forms, judging that you already know how to do this, you can do the following:

 transform.rotation = Quaternion.Inverse(ObjCamera.transform.rotation);

For more information on the Quaternion Class (Rotation): Quaternion

    
17.02.2016 / 12:23