Skip to content

Instantly share code, notes, and snippets.

Johnathon Selstad jselstad

  • Leap Motion
  • San Francisco
Block or report user

Report or block jselstad

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@jselstad
jselstad / VelocityBezier.cs
Created Jun 7, 2018
Kinematic Interpretation of a Cubic Bezier Curve - For Unity
View VelocityBezier.cs
// This function evaluates points along a bezier curve given by a starting position and velocity, and an ending position and velocity
// This can be thought of as interpolating between two linear trajectories
public static Vector3 cubicBezier(Vector3 aStart, Vector3 aVel, Vector3 bEnd, Vector3 bVel, float duration, float time) {
float alpha = time / duration; //Normalize the time
Vector3 aEnd = aStart + (aVel * duration); //Where it would end up if it were just A's dynamics
Vector3 bStart = bEnd - (bVel * duration); //Where it would start if it were just B's dynamics
return
(Mathf.Pow(1 - alpha, 3f) * aStart) +
(3f * Mathf.Pow(1 - alpha, 2f) * alpha * aEnd) +
You can’t perform that action at this time.