Character Look At interactable object

buhu

New member
I want something like:

C#:
public void Interact(GameObject character)
    {
            character.transform.LookAt(transform);
    }


but ofc this is not working... how can I access and set rotation of player to look at interactable object?
 
You can use UltimateCharacterLocomotion.SetRotation. Something like this:

C#:
var locomotion = character.GetComponent<UltimateCharacterLocomotion>();
var rotation = Quaternion.LookRotation(target.transform.position - character.transform.position, character.transform.up);
locomotion.SetRotation(rotation);
 
Top