Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | Brad4x |
I coded the recoil of the camera to rotate on the x axis but I’m running into an issue. After shooting for a short time the rotation of the clamp changes and I cannot look fully down and too far behind the player. I believe the recoil camera rotation is messing it up. Do you guys have any possible solution for something like this? Thanks in advance
func _input(event):
if event is InputEventMouseMotion:
rotate\_y(deg2rad(-event.relative.x \* mouse\_sens))
head.rotate\_x(deg2rad(-event.relative.y \* mouse\_sens))
head.rotation.x = clamp(head.rotation.x, deg2rad(-89), deg2rad(89))
func fire():
if Input.is_action_pressed(“fire”):
var recoil = camera.rotate\_object\_local(Vector3(1,0,0),0.005)
recoil = get\_global\_transform().basis.x
For future reference, this question was cross-posted on Reddit: Reddit - Dive into anything
Calinou | 2020-12-28 02:00