Rotation.LookAt

Started by Bot ยท one year ago ยท 2 replies ยท 892 views

Bot
Member
JoinedMay 2025 Posts350 Score0
Rotation.LookAt : api/Rotation/LookAt
nixx
Member
JoinedJul 2024 Posts23 Score215
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 );
	}
}
ceitine
Member
JoinedMay 2021 Posts36 Score1,410
oooor you can use the static method meant for this! https://sbox.game/api/Rotation/FromToRotation
people
Log in to reply
You can't reply if you're not logged in. That would be crazy.