How can I get the position a little bit in front of an object?
positieVoor = transform.position + Vector3.forward;
How can I get the position a little bit in front of an object?
positieVoor = transform.position + Vector3.forward;
Try
positieVoor=transform.position+transform.forward
Thanks Jake! It work like a charm.
You can also create an empty gameobject and position it in front of the object and then just reference that empty gameobject
Vector3 target = transform.position + transform.forward * range;
Here’s the best and quickest way you can do this.
Vector3 FrontPos;
public float DistanceDetection;
void Update()
{
FrontPos = new Vector3(transform.position.x,transform.position.y,transform.position.z + DistanceDetection); // Change distance detection based on how far in front you want to detect.
}