Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | RRocky123 |
I have a player (as a dog) and i want to give him a companion (or friend)for his mission and other stuff. I want this companion to follow this player.I made the companion follow the player.
get_node("Companion").dir = (get_node("player dog").position - get_node("Companion").position).normalized()
this is the var direction of my player’s companion
In my companion code i have the below code:
#########################
extends Node2D
var dir = Vector2()
var speed = 500
func _physics_process(delta):
var velocity = dirspeeddelta
translate(velocity)
##################
My companion is a node2D, now the problem the companion keeps on shaking when he reaches near the player(dog).
It moves back and forth fastly
plz help and ask if you want more details…