I have a model, that randomly has a different origin orientation every time I add a new one with a script. How would I set the Origin Orientation to 0,0,0? There is not a Model:SetPrimaryPartOrientation(). How would I achieve this? I have tried many different ways.
I know you can set the origin position using PivotTo
I think it is possible to set the orintation but I am not sure.
Edit:
Pretty sure it’s this:
part:PivotTo(CFrame.Angles(0,0,0))— may be CFrame.New
Note:
Origin Orientation canNOT be changed by scripts
I tried that, but I don’t want the Model teleporting directly to the center of the part. I would just like to change the orientation, nothing else.
Read about CFrames:
https://developer.roblox.com/en-us/api-reference/datatype/CFrame
Then I think it’s this:
Model:PivotTo( CFrame.new(Model:GetPivot().Position) * CFrame.Angles(0,0,0) )
btw if you teleport a model to the center of the model, it doesnt go anywhere
I figured it out, found the distance between the mouse position and the target position, added a - symbol before the distances of X Y and Z and teleported the model there.
guard:PivotTo(target:GetPivot())-- don't think I need this.
local MoveByX = target.CFrame.X - hit.X
local MoveByY = target.CFrame.Y - hit.Y
local MoveByZ = target.CFrame.Z - hit.Z
guard:PivotTo(target:GetPivot() + Vector3.new(-MoveByX,-MoveByY,-MoveByZ))
I was going to send this, but the reply button disapeared yesterday.
I was using mouse.position and mouse.hit