-
Notifications
You must be signed in to change notification settings - Fork 31
Open
Description
Description
When calling the MoveAndCollide function for the kinematicBody2D the game crashes right after launch with no error, the code snippet below works fine with the line commented out. I can just set the position but collisions will not be calculated then.
// X_Process is called every frame
func (r *Robot) X_Process(delta gd.Real) {
velocity := gd.NewVector2(0, 0)
if godot.Input.IsActionPressed("ui_right") {
velocity.SetX(velocity.GetX() + 1)
}
if godot.Input.IsActionPressed("ui_left") {
velocity.SetX(velocity.GetX() - 1)
}
if godot.Input.IsActionPressed("ui_down") {
velocity.SetY(velocity.GetY() + 1)
}
if godot.Input.IsActionPressed("ui_up") {
velocity.SetY(velocity.GetY() - 1)
}
if velocity.Length() > 0 {
normal := velocity.Normalized()
velocity = normal.OperatorMultiplyScalar(speed)
}
r.MoveAndCollide(velocity.OperatorMultiplyScalar(delta))
}
Details
Go version | 1.16.2 |
Godot version | 3.2.3 |
Godot-Go version/commit hash | Current |
OS | Arch Linux 5.11.6 |
Metadata
Metadata
Assignees
Labels
No labels