ExtendRealityLtd / Tilia.Interactions.Interactables.Unity

A variety of mechanisms for interacting between interactors and interactables in a spatial scene for the Unity software
MIT License
9 stars 3 forks source link

Alternative ways to set up orientation handles for multiple interactors #131

Closed fight4dream closed 2 years ago

fight4dream commented 2 years ago

Is your feature request related to a problem?

The current way is through the GameObjectRelations component. Basically it is like a GameObject rule that map from interactor’s game object to the orientation handle. But it is not flexible when dealing with interactable objects (prefabs) that is instantiated or when the interactors are not initially in the same scene.

Describe the solution you'd like

We shall be able to use rules such as AnyTagRule or AnyTypeRule to identify the mapping. That will work for instanced objects as well as interactors.

thestonefox commented 2 years ago

can you raise this as a bug with steps to reproduce as it seems there is an issue where you cannot do this if the objects aren't already in the scene

fight4dream commented 2 years ago

https://github.com/ExtendRealityLtd/Tilia.Interactions.Interactables.Unity/tree/master/Documentation/HowToGuides/SettingTheOrientationOfAnInteractableWhenGrabbed

follow the guide up to step 7 where we are asked to drag in the corresponding Interactors. but if the sword is made into a prefab waiting to be instantiated. there is no Interactors that can readily be dragged. the interactors are needed to be found in runtime

thestonefox commented 2 years ago

So this is possible to do with the Rules Matcher, but having a base generic way of it working may be a bit tricky.

I'm not sure if its best to provide a rules matcher way in the prefab with an option to toggle it, or provide a guide on how to set it up

rough guide is:

image

image

image

The Matched() events for each rule element then sets the TargetOffsets element to the manually provided orientation handle.

image

to the newly created Rules Matcher Match method:

image

This will then call the rules matcher on setup follow, which will in turn match the correct controller based on a rule and therefore set the correct orientation handle at runtime.

thestonefox commented 2 years ago

I've added a feature to this PR:

https://github.com/ExtendRealityLtd/Tilia.Interactions.Interactables.Unity/pull/132

ExtendReality-Bot commented 2 years ago

:tada: This issue has been resolved in version 2.7.0 :tada:

The release is available on:

Your semantic-release bot :package::rocket: