Hello! So im trying to make a rocket model pivot onto the pad. The problem is that when I pivot the rocket the model just rotates. Its only one line of code. Can Anyone help?
Before:
After:
My code is
game.Workspace.Test:PivotTo(game.Workspace.Plots.Pad1.RocketSpawn.CFrame)
1 Like
Mortai_Yt
(xM_MORT)
December 20, 2023, 9:53pm
#2
Because your part is oriented that way?
Yeah but how do I fix that though?
Mortai_Yt
(xM_MORT)
December 20, 2023, 9:56pm
#4
You just rotate it with the rotate tool.
No but im trying to pivot it through a script
Mortai_Yt
(xM_MORT)
December 20, 2023, 9:59pm
#6
Yeah, you are pivoting it to the partβs CFrame, which means position and rotation. So maybe try using position instead, with
game.Workspace.Test:PivotTo(CFrame.new(game.Workspace.Plots.Pad1.RocketSpawn.Position))
or if you want to use CFrame you rotate the part you are pivoting to.
Its working a bit but for some reason the rocket sinks into the ground. Here is a picture:
Change the primary part of the model so that when it is in the exact Cframe you want it is rotated correctly. You just do this by changing the CFrame of the primarypart in the model
Mortai_Yt
(xM_MORT)
December 20, 2023, 10:02pm
#9
let me write something rq I know why tho.
Mortai_Yt
(xM_MORT)
December 20, 2023, 10:03pm
#10
game.Workspace.Test:PivotTo(CFrame.new(game.Workspace.Plots.Pad1.RocketSpawn.Position + Vector3.new(0, game.Workspace.Test:GetBoundingBox().Y / 2, 0)))
Or change the PivotOffset.
Mortai_Yt
(xM_MORT)
December 20, 2023, 10:04pm
#12
In the explorer select the model and change the PivotOffset so that the blue dot is at the very bottom of the rocket.
You can change the primary part to fix that. I can show you an example if you want.
Mortai_Yt
(xM_MORT)
December 20, 2023, 10:04pm
#14
No you canβt, that only works with :SetPrimaryPartCFrame() mate
Yes it does, Using pivotto will work for setting the models Cframe if you have a pirmarypart that is moved
Mortai_Yt
(xM_MORT)
December 20, 2023, 10:05pm
#16
Yeah, but changing the primary part does nothing.
I am gonna make some videos or soemthing to show you that it does change it.
Mortai_Yt
(xM_MORT)
December 20, 2023, 10:06pm
#18
Bro changing the PivotOffset works.
Yes, but simply changing the position of the primary part would work too.
Mortai_Yt
(xM_MORT)
December 20, 2023, 10:07pm
#20
But PivotOffset works fine and is intended for :PivotTo(). He would need to create a new part for the PrimaryPart.