So for a simple little weapon viewmodel, i wrote this code to add offset to the rotation while still applying the slerp with the offset. I can do this with transform (not slerp however) fine but not rotation.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class followcam : MonoBehaviour
{
public Transform targetcamera;
public Vector3 offset;
public Quaternion rotationOffset;
public float rotationSpeed = 30f;
void Update()
{
transform.position = targetcamera.position + offset;
transform.rotation = Quaternion.Slerp(transform.rotation, targetcamera.rotation, rotationSpeed * Time.deltaTime);
// Trying to add RotationOffset to the new result
}
}
Viewing the embedded video, you can see that the Slerp is working properly, just that the rotation is messed up, i want the end of the slerp to reset to the position it was in before i started the game, so i added a public Quaternion rotationOffset
and now i’m just trying to figure out how to apply it to the model.
heftybiodegradableafricanelephant