A 3D path resource. Aims to be as similar to the built-in path resource as possible, except in 3D.
The result of this YouTube video: https://www.youtube.com/watch?v=Gfm1zTIp8BU
Forum topic: https://forum.yoyogames.com/index.php?threads/making-a-3d-path-system.85967/
//Create a new 3D path like this:
path = new path3D();
//Add points to the path like this:
path.addPoint(x, y, z);
//Read from the path like this:
var pos = path.getPos(pathPos); //where pathPos should be between 0 (start of the path) and 1 (end of the path)
x = pos.x;
y = pos.y;
z = pos.z;
//You can also give the path points custom properties like this:
var point = path.addPoint(x, y, z);
point.speed = 100;
//And interpolate between the custom properties like this:
var pos = path.getPos(pathPos);
var pathSpeed = pos.A.speed * pos.Aw + pos.B.speed * pos.Bw + pos.C.speed * pos.Cw;
End User Licence Agreement (EULA).
Added functions for analyzing the path at a given position. You can now get a path position the same way you did before: var pos = path.getPos(pathPos); But now you can get stuff like velocity (first derivative), acceleration (second derivative) and curvature by analyzing the returned position: var velocity = pos.getVelocity(); var acceleration = pos.getAcceleration(); var curvature = pos.getCurvature(); var curveRadius = pos.getCurveRadius();