From e42bafc9629d001dbecc8403227cc8d2353ea09c Mon Sep 17 00:00:00 2001 From: spatialfree Date: Sat, 7 Dec 2024 18:45:34 -0500 Subject: [PATCH] fix grab offset --- src/Data.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Data.cs b/src/Data.cs index f0e57b5..0700e15 100644 --- a/src/Data.cs +++ b/src/Data.cs @@ -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; } } } \ No newline at end of file