pattern revision
This commit is contained in:
parent
95e7b714c5
commit
a8459bd428
3 changed files with 14 additions and 10 deletions
|
@ -5,23 +5,25 @@ class StretchCursor : dof {
|
|||
public Pose to, from;
|
||||
|
||||
// data
|
||||
public Pose cursor;
|
||||
public Vec3 cursor;
|
||||
|
||||
public void Init() {}
|
||||
public void Init() {
|
||||
cursor = to.position;
|
||||
}
|
||||
|
||||
public void Frame() {
|
||||
Vec3 vec = to.position - from.position;
|
||||
float len = vec.Length;
|
||||
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
|
||||
public bool backhand = true;
|
||||
public bool pointer = false;
|
||||
public float deadzone = 0.1f;
|
||||
public float strength = 3f;
|
||||
}
|
||||
|
|
|
@ -6,13 +6,13 @@ data
|
|||
cursor
|
||||
|
||||
init
|
||||
cursor = to.pos
|
||||
# fade in if needed
|
||||
|
||||
frame
|
||||
vec = to.pos - from.pos
|
||||
len = vec.len
|
||||
vec = to.pos - from.pos
|
||||
len = vec.length
|
||||
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
|
||||
|
||||
|
|
|
@ -86,6 +86,8 @@ class WaveCursor : dof {
|
|||
// new Color(1, 1, 1), 0.004f
|
||||
// );
|
||||
|
||||
// show that you are about to boolean in and out
|
||||
|
||||
|
||||
|
||||
oldLocalPad = localPad;
|
||||
|
|
Loading…
Add table
Reference in a new issue