zadvorsky / three.bas

THREE.JS Buffer Animation System

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Spline look-ahead rotation.

supermoos opened this issue · comments

Hi, I was wondering if the spline functions could be used to look 10 points (or something like this) ahead and use that to rotate the PrefabGeometry towards that point, so you could have things like rockets flying along splines, oriented to the direction of the spline.

Spline orientation is something I want to add some time soon.

For now, you should simply be able to sample the spline at a slightly higher progress (like progress + 0.01, depending on the length of the spline I guess), calculate the angle between the current and next point, and use that to rotate the vertex. I don't think I've tried doing this in GLSL yet, so I don't know which rotation method you'd want to use off the top of my head.