Overloads
static Rotation LookAt (Vector3 forward, Vector3 up)

Parameters

NameTypeDescription
forward Vector3
up Vector3

Returns

TypeDescription
Rotation
Declared in Rotation ยท Assembly Sandbox.System
trophy 90
Jul 2024 16 posts
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 );
	}
}
trophy 590
May 2021 24 posts
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.