Overloads
static Rotation LookAt (Vector3 forward, Vector3 up)

Parameters

NameTypeDescription
forward Vector3
up Vector3

Returns

TypeDescription
Rotation
Declared in Rotation ยท Assembly Sandbox.System
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 );
	}
}
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.