B buhu New member Feb 25, 2021 #1 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?
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?
Andrew Well-known member Feb 26, 2021 #2 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);
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);