#Character 2d not moving in line

1 messages · Page 1 of 1 (latest)

coral quarry
#

func _ready() -> void:
if not is_multiplayer_authority():
$Camera2D.enabled = false

func get_input():
var input_direction = Input.get_vector("ui_left", "ui_right", "ui_up", "ui_down")
print(input_direction)
$Marker2D.rotation = rad_to_deg(input_direction.angle())

velocity = input_direction * speed

func _physics_process(delta):
if not is_multiplayer_authority():
return

get_input()
move_and_slide()

This is the input_vector when I press ui_right only and I don't understand how to debug this issue

(0.0, 0.0)
(0.0, 0.0)
(0.0, 0.0)
(0.999968, 0.007965)
(1.0, 0.0)
(0.999968, 0.007965)
(0.0, 0.0)
(0.0, 0.0)
(0.999968, 0.007965)

hollow ice
#

Did you try this on a simple scene? It should work, then you know it's a problem with your complex scene. So you make a backup then remove/add features in a binary search manner until you find the breaking feature.

coral quarry
#

There is literally nothing but the player in my scene

#

Not even a map

#

That is why I’m very confused

hollow ice
#

there's something screwy with your scene even if you don't realize it

#

I just pasted your script in, attached to CharacterBody2D with icon.jpg Sprite2D, remove the "Marker" line, set speed to 50, bam it works

#

(that's the zip)

#

(is it bad manners to send a zip? can it contain viruses? idk)

coral quarry
#

I'm using a multiplayer spawner and a multyplayer syncronizer

#

I also tested for keyboard releted issues