pattern revision

This commit is contained in:
spatialfree 2022-10-03 16:43:44 -04:00
parent 95e7b714c5
commit a8459bd428
3 changed files with 14 additions and 10 deletions

View file

@ -5,23 +5,25 @@ class StretchCursor : dof {
public Pose to, from; public Pose to, from;
// data // data
public Pose cursor; public Vec3 cursor;
public void Init() {} public void Init() {
cursor = to.position;
}
public void Frame() { public void Frame() {
Vec3 vec = to.position - from.position; Vec3 vec = to.position - from.position;
float len = vec.Length; float len = vec.Length;
float stretch = Math.Max(len - deadzone, 0f); float stretch = Math.Max(len - deadzone, 0f);
Vec3 dir = backhand ? vec / len : to.orientation * Vec3.Forward; Vec3 dir = pointer ? vec / len : to.orientation * Vec3.Forward;
cursor.position = to.position + dir * stretch * strength; // * Mono.inst.stretchStr; cursor = to.position + dir * stretch * strength;
Mesh.Cube.Draw(Material.Default, Matrix.TS(cursor.position, 0.01f)); Mesh.Cube.Draw(Material.Default, Matrix.TS(cursor, 0.01f));
} }
// design // design
public bool backhand = true; public bool pointer = false;
public float deadzone = 0.1f; public float deadzone = 0.1f;
public float strength = 3f; public float strength = 3f;
} }

View file

@ -6,13 +6,13 @@ data
cursor cursor
init init
cursor = to.pos # fade in if needed
frame frame
vec = to.pos - from.pos vec = to.pos - from.pos
len = vec.len len = vec.length
stretch = max(len - deadzone, 0) stretch = max(len - deadzone, 0)
dir = pointer ? to.ori * v3.fwd : vec / len dir = pointer ? to.ori * v3.fwd : vec / len
cursor = to.pos + dir * stretch * strength cursor = to.pos + dir * stretch * strength

View file

@ -86,6 +86,8 @@ class WaveCursor : dof {
// new Color(1, 1, 1), 0.004f // new Color(1, 1, 1), 0.004f
// ); // );
// show that you are about to boolean in and out
oldLocalPad = localPad; oldLocalPad = localPad;