CFrame.lookAt
Creates a CFrame at a position looking toward a target.
Syntax
CFrame.lookAt(from: any, to: any) -> CFrame
Parameters
| Parameter | Type | Description |
|---|---|---|
from | any | The from value used by the call. |
to | any | The to value used by the call. |
Returns
| Type | Description |
|---|---|
CFrame | The returned CFrame. |
Description
CFrame.lookAt is part of the Data types library. Vector and CFrame values are VM userdata with operator overloads; operations return new value objects.
The operation is performed immediately using the arguments supplied at the call site.
Example
local cf = CFrame.lookAt(Vector3.new(0, 5, 0), Vector3.new(10, 5, 0))
print(cf.LookVector)
Notes
- Vector and CFrame operations return new value objects.