You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While updating an old project that is a 2d top-down view from Godot 3.3.4 to the latest 3.x version, which is currently 3.5.3, I encountered a change in physics behaviour. In the previous version (3.3.4), I had two kinematic bodies - one moved by an animation player, and the second moved by player input using the _physics_process and the move_and_slide method.
In Godot 3.3.4, when these two objects collided, they exhibited some friction, but the object moved by player input continued in the same direction. However, in Godot 3.5.3, when a collision occurs, movement stops from player input. 👇
I updated the movement script so it calculates the up_direction manually since the default value Vector2(0, 0) was not working as supposed it fixed the issue of snapping but the movement is completely different and seems off
this is my code to move the player:
func _physics_process(delta):
if is_movable():
movement_direction_vector = controller.output
check_if_reached_destination()
var speed_boost = 1.0 + (player.speed_boost/100.0)
var velocity = movement_direction_vector * MOVEMENT_SPEED * speed_boost
move_and_slide(velocity, up_direction)
to calculate up direction:
func _physics_process(delta):
if is_movable():
movement_direction_vector = controller.output
check_if_reached_destination()
var speed_boost = 1.0 + (player.speed_boost/100.0)
var velocity = movement_direction_vector * MOVEMENT_SPEED * speed_boost
var last_collision = get_last_slide_collision()
if last_collision:
$CollisionMarker.global_position = last_collision.position
var up_direction_vector = last_collision.position.direction_to(global_position)
if abs(up_direction_vector.x) < 0.3:
up_direction_vector.x = 0
else:
up_direction_vector.x = 1 * sign(up_direction_vector.x)
if abs(up_direction_vector.y) < 0.3:
up_direction_vector.y = 0
else:
up_direction_vector.y = 1 * sign(up_direction_vector.y)
up_direction = Vector2(up_direction_vector.x, 0).normalized() + Vector2(0, up_direction_vector.y).normalized()
up_direction = up_direction * UP_DIRECTION_MULTIPLIER
print(up_direction)
if debug_text:
get_node(debug_text).set_text(str(up_direction))
move_and_slide(velocity, up_direction)
Steps to Reproduce:
Create a project in Godot 3.5.3.
Set up two kinematic bodies, one animated and one controlled by player input.
Allow them to collide.
Expected Behavior:
In collisions, the object moved by player input should continue in the same direction with some friction, similar to Godot 3.3.4 behaviour.
Actual Behavior:
In Godot 3.5.3, when collisions occur, the object moved by player input comes to a complete stop.
Steps to reproduce
Create a project in Godot 3.5.3.
Set up two kinematic bodies, one animated and one controlled by player input.
Allow them to collide.
Minimal reproduction project
Check code from description
The text was updated successfully, but these errors were encountered:
Godot version
3.5.3.stable.official [6c81413]
System information
Windows 10 - Godot v3.5.3.stable.official
Issue description
Description:
While updating an old project that is a 2d top-down view from Godot 3.3.4 to the latest 3.x version, which is currently 3.5.3, I encountered a change in physics behaviour. In the previous version (3.3.4), I had two kinematic bodies - one moved by an animation player, and the second moved by player input using the
_physics_process
and themove_and_slide
method.In Godot 3.3.4, when these two objects collided, they exhibited some friction, but the object moved by player input continued in the same direction. However, in Godot 3.5.3, when a collision occurs, movement stops from player input. 👇
I updated the movement script so it calculates the
up_direction
manually since the default valueVector2(0, 0)
was not working as supposed it fixed the issue of snapping but the movement is completely different and seems offthis is my code to move the player:
to calculate up direction:
Steps to Reproduce:
Create a project in Godot 3.5.3.
Set up two kinematic bodies, one animated and one controlled by player input.
Allow them to collide.
Expected Behavior:
In collisions, the object moved by player input should continue in the same direction with some friction, similar to Godot 3.3.4 behaviour.
Actual Behavior:
In Godot 3.5.3, when collisions occur, the object moved by player input comes to a complete stop.
Steps to reproduce
Create a project in Godot 3.5.3.
Set up two kinematic bodies, one animated and one controlled by player input.
Allow them to collide.
Minimal reproduction project
Check code from description
The text was updated successfully, but these errors were encountered: