weaponMesh.transform.position = Vector3.Slerp(new Vector3(weaponMesh.transform.position.x, weaponMesh.transform.position.y, weaponMesh.transform.position.z),
new Vector3(weaponMesh.transform.position.x, weaponMesh.transform.position.y, (weaponMesh.transform.position.z - recoilAmount)), recoilSpeed * Time.deltaTime);
I am using Vector3.Slerp to be able to add a recoil effect.
The problem is that, when I call this. (It is located in UPDATE, if the player is shooting.) it keeps adding the recoil in world space only.
*The weaponMesh is a child of the mainCamera, so it shouldn’t add the recoil in world space. Maybe I am using incorrectly de function? thanks, in advance.