the title already explains my question.
is there a way to make the model look at something (not a character)
if there is please tell me
the title already explains my question.
is there a way to make the model look at something (not a character)
if there is please tell me
If you set a PrimaryPart for the Model you can use :SetPrimaryPartCFrame which will adjust all of the parts within the model to keep their relative offset from the PrimaryPart
Currently the CFrame.new
constructor has an overload that allows you to pass 2 Vector3
instances; one is the Origin
and the other is the Direction
(The LookVector
of the CFrame will face this)
This overload is starting to become deprecated though, and it is suggested you use CFrame.fromMatrix
.
(I personally am not good with Vector math and don’t really understand how this works, but its suggested you figure out for the future)
Here is an example:
Model:SetPrimaryPartCFrame(CFrame.new(Model.PrimaryPart.Position, NewDirection))
I think they rolled back the deprecation on that constructor, rightly I think.
They changed the wording on the docs for it (it used to just say “this is deprecated, use fromMatrix
”):
At high pitch angles (around 82 degrees), you may experience numerical instability. If this is an issue, or if you require a different up vector, it’s recommended you use
CFrame.fromMatrix
instead to more accurately construct the CFrame. Additionally, iflookAt
is directly abovepos
(pitch angle of 90 degrees) the up vector switches to the X-axis.
Wow, I didn’t realize they updated that. I’ve been using my own wrapper function to check if the up vector was close to being parallel to the look vector.