Forum Discussion

🚨 This forum is archived and read-only. To submit a forum post, please visit our new Developer Forum. 🚨
devgameft's avatar
devgameft
Honored Guest
8 years ago

Ovr controller weird rotation

Hello,

I am trying to create a shooting game for occulus gear vr.

My gun which will be controlled by gear vr controller has a script attached with the following code






Quaternion controllerRotation = OVRInput.GetLocalControllerRotation (OVRInput.GetActiveController ());
  





transform.rotation = Quaternion.Slerp(transform.rotation, rotation,

            m_Damping * (1 - Mathf.Exp(k_DampingCoef * Time.deltaTime)));
 

Hierarchy of the player and gun is like this

 

Now whenever Player transform rotation is set to 0,0,0.
player and gun looks like this.




But whenever I change the rotation of player to anything other than 0 the gun's rotation is something else.
For eg when players rotation is set to 0,90,0 , the view looks like this





I have different different missions in my game and in some missions I have to change the initial rotation. Whenever I change the rotation of player it becomes very hard for the user to bring the gun to the camera view.

How to set players initial gun (gear vr controller) rotation to 0,0,0 ?

Replies have been turned off for this discussion