magnum opus stretch-cursor
This commit is contained in:
parent
ec595d9e20
commit
df2b8da7ab
2 changed files with 14 additions and 15 deletions
|
@ -2,7 +2,7 @@ namespace Oriels;
|
|||
|
||||
class StretchCursor : dof {
|
||||
// input
|
||||
public Pose to, from;
|
||||
public Vec3 vTo, vFrom;
|
||||
|
||||
// data
|
||||
public Vec3 cursor;
|
||||
|
@ -10,12 +10,11 @@ class StretchCursor : dof {
|
|||
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));
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Reference in a new issue