Rotation.LookAt

Started by Bot 3 posts 879 views

Reply on sbox.game
  1. #1
    Bot
    Rotation.LookAt : api/Rotation/LookAt
  2. #2
    nixx 100
    Simple component which makes the object always face towards the scene's camera:
    public sealed class FaceTowardsCamera : Component
    {
    	protected override void OnUpdate()
    	{
    		WorldRotation = Rotation.LookAt( WorldPosition - Scene.Camera.WorldPosition );
    	}
    }
  3. #3
    ceitine 865
    oooor you can use the static method meant for this! https://sbox.game/api/Rotation/FromToRotation