From 394ad51ae68d470acd9e32bfabc51817c42dc651 Mon Sep 17 00:00:00 2001 From: spatialfree Date: Mon, 3 Oct 2022 17:28:37 -0400 Subject: [PATCH] final stretch-cursor pattern revision --- app/dofs/stretch-cursor/og/StretchCursor.cs | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/app/dofs/stretch-cursor/og/StretchCursor.cs b/app/dofs/stretch-cursor/og/StretchCursor.cs index 44f0c8e..436db2f 100644 --- a/app/dofs/stretch-cursor/og/StretchCursor.cs +++ b/app/dofs/stretch-cursor/og/StretchCursor.cs @@ -7,23 +7,20 @@ class StretchCursor : dof { // data public Vec3 cursor; - public void Init() { - cursor = to.position; - } + public void Init() {} public void Frame() { - Vec3 vec = to.position - from.position; - float len = vec.Length; - float stretch = Math.Max(len - deadzone, 0f); - Vec3 dir = pointer ? vec / len : to.orientation * Vec3.Forward; + Vec3 vec = to.position - from.position; + float len = vec.Length; + Vec3 dir = vec / len; + float stretch = Math.Max(len - deadzone, 0f); cursor = to.position + dir * stretch * strength; Mesh.Cube.Draw(Material.Default, Matrix.TS(cursor, 0.01f)); } // design - public bool pointer = false; public float deadzone = 0.1f; public float strength = 3f; }