New: Nitro Boost our Discord server and receive full donation perks here on the website! Join the Scripting Helpers Discord Server to learn more! You can also Support on Patreon as always.

Still have questions? Join our Discord server and get real time help.

Log in to vote

0
Alright, so I want to move a part from Point A (Player's Head) to Point B (a new vector 3 val).

I don't know if it's because it's really late, but I can't really get my head around an equation that could achieve this. I know how to find the difference between each value, but that doesn't actually help me (afaik).

```lua startingPosition = dummy.Head.Position --I'm using a dummy rig as a test model

endingPosition = Vector3.new(-8, 7, -55) --My desired position from the head position

distance = endingPosition - startingPosition

--NewPosition = ?

```

And before you say, "Oh just change the position to the desired end point" , that's not actually what you're doing here, since the heads position changes as the character walks around, you can't just have the same desired position.

One of the cubes on the left can be viewed as the point B (endPosition) and the head can be viewed as point A (startingPosition)

Sorry if the explanation isn't clear, I'm tired af. Thanks in advance.

0

What do you mean by "origin"? Do you want to use raycasting? DeceptiveCaster 2794 — 1y

0

@RobloxWhizYT Nah I just meant "Starting place" as origin. Sorry for the confusion! I think this is really down to just getting a bit better at matrix math equations/cframe math. Psudar 853 — 1y

Log in to vote

0
For anyone wondering about how to base a part off of another parts origin, its super simple.

Heres one method I learned:

Part.CFrame = CFrame.new(Part.CFrame * Vector3.new(0, 0, 0)

When you do this, you're taking the Parts position vector and adding the product of the vector3 values times the Up, Back, and Right vectors.

It sounds confusing but you can visualize it like this:

RelativePos = CFrame.Position + CFrame.RightVector*X + CFrame.UpVector * Y + CFrame.BackVector*Z

0

Also sorry, I was looking through old posts and noticed that I never wrote my own solution. Maybe if someone sees this one day, it'll help them out as well. Cheers. Psudar 853 — 10mo