Small update to 3d cheatsheat

Was looking for a way to calculate a position at a specific distance on a specific direction vector.


I just updated the cheat cheat with a new entry:

I have: direction,position and distance (v1,p1,dist)

I want: Position at Distance (p2)



scaledDir = v1.mult(dist)

p2 = p1.add(scaledDir)

Hopefully I didn’t mess up the transcribe’ (seems to work for me) (actually pspeed posted this on a forum thread ))


Looks ok, although you are modifying the original v1 but not original p1… Should really be consistent…and if different should be the other way around.