0 votes

Hey, I'm making a topdown shooter and i wanted to make the gun that rotates around the player flip when it's rotated to the left. I basically checked if its rotation was between PI/2 and -PI/2 but this doesn't work. It only flips when its on the topleft of the player.

here"s my code:

func _process(delta):
    flip_v = PI/2 > pivotrotation and pivotrotation < -PI/2
asked Apr 23 in Engine by rubendw03 (41 points)

1 Answer

+1 vote

What you're checking there is "less than PI/2" and "less than -PI/2", which is only going to be true for less than -PI/2. Try this:

flip_v = pivotrotation < PI/2 and pivotrotation > -PI/2
answered Apr 23 by kidscancode (17,762 points)

Thanks! Problem solved

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.