- Home /
Using Quaternion.Slerp with VR motion controllers?,Using Slerp with VR Hands?
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);
}
Comment