Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Strange CFrame positioning (moving relative)?

Asked by 7 years ago
Edited 7 years ago

Hi guys!

I'm having a really annoying problem with model CFrames and Vector3s!

Basically, I'm trying to move a part to -500 studs. This part is in a model:

Part.CFrame = (CFrame.new(Part.Position.X, -500, Part.Position.Z))

So, you'd think this would work but.... nope - it moves to -466 studs (because the part started at 34 studs. Any ideas how I can ignore making it relative so it goes to -500 studs regardless of the height it started at?

Secondly, I have a model which I want to move to -500 studs:

model:SetPrimaryPartCFrame(CFrame.new(model.PrimaryPart.Position.X, -500, model.PrimaryPart.Position.Z))

This works but the model seems shifted to the left and rotated wrong?

Any help would be appreciated as this should be really simple, but it doesn't seem to be!
Thanks!

0
I wouldn't think it would do that. Are you sure the problem is with that specific line of code? OldPalHappy 1477 — 7y
0
Yes, definitely - that's why I was confused! I've done a lot of work with CFrames and stuff before and this is just really odd! jjwood1600 215 — 7y
0
It works if I do Part.CFrame = (CFrame.new(Part.Position.X, -534, Part.Position.Z)) but I really don't want to have to do that because the height at the surface could change! And as for the model, I haven't found a fix yet :/ jjwood1600 215 — 7y
0
I just copied that first line of code into a script inside of an anchored part, not positioned at exactly 0 Y, and it always got positioned at -500 on the Y axis. OldPalHappy 1477 — 7y
View all comments (6 more)
0
Did the model start at 0 studs though? Hmmm, this is strange... jjwood1600 215 — 7y
0
What did you have the part position set to originally? jjwood1600 215 — 7y
0
It varied, and it didn't matter. I also tested this with primary parts of a model. OldPalHappy 1477 — 7y
0
I don't understand :/ What you described is exactly the setup I have jjwood1600 215 — 7y
0
The primary part is to the left side of a large model so that could be why but I'm not sure how to move the whole model down by 500 studs without using the primarypart! jjwood1600 215 — 7y
0
And as for the part it is definitely relative because it starts at 34 studs and moving it to -500 studs takes it to -466 :/ jjwood1600 215 — 7y

Answer this question