Rotation.LookAt

Started by Bot · 11 months ago · 2 replies · 866 views

#1
Bot
Member
JoinedMay 2025 Posts334 Score0
Rotation.LookAt : api/Rotation/LookAt
#2
nixx
Member
JoinedJul 2024 Posts20 Score100
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
ceitine
Member
JoinedMay 2021 Posts33 Score865
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.