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
Issue description:
Kinematic body slides off slopes that is supposed to snap to when landing.
Steps to reproduce:
use this script on a kinematic body 2d with any collider.
jump on a slope >=45 deg
extends KinematicBody2D
# Declare member variables here. Examples:
# var a = 2
# var b = "text"
export var gravity: = Vector2(0,4)
export var moving_vel: = Vector2(8,0)
export var jumping_vel: = -Vector2(0,50)
var _totalVel: Vector2
var _vel_remainder: Vector2 = Vector2.ZERO
# Called when the node enters the scene tree for the first time.
func _ready():
# jumping_vel-=gravity
print(jumping_vel)
pass # Replace with function body.
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _physics_process(delta):
var _snapVec = Vector2(0,64)
_totalVel.x = 0
if !is_on_floor():
_totalVel += gravity
else:
_totalVel.y = 0
_totalVel += jumping_vel * int(Input.is_action_just_pressed("ui_up"))
_snapVec -= int(Input.is_action_just_pressed("ui_up"))*_snapVec
_totalVel += moving_vel * (-int(Input.is_action_pressed("ui_left")) + int(Input.is_action_pressed("ui_right")))
if (_totalVel.y > 0):
print(_totalVel)
if(!is_on_floor()):
print(is_on_floor())
move_and_slide_with_snap(_totalVel*64,_snapVec,Vector2(0,-1),false,4,45.0)
Godot version:
3.1.1
OS/device including version:
Windows 10 x64
Issue description:
Kinematic body slides off slopes that is supposed to snap to when landing.
Steps to reproduce:
use this script on a kinematic body 2d with any collider.
jump on a slope >=45 deg
Minimal reproduction project:
KinematicBody2D_reprod.zip
This issue #26274 seems close to mine but the effects are different.
Please move if needed
The text was updated successfully, but these errors were encountered: