Blockland Forums > Modification Help

Setting an object directly right of a player

Pages: << < (2/2)

Treynolds416:


--- Quote from: Space Guy on May 08, 2012, 03:55:38 PM ---Oh, I misunderstood the question. The cross product of two vectors is one perpendicular to both, so that of the forward vector and 0 0 1 would be to one side of the player - I don't know which side but should be the same right/left hand each time and easier than the trigonometry.

vectorCross("0 1 0","0 0 1") = "1 0 0" (+Y and +Z -> +X)
vectorCross("1 0 0","0 0 1") = "0 -1 0" (+X and +Z -> -Y)

vectorCross("0 0 1","0 1 0") = "-1 0 0" (if you wanted to generate the opposite hand direction, swap the arguments or scale the vector by -1)

--- End quote ---
I figured there was a better way. The if statements are easier to understand, though, which might benefit elm more.

elm:

Thanks spaceguy, i'll try that out later.

Slicks555:


--- Quote from: Treynolds416 on May 08, 2012, 03:31:10 PM ---
--- End quote ---

Did you actually write that code, or was that adapted from something?

If you wrote it, I have a new found respect for you. Hell if I understand trig of that level.

Treynolds416:


--- Quote from: Slicks555 on May 08, 2012, 08:01:46 PM ---Did you actually write that code, or was that adapted from something?

If you wrote it, I have a new found respect for you. Hell if I understand trig of that level.

--- End quote ---
I actually did write it <3
Logic/math is one of the few things I'm good at, and manipulating bricks through script is the second best.

Pages: << < (2/2)

Go to full version