I have this formula:
CenterPartWithArrows.CFrame = CFrame.new((part.ExtentsCFrame * CFrame.new(offsetPosition)).Position)
It works perfectly. However I need it to be in this form:
offsetPosition = ...
How do I isolate offsetPosition
? Thanks!
happya_x
(Happya)
January 8, 2025, 10:24pm
#2
making a new cframe of the existing cframe’s position is redundant
you can just do
CenterPartWithArrows.CFrame = (part.ExtentsCFrame * CFrame.new(offsetPosition)).Position
you can move part.ExtentsCFrame to the other side by multiplying by the inverse of the cframe
CenterPartWithArrows.CFrame * part.ExtentsCFrame:Inverse() = CFrame.new(offsetPosition)
Scottifly
(Scottifly)
January 8, 2025, 10:41pm
#3
Do you mean you want to set offsetPosition
before that formula?
It looks like offsetPosition
would be a Vector3 value and needs to be set that way.
the reason I’m doing that is so that the rotation is 0.
offsetPosition
would be a vector3, correct.
Not quite:
I have an offset position saved
then I do the formula to the part
then the part goes through other processes
now that the offset position has been adjusted, I wanna re-save it.
Thanks!
Scottifly
(Scottifly)
January 8, 2025, 10:50pm
#6
At the beginning save the value of offsetPosition as a different variable (let’s call it offsetPositionNew).
offsetPositionNew = offsetPosition
-- code and calculations and processes on offsetPositionNew
offsetPosition = offsetPositionNew
then you can go back to the original variable for your next code.
the offset position gets adjusted… I would like it to be this simple though
happya_x
(Happya)
January 8, 2025, 10:57pm
#8
.Position already gets rid of the rotation
True, but a CFrame can’t be set to a Vector3…
Yeah didn’t think so :p
azqjanna
(azqjanna)
January 9, 2025, 1:12am
#10
Translating this slightly and removing “.CFrame”
CenterPartWithArrows = ZeroRotation(partExtents * offsetPositionCFrame)
Clearly removing the rotation is not reversible, so you cannot rewrite this equation the way you’ve requested. Can you draw a diagram of what CFrame you’re trying to create?
1 Like
stef0206
(Stef)
January 9, 2025, 1:18am
#11
What your problem really boils down to is you having a start and end position, and you wanting to know the offset between them in object-space.
This can be done with relative ease, and without the need of algebra. Simply use the VectorToObjectSpace
method of CFrames.
local offsetPosition = part.ExtentsCFrame:VectorToObjectSpace(CenterPartWithArrows.Position - part.ExtentsCFrame.Position)
Yep, this works :D
Thanks!
30 сhаrасtеrs
system
(system)
Closed
January 23, 2025, 2:23pm
#13
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.