final stretch-cursor pattern revision
This commit is contained in:
parent
9af73e8312
commit
394ad51ae6
1 changed files with 5 additions and 8 deletions
|
@ -7,23 +7,20 @@ class StretchCursor : dof {
|
||||||
// data
|
// data
|
||||||
public Vec3 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);
|
Vec3 dir = vec / len;
|
||||||
Vec3 dir = pointer ? vec / len : to.orientation * Vec3.Forward;
|
|
||||||
|
|
||||||
|
float stretch = Math.Max(len - deadzone, 0f);
|
||||||
cursor = to.position + dir * stretch * strength;
|
cursor = to.position + dir * stretch * strength;
|
||||||
|
|
||||||
Mesh.Cube.Draw(Material.Default, Matrix.TS(cursor, 0.01f));
|
Mesh.Cube.Draw(Material.Default, Matrix.TS(cursor, 0.01f));
|
||||||
}
|
}
|
||||||
|
|
||||||
// design
|
// design
|
||||||
public bool pointer = false;
|
|
||||||
public float deadzone = 0.1f;
|
public float deadzone = 0.1f;
|
||||||
public float strength = 3f;
|
public float strength = 3f;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue