Quantcast
Channel: Questions in topic: "gun"
Viewing all articles
Browse latest Browse all 592

Using Quaternion.Slerp with VR motion controllers?,Using Slerp with VR Hands?

$
0
0
I am trying to add a Slerp rotation to my gun when pressing the trigger button on my vr controller since animations do not work with a rigidbody. My goal is to add recoil. However, when I am slerping the rotation it cancels it out and moves to the actual rotation of my motion controllers. How do I properly use Slerp with constant rotational updates of the controller? private void Shoot() { // Effects fireSound.Play(); StartCoroutine(FlashPlay()); MuzzleFlash.Play(); Smoke.Play(); // Recoil /// GONNA FIX AND DO IT PROPERLY EVENTUALLY Quaternion identity = Quaternion.identity; Quaternion RecoilRotation = Quaternion.Euler(1.5f, transform.localRotation.y, transform.localRotation.z); RecoilRotation = (identity *= RecoilRotation); transform.localRotation = Quaternion.Slerp(transform.localRotation, RecoilRotation, 1); }

Viewing all articles
Browse latest Browse all 592

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>