sholder sheathe system
This commit is contained in:
parent
7f466ffe4b
commit
35425b7a16
1 changed files with 21 additions and 0 deletions
21
src/Rig.cs
21
src/Rig.cs
|
@ -97,6 +97,27 @@ static class Rig
|
|||
if (ax > ay && ax > az) new_dir = new(Maths.sign(fullstick.x), 0, 0);
|
||||
if (ay > ax && ay > az) new_dir = new(0, Maths.sign(fullstick.y), 0);
|
||||
if (az > ax && az > ay) new_dir = new(0, 0, Maths.sign(fullstick.z));
|
||||
|
||||
// sheathe grabs
|
||||
// shoulders
|
||||
// put hand in head space
|
||||
// if behind head then handedness = left or right sheathe
|
||||
// else check for left or right of head to grab at left or right sheathe
|
||||
for (int i = 0; i < (int)Handed.Max; i++)
|
||||
{
|
||||
if (!holding[i])
|
||||
{
|
||||
Vec3 local_pos = head.orientation.Inverse * (pose_hld[i].position - head.position);
|
||||
Handed side = local_pos.x < 0 ? Handed.Left : Handed.Right;
|
||||
if (upper_sheathes[(int)side])
|
||||
{
|
||||
if (btn_grip[i].delta == +1)
|
||||
{
|
||||
upper_sheathes[(int)side] = false;
|
||||
holding[i] = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue