Closed dsnopek closed 1 year ago
It's actually one part of a two-part problem which includes the initial snapped state on scene loading. The current approach is to position objects in the snap zones and hope they get proximity-snapped when the scene loads. That works for desktop, but it turns out running the demo scene above native on a quest doesn't correctly snap and the teacup falls on the table.
So the two parts to this are:
The OnDrop may be something we can do with the XRToolsFunctionPickup as it maintains a list of all pickable objects in range and the snap zones are pickable (so you can grab items from them).
Essentially when the XRToolsFunctionPickup drops an object it could search its list of pickup areas for anyone with an on_dropped_near method and let them grab it.
The OnDrop may be something we can do with the XRToolsFunctionPickup as it maintains a list of all pickable objects in range and the snap zones are pickable (so you can grab items from them).
Essentially when the XRToolsFunctionPickup drops an object it could search its list of pickup areas for anyone with an on_dropped_near method and let them grab it.
Aha! This sounds way better than any of the things I've been trying so far :-)
@Malcolmnixon couldn't that be solved by forcing a check in the snap zones _ready
function? I think areas should be immediately query-able to see which object are already within the area.
Another thought on detecting pickables dropped in snap zones is that the snap zones could subscribe to the pickables "dropped" signal when the pickable enters the snap zones area, and unsubscribes when it leaves.
Resolved by #319.
Currently, pickable objects can fall (or be thrown) into a snap zone, which isn't always desirable. It looks pretty funny with the teacups in the pickable demo:
It'd be great to have a mode for snap zones that required the object to be placed directly in the snap zone!
I've been struggling with how to implement this, though. My first idea was to have the snap zone connect to the "dropped" signal on any pickable objects that enter, but that clashes with the pickable objects clearing out their collision layers when being held (at least by default).
Any ideas?