- Home /
Question by
merrycousen · Apr 26, 2021 at 08:57 PM ·
how
Is there how to move a object backwards? C#
I want that my object follow the player but it's moving backward, is there how to fix it?
Code:
transform.LookAt(ThePlayer.transform);
if (Physics.Raycast(transform.position,transform.TransformDirection(Vector3.foward),out Shot))
{
TargetDistance = Shot.distance;
if(TargetDistance >= AllowedDistance)
{
followSpeed = 0.02f;
transform.position = Vector3.MoveTowards(transform.position, ThePlayer.transform.position, followSpeed);
}
else
{
followSpeed = 0;
}
}
}
Comment
Your answer
Follow this Question
Related Questions
Played time? 2 Answers
how do i look at my terrain when I go off it? 2 Answers
Custom Trees and Wind 1 Answer
How do I fix these lightmap spots? 0 Answers
Physics.CheckBox() Alternatives 0 Answers