just what the question says…
how do i convert the line below to match th objects rotation… (or is there another way)?
public Vector3 direction = -Vector3.forward;
just what the question says…
how do i convert the line below to match th objects rotation… (or is there another way)?
public Vector3 direction = -Vector3.forward;
Vector3 rotation = transform.rotation // the rotation of an object
// if you need look at any object.
transform.LookAt(position);
// Direction of an object :
Vector3 direction = target.position - transform.position
Your code is (0,0,-1);
public Vector3 direction = transform.position - Vector3.forward; // your position - 1 on global Z direction
transform.forward; // The direction you are loocking
- transform.forward; // direction back you