diff --git a/app/dofs/stretch-cursor/og/StretchCursor.cs b/app/dofs/stretch-cursor/og/StretchCursor.cs index 436db2f..78ca36b 100644 --- a/app/dofs/stretch-cursor/og/StretchCursor.cs +++ b/app/dofs/stretch-cursor/og/StretchCursor.cs @@ -2,20 +2,19 @@ namespace Oriels; class StretchCursor : dof { // input - public Pose to, from; + public Vec3 vTo, vFrom; - // data + // data public Vec3 cursor; public void Init() {} public void Frame() { - Vec3 vec = to.position - from.position; - float len = vec.Length; - Vec3 dir = vec / len; + float mag = (vTo - vFrom).Magnitude; + float stretch = Math.Max(mag - deadzone, 0f); - float stretch = Math.Max(len - deadzone, 0f); - cursor = to.position + dir * stretch * strength; + Vec3 dir = PullRequest.Direction(vTo, vFrom); + cursor = vTo + dir * stretch * strength; Mesh.Cube.Draw(Material.Default, Matrix.TS(cursor, 0.01f)); } diff --git a/app/dofs/stretch-cursor/og/⧉ b/app/dofs/stretch-cursor/og/⧉ index 70a4f50..d52d6e1 100644 --- a/app/dofs/stretch-cursor/og/⧉ +++ b/app/dofs/stretch-cursor/og/⧉ @@ -1,17 +1,17 @@ input - tipTo = [pos, ori] - tipFrom = [pos, ori] + vTo + vFrom data - cursor = [0, 0, 0] + stretch + cursor frame - vector = tipTo.pos - tipFrom.pos - length = vec.length - dir = vector / length + mag = (vTo - vFrom).mag + stretch = max(mag - deadzone, 0) - stretch = max(length - deadzone, 0) - cursor = to.pos + dir * stretch * strength + dir = dir(vTo, vFrom) + cursor = vTo + dir * stretch * strength design deadzone = 0.1