Small update to 3d cheatsheat

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

fyi:

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)



Formula:

v1.normalzeLocal()

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 ))



Cheers

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.