#projectile visual doesn't match its position

20 messages Β· Page 1 of 1 (latest)

warped rune
#

above the player is a label that shows its position every frame, i print out in the console position of the projectile, the number matches but visually the projectile is way off

func _on_shooting() -> void:
    print("shoot")
    var new_projectile = preload("res://scenes/fire_projectile.tscn").instantiate()
    new_projectile.global_position = global_position
    add_child(new_projectile)
    print(new_projectile.position)
runic shadow
warped rune
#

it now teleports the player, and projectile positon say its 0.0 πŸ˜…

runic shadow
#

but where do you want it to spawn πŸ€”
new_projectile.global_position = global_position here you set it to the players position

warped rune
#

thats where it should be, it should start from the player and then move towards to mouse cursor position where it first clicked

#

non of that is made yet for now iam unable to get the projectile on player

runic shadow
#

new_projectile.position this is the local coordinate tho relative to the player so 0,0 should be correct

warped rune
#

its like doing player.position = new_projectile.position

runic shadow
#

your projectile collides with the player and calls this

warped rune
#

oh

#

thats left over from gamejam when it was used as turret projectile πŸ˜…

runic shadow
#

well you could make a cool teleport mechanic witht that like a minecraft ender pearl or smth πŸ˜‚

warped rune
#

deleting that signal does now work

#

now sure why it was teleporting still tho O.o

#

nvm i got it

#

thanks as always πŸ˜