- Home /
Question by
Leniaal · Jun 15, 2013 at 04:24 PM ·
cameralerptransform.positionrecoil
lerping transform.position on a camera
Hello,
I'm working on recoil for my gun, the gun is already recoiling. But now I want my camera to lerp back to the position where the gun was when it started shooting. I got this method(for now).
public void RecoilCorrection(float recX, float recY){
transform.rotation = Quaternion.Lerp(transform.rotation,
new Quaternion(transform.rotation.x + recX, transform.rotation.y - recY, transform.rotation.z, transform.rotation.w),
0.15f);
}
It gets called here:
void Update()
{
Camera.mainCamera.GetComponent<MouseLook>().RecoilCorrection(recoiledX, recoiledY);
}
on my recoil script.
I'm probably understanding things wrong, or I'm missing something, but the Quaternion.Lerp does absolutely nothing even though the recX- and Y change on every shot.
Does anybody have any clue what I'm doing wrong?
Thanks in advance
Comment
Your answer
Follow this Question
Related Questions
Smooth Transform with Lerp? 1 Answer
How to move camera from point A to B 1 Answer
How to make camera position relative to a specific target. 1 Answer
Camera Lerp Jitter 0 Answers
3D menu camera rotation issue. 0 Answers