Is it possible to only move the model pivot’s position using a script, but not the whole CFrame including rotation?
I won’t use Model:MoveTo(), since I need pivots.
Is it possible to only move the model pivot’s position using a script, but not the whole CFrame including rotation?
I won’t use Model:MoveTo(), since I need pivots.
Yes, it’s possible to move the pivot point of a model without changing its orientation or position in the game world. Here’s an example script that demonstrates how to do this:
local model = -- your model here
local pivotOffset = Vector3.new(0, 0, 5) -- the offset to move the pivot by
-- calculate the new pivot position
local pivotPosition = model:GetPivot() + pivotOffset
-- calculate the transformation required to move the pivot
local pivotTransform = CFrame.new(-pivotPosition) * CFrame.new(model:GetPivot())
-- apply the transformation to the model
model:SetPrimaryPartCFrame(pivotTransform * model:GetPrimaryPartCFrame())
This script retrieves the current pivot position of the model using the GetPivot()
method, calculates the new pivot position by adding an offset vector to the current position, calculates the transformation required to move the pivot using two CFrame
objects, and then applies the transformation to the model’s primary part using the SetPrimaryPartCFrame()
method.
Note that this script assumes that the model’s primary part is the part that should be moved along with the pivot. If you want to move a different part of the model along with the pivot, you’ll need to modify the script accordingly.
Found the solution
local NewCFrame = CFrame.new(30,30,30)
Model:PivotTo(NewCFrame * Model:GetPivot().Rotation)
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.