How would I go about getting the right side of the humanoidrootpart of my dummy? So, for example: The dummy is rotated 45 degrees. How would I generate a part that’s exactly 2 studs to his right?
Visual of what I want to do:
How would I go about getting the right side of the humanoidrootpart of my dummy? So, for example: The dummy is rotated 45 degrees. How would I generate a part that’s exactly 2 studs to his right?
Visual of what I want to do:
Set the part’s CFrame
to the dummy’s PrimaryPart
CFrame
, then add the RightVector
.
part.CFrame = dummy.PrimaryPart.CFrame + dummy.PrimaryPart.CFrame.RightVector*2
Oh wow! Very helpful, didn’t know that property existed!
Also, a follow up question. So, when I multiply the right vector by 2, I don’t actually move it 2 studs, do I?
I don’t really understand your question, could you clarify what you mean ?
So, if I use the math you said above: dummy.PrimaryPart.CFrame.RightVector*2, the printed result will be something about 1.28557527, 0, -1.53208888 in my case. So, when I add that to the dummy’s position, am I moving it exactly 2 studs to it’s right?
That is probably some floating point errors, but I tested that before posting and it works on my machine.
Oh, I finally see! So, please fail-check me. The right vector variable has a value of one stud to the dummy’s right?
Yes, that is correct, a unit vector (vector with magnitude of 1)
Sorry for the magnitude of questions, but, what EXACTLY is a magnitude in math/coding. I want to have an exact definition since I don’t want to guess.
Magnitude is essentially the length of the vector, a unit vector works since it is essentially a vector divided by its own magnitude, similar to how a number divided by itself is 1
Oh, okay. I see, thank you very much!