Skip to main content
edited body
Source Link
Evorlor
  • 5.9k
  • 9
  • 59
  • 101

addingAdding this Code worked for me.

private void Start()
{
    // Store the initial rotation
    initialRotation = transform.rotation;
    
    // Get the NavMeshAgent component
    navMeshAgent = GetComponent<NavMeshAgent>();
}

private void Update()
{
    if (navMeshAgent.velocity != Vector3.zero)
    {
        // Apply the initial rotation
        transform.rotation = initialRotation;
    }
}

adding this Code worked for me.

private void Start()
{
    // Store the initial rotation
    initialRotation = transform.rotation;
    
    // Get the NavMeshAgent component
    navMeshAgent = GetComponent<NavMeshAgent>();
}

private void Update()
{
    if (navMeshAgent.velocity != Vector3.zero)
    {
        // Apply the initial rotation
        transform.rotation = initialRotation;
    }
}

Adding this Code worked for me.

private void Start()
{
    // Store the initial rotation
    initialRotation = transform.rotation;
    
    // Get the NavMeshAgent component
    navMeshAgent = GetComponent<NavMeshAgent>();
}

private void Update()
{
    if (navMeshAgent.velocity != Vector3.zero)
    {
        // Apply the initial rotation
        transform.rotation = initialRotation;
    }
}
Source Link
ocb
  • 11
  • 1

adding this Code worked for me.

private void Start()
{
    // Store the initial rotation
    initialRotation = transform.rotation;
    
    // Get the NavMeshAgent component
    navMeshAgent = GetComponent<NavMeshAgent>();
}

private void Update()
{
    if (navMeshAgent.velocity != Vector3.zero)
    {
        // Apply the initial rotation
        transform.rotation = initialRotation;
    }
}