fix grab offset

This commit is contained in:
ethan merchant 2024-12-07 18:45:34 -05:00
parent 148d2d3429
commit e42bafc962

View file

@ -31,7 +31,7 @@ public class Grab
{
held_by = hand;
grab_ref = this;
pos_offset = hand.palm.position - pose.position;
pos_offset = hand.palm.orientation.Inverse * (hand.palm.position - pose.position);
ori_offset = hand.palm.orientation.Inverse * pose.orientation;
return true;
}
@ -50,8 +50,8 @@ public class Grab
{
if (Held)
{
pose.position = held_by.palm.position - pos_offset;
pose.orientation = held_by.palm.orientation * ori_offset;
pose.position = held_by.palm.position - held_by.palm.orientation * pos_offset;
}
}
}