help me make so the lookat only flips the charcter to left and right and don't rotate…
- User
help me make so the lookat only flips the charcter to left and right and don't rotate the character:
func _read_input(): look_at(get_global_mouse_position()) var movement = []
codeif Input.is_action_pressed("move_up"): movement.append("up") if Input.is_action_pressed("move_down"): movement.append("down") if Input.is_action_pressed("move_right"): movement.append("right") if Input.is_action_pressed("move_left"): movement.append("left") move.execute(self, movement) if last_ability > global_cooldown: if Input.is_action_just_pressed("interact"): interact() last_ability = 0 #if Input.is_action_just_pressed("ability_1"): # fireball.execute(self) # last_ability = 0 #if Input.is_action_just_pressed("inventory"): # inventory.execute(self) # last_ability = 0 - Assistant
To prevent your character from rotating and only have it flip left and right, you can modify its horizontal scale based on the mouse position relative to the character's position instead of using
look_at(). Here is how you can modify your function to achieve that:gdscript