Why is my player launched into the air when the mob they are standing on turns around....

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By kavivi

I have a player and a mob node. When the player stands on the mob, if the mob’s pacing logic tells it to turn, the player is launched into the air as they turn. At first, I thought it was due to the player getting caught between collision shapes, but after changing the shape to be one shape, it still happened. When the mob turns, I am inverting the x scale to flip the hitboxes with the mob. Could this cause something to happen if the player is standing on top of the mob that causes it to be launched in the air?

Picture of Scenario Capture hosted at ImgBB — ImgBB

This is the player logic for gravity and a double jump action:

if is_on_floor():
	usedflap = false
	if Input.is_action_just_pressed("jump"):
		velocity.y = -JUMPFORCE
else: 
	if usedflap == false and Input.is_action_just_pressed("jump"):
		velocity.y = -JUMPFORCE
		usedflap = true
	velocity.y += GRAVITY

Which kind of node are the player and the mob? Also, the picture doesn’t work. You should post it on imgur and link it here.

SweetPie | 2022-10-21 03:27

Both nodes are KinematicBody2D nodes. Also Updated the picture link, thanks

kavivi | 2022-10-21 04:01

Could you also post all of the code involved with the player’s movement?

SweetPie | 2022-10-21 04:24

:bust_in_silhouette: Reply From: godot_dev_

If you are including collisionShapes used for body collisions (standing on player, standing on floor) that are used by the physics engine in the x.scale flip, that’s probably the cause. Try only including hitboxes/hurtboxes in the x.scale flip and not touching the scale of the body box collision shape