Answer the question
In order to leave comments, you need to log in
How to add 90 degrees in this case?
A character using NavMesh moves after another character. But he moves sideways. How can you add 90 degrees to this, in the form of an offset?
Video - https://youtu.be/-bNuhvaOWvM
Code -
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.AI;
public class Enemy : MonoBehaviour
{
[SerializeField] Transform Target;
[SerializeField] NavMeshAgent AI;
[SerializeField] Vector3 Offset;
Vector3 Direction;
void Start() {
AI.updateRotation = false;
AI.updateUpAxis = false;
}
void FixedUpdate()
{
Direction = AI.desiredVelocity;
transform.right = Direction + Offset; // Оффсет в виде 90 градусов по Y и другим осям не помогает
AI.SetDestination(Target.position);
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question