Fix grab with scaled pickables by swapping inverse for affine_inverse#707
Conversation
BastiaanOlij
left a comment
There was a problem hiding this comment.
This is good, we should merge this. If there is a chance to revert the changes on pickable_demo.tscn as they are not part of the fix, that would be great.
This reverts commit 1d026b5.
Hi @BastiaanOlij , sorry for the delay in circling back to this. I've reverted the demo changes so the PR could merge as is and it will fix scaling issues when directly grabbing an XRToolsPickable . Two things tho
2a. I see some non-ranged grabs executing as ranged grabs (it looks like So what do you think @BastiaanOlij a. Get this pr in as is ? |
|
Thanks @davehakim , I'm happy to merge this as is and see further improvements in coming PRs. |
Jolt physics appears to support the scaling of physics bodies in response to the scaling of an ancestor node. This has great potential for tabletop XR games where one might want the pieces to be 'pickable' (a subclass of
RigidBody3D) while at the same time allowing dynamic scaling of the game board (and all the pieces on it!)The grab related classes however don't allow grabbing scaled
XRToolsPickables by default (well, at very least the grab position is off) because they useinversetransforms and notaffine_inversewhich respects node scaling. This PR changes all the relevantinversetransforms toaffine_inversewhich should fix that.To test:
Without the changes in this pr the cubes would not be pickable (they disappear or shrink in response to attempted pickups)
With the change they pick up fine (usually 🤷) at the correct grab position
Issues:
Note 1 : The changes to pickable_demo are only here to illustrate the issue and need to be cleaned up or out before this pr gets considered for merge.
Note 2 : I expect this addresses the cause of #613
To work around the 'unexpected scaling' glitch in my game I've just disabled ranged grabs (by always treating ranged grabs in the code the same as non ranged i.e. always doing this in the pickup function
but I figure before this pr becomes something more general purpose though the ranged grab issue(s) needs to be solved