Component:GrabbableReceiverSurface: Difference between revisions

From Resonite Wiki
m ProbablePrime moved page GrabbableReceiverSurface (Component) to Component:GrabbableReceiverSurface: Creating component Namespace
Fixed typo.
 
(One intermediate revision by one other user not shown)
Line 15: Line 15:
|OverrideParent|Slot| If not null, the slot that the [[Grabbable_(Component)|Grabbable]] object gets reparented to, if ParentPlaced is true.
|OverrideParent|Slot| If not null, the slot that the [[Grabbable_(Component)|Grabbable]] object gets reparented to, if ParentPlaced is true.
|TweenTime|Float| The amount of time in seconds for the animation effect when the object snaps to the surface.
|TweenTime|Float| The amount of time in seconds for the animation effect when the object snaps to the surface.
|MaxDistance|Float|  
|MaxDistance|Float|
|Offset|Float| The distance from the surface that the [[Grabbable_(Component)|Grabbable]] object will stop at.
|Offset|Float| The distance from the surface that the [[Grabbable_(Component)|Grabbable]] object will stop at.
|CheckOffset|Float|  
|CheckOffset|Float|
|Directions|Float3|List of directions a [[Grabbable_(Component)|Grabbable]] object can be received from.
|Directions|{{RootFieldType|SyncFieldList`1|[[Type:Float3|Float3]]}}|TypeAdv6=true|List of directions a [[Grabbable_(Component)|Grabbable]] object can be received from.
|TagFilter|TagFilter|
|TagFilter|{{RootFieldType|TagFilter}}|TypeAdv7=true|
}}
}}


Line 56: Line 56:
# After both distance checks a final distance value is provided.
# After both distance checks a final distance value is provided.
# The [[Grabbable_(Component)|Grabbable]] then selects the surface with the smallest distance and tells the Surface to receive it.
# The [[Grabbable_(Component)|Grabbable]] then selects the surface with the smallest distance and tells the Surface to receive it.
# The Surface will then position the [[Grabbable_(Component)|Grabbable]] upon the surface using an Animation if a <code>Tween Time</code> value is set.
# The Surface will then position the [[Grabbable_(Component)|Grabbable]] upon the surface using an Animation of a <code>Tween Time</code> value is set.
# The Surface will then parent the [[Grabbable_(Component)|Grabbable]] to itself or the <code>OverrideParent</code> location if the <code>ParentPlaced</code> checkbox is checked.
# The Surface will then parent the [[Grabbable_(Component)|Grabbable]] to itself or the <code>OverrideParent</code> location if the <code>ParentPlaced</code> checkbox is checked.


Line 76: Line 76:
* [[GrabbableParenter_(Component)|Grabbable Parenter]]
* [[GrabbableParenter_(Component)|Grabbable Parenter]]
</translate>
</translate>
[[Category:Components{{#translation:}}]]
[[Category:Components{{#translation:}}|Grabbable Receiver Surface]]
[[Category:Components:Transform:Interaction{{#translation:}}]]
[[Category:Components:Transform:Interaction{{#translation:}}|Grabbable Receiver Surface]]

Latest revision as of 03:07, 21 May 2024


This article or section is a Stub. You can help the Resonite Wiki by expanding it.


Component image 
GrabbableReceiverSurface component as seen in the Scene Inspector

Intoduction

The GrabbableReceiverSurface component allows you to set up an object so that Grabbable objects snap to its surface when a user releases the Grabbable object within range of it.

Add Component Path: Transform > Interaction > GrabbableReceiverSurface.

Usage

Fields
Name Type Description
persistent Bool Determines whether or not this item will be saved to the server.
UpdateOrder Int Controls the order in which this component is updated.
Enabled Bool Controls whether or not this component is enabled.
ParentPlaced Bool Whether the Grabbable object gets reparented to this object's Slot or the Slot specified in OverrideParent.
OverrideParent Slot If not null, the slot that the Grabbable object gets reparented to, if ParentPlaced is true.
TweenTime Float The amount of time in seconds for the animation effect when the object snaps to the surface.
MaxDistance Float
Offset Float The distance from the surface that the Grabbable object will stop at.
CheckOffset Float
Directions direct SyncFieldList`1<Float3> List of directions a Grabbable object can be received from.
TagFilter direct TagFilter

TagFilter:

Fields
Name Type Description
Mode TagFilterMode Blacklist or Whitelist
Tags String List of tags that the filter applies to.

Behavior

When a GrabbableReceiverSurface is setup on an object, it will become visible to Grabbable objects when they are released from a user's grab. When this occurs the Surface will carry out some checks and if these pass the object will snap to the GrabbableReceiverSurface. If the ParentPlaced checkbox is enable the Grabbable will be parented to the surface or the slot specified in OverrideParent

Explanation of the Checks

These are a little complicated but if you want to fully understand what happens it is provided.

When a user is holding a Grabbable object and let's go(releases it):

  1. The Grabbable object will look around it in its vicinity using a sphere collider based on the Object's bounding box plus a radius defined on the User's Hand
  2. If this collider overlaps with any objects which have GrabbableRecieverSurface attached to them then the Grabbable will perform some checks on each surface.
  3. First it asks the Surface to check its distance from the Grabbable object.
    1. The distance check first calculates if a Raycast from the released object towards the surface would hit in the directions specified in the component.
    2. If the Raycast would hit a distance is then calculated.
    3. This distance varies depending on the directions specified in the component's properties.
      • For example, placing an object on top of a cube from above has a shorter distance to the top of the Cube than the bottom of a cube because the distance from above the cube to the bottom face of the cube is greater.
  4. If this distance is to great as specified in the component's properties a second check using the released object's bounding box corners is also computed
  5. After both distance checks a final distance value is provided.
  6. The Grabbable then selects the surface with the smallest distance and tells the Surface to receive it.
  7. The Surface will then position the Grabbable upon the surface using an Animation of a Tween Time value is set.
  8. The Surface will then parent the Grabbable to itself or the OverrideParent location if the ParentPlaced checkbox is checked.

Examples

ProbablePrime's tutorial on GrabbleReceiverSurface:

Frequently Asked Questions

Can objects which are not grabbed be received?

No, this component only works with Grabbable objects which are released by a user.

Can this be used with objects that are not Grabbable?

No, It cannot be used with objects that do not have a Grabbable component.

Related Components