I think my issue is similar to: Orient object's rotation to a spline point tangent in THREE.JS but I can't access the jsfiddle's properly and I struggled with the second part of the explanation.
Basically, I have created this jsfiddle: http://jsfiddle.net/jayfield1979/qGPTT/2/ which demonstrates a simple cube following the path created by a spline using SplineCurve3
. Use standard TrackBall mouse interaction to navigate.
Positioning the cube along the path is simple. However I have two questions.
First, I am using the spline.getTanget( t )
where t
is the position along the path in order to have the cube rotate (Y axis as UP only). I think I am missing something because even if I extract the .y
property of the resulting tangent provided, the rotations still seem off. Is there some nomalizing that needs doing?
Second, the speed is very varied along the path, obviously a lot more points stacked in creating the tighter curves, but I was wondering is there a way to refactor the path to more evenly distribute the spaces between points? I came across the reparametrizeByArcLength
function but struggled to find an explanation how to use it.
Any help or explanation for a bit of a maths dummy, would be gratefully received.