Component:PhysicalButton: Difference between revisions

From Resonite Wiki
m removed needless introduction header
add info
 
(2 intermediate revisions by 2 users not shown)
Line 2: Line 2:
<translate>
<translate>
<!--T:1-->
<!--T:1-->
{{stub}}
{{Infobox Component
{{Infobox Component
|Image=PhysicalButtonComponent.png
|Image=PhysicalButtonComponent.png
|Name=Physical Button
|Name=Physical Button
}}The PhysicalButton component can be used to create buttons that move inward when pressed by a user, a press depth and threshold can be set to customize the physical feeling of the button.  
}}
The '''PhysicalButton''' component can be used to create buttons that move inward when pressed by a user, a press depth and threshold can be set to customize the physical feeling of the button.  


== Fields ==
== Fields ==
{{Table ComponentFields
{{Table ComponentFields
|PressAxis|Float3|
|PressAxis|Float3| The direction in local space to go when pressing the button
|AcceptPhysicalTouch|Bool|
|AcceptPhysicalTouch|Bool| Whether to allow [[Component:TipTouchSource]]s to press the button.
|AcceptRemoteTouch|Bool|
|AcceptRemoteTouch|Bool| Whether to allow this button to be pressed via laser.
|AcceptOutOfSightTouch|Bool|
|AcceptOutOfSightTouch|Bool| Whether to allow pressing this button if the button is out of the user's view.
|EditModeOnly|Bool|
|EditModeOnly|Bool| Whether this button can only be pressed if the user is in [[Edit Mode]]
|ActiveUserFilter|ActiveUserHandling|
|ActiveUserFilter|ActiveUserHandling| How to filter in or out the active user of this component.
|__legacyActiveUserRootOnly|Bool|
|__legacyActiveUserRootOnly|Bool| Whether to use the legacy active user root only option.
|Pressed|WorldDelegate|
|Pressed|{{RootFieldType|SyncDelegate`1|[[Type:ButtonEventHandler|ButtonEventHandler]]}}|TypeAdv7=true| A sync delegate to call when the button is pressed.
|Pressing|WorldDelegate|
|Pressing|{{RootFieldType|SyncDelegate`1|[[Type:ButtonEventHandler|ButtonEventHandler]]}}|TypeAdv8=true| A sync delegate to call when the button is being pressed. is called every game update while the button is held down.
|Released|WorldDelegate|
|Released|{{RootFieldType|SyncDelegate`1|[[Type:ButtonEventHandler|ButtonEventHandler]]}}|TypeAdv9=true| A sync delegate to call when the button is released.
|PressDepth|Float|
|PressDepth|Float| The max distance the button can move in <code>PressAxis</code> direction
|PressThreshold|Float|
|PressThreshold|Float| If pressed more than this amount, the button is considered pressed.
|ReleaseThreshold|Float|
|ReleaseThreshold|Float| If pressed less than this amount, the button is considered released.
|IsPressed|Bool|
|IsPressed|Bool| Whether the user has the button pressed.
|IsHovering|Bool|
|IsHovering|Bool| Whether the user is hovering their interaction source at the button (laser or tip touch source)
|BeginPressVibration|VibratePreset|
|IsHolding|Bool| Whether the user is holding the button.
|PressVibration|VibratePreset|
|IsPressedOrHolding|{{RootFieldType|RawOutput`1|[[Type:Bool|Bool]]}}|TypeAdv16=true| Whether the button is being held down or being pressed.
|HoverVibration|VibratePreset|
|Hold|Bool| Whether the button can be held down.
|Label|IField`1|TypeString18=IField<string>|
|HoldDepthRatio|Float| How far the button has to be pressed before it is considered being held down.
|_currentPressingDepth|Float|
|BeginPressVibration|VibratePreset| How to vibrate a user's hand when they begin to press the button.
|_buttonOffset|Float3|
|PressVibration|VibratePreset| How to vibrate a user's hand when they press the button.
|_buttonPosition|IField`1|TypeString21=IField<float3>|
|HoverVibration|VibratePreset| How to vibrate a user's hand when they point at the button.
|Label|'''[[Type:IField`1|IField`1]]&lt;[[Type:String|String]]&gt;'''|TypeAdv22=true| The field to drive with a label describing this button.
|_currentPressingDepth|Float| The current amount that the button is being pushed down.
|_buttonOffset|Float3| The initial position of the button's transforms in local space.
|_buttonPosition|{{RootFieldType|FieldDrive`1|[[Type:Float3|Float3]]}}|TypeAdv25=true| the field to drive to influence the position of the button for pressing.
}}
}}


<!--T:3-->
<!--T:3-->
== Usage ==
== Usage ==
Attach to a slot under another slot. the slot hiearchy this is on should have a collider in order to be able to press the button. Hooking this up to [[ProtoFlux]], or using the [[Button Events]] this generates will give this button functionality.
== Miscellaneous Notes ==
When adding this component to an object that has the [[Grabbable_(Component)|Grabbable component]], you will notice that the object may not be grabbable anymore. To remedy this, create a child object on the main object you want to be your button. Then, on that child object, attach this component. You should now have an object that is grabbable and functions as a button.


<!--T:4-->
<!--T:4-->
== Examples ==
== Examples ==
{{stub}}


<!--T:5-->
<!--T:5-->
== Related Components ==
== See Also ==
</translate>
</translate>
[[Category:ComponentStubs]]
[[Category:Components{{#translation:}}|Physical Button]]
[[Category:Components{{#translation:}}|Physical Button]]
[[Category:Components:Transform:Interaction{{#translation:}}|Physical Button]]
[[Category:Components:Transform:Interaction{{#translation:}}|Physical Button]]
<!--T:6-->
== Miscellaneous Notes ==
When adding this component to an object that has the [[Grabbable_(Component)|Grabbable component]], you will notice that the object may not be grabbable anymore. To remedy this, create a child object on the main object you want to be your button. Then, on that child object, attach this component. You should now have an object that is grabbable and functions as a button.

Latest revision as of 20:02, 13 November 2024

Component image 
Physical Button component as seen in the Scene Inspector

The PhysicalButton component can be used to create buttons that move inward when pressed by a user, a press depth and threshold can be set to customize the physical feeling of the button.

Fields

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.
PressAxis Float3 The direction in local space to go when pressing the button
AcceptPhysicalTouch Bool Whether to allow Component:TipTouchSources to press the button.
AcceptRemoteTouch Bool Whether to allow this button to be pressed via laser.
AcceptOutOfSightTouch Bool Whether to allow pressing this button if the button is out of the user's view.
EditModeOnly Bool Whether this button can only be pressed if the user is in Edit Mode
ActiveUserFilter ActiveUserHandling How to filter in or out the active user of this component.
__legacyActiveUserRootOnly Bool Whether to use the legacy active user root only option.
Pressed ButtonEventHandler A sync delegate to call when the button is pressed.
Pressing ButtonEventHandler A sync delegate to call when the button is being pressed. is called every game update while the button is held down.
Released ButtonEventHandler A sync delegate to call when the button is released.
PressDepth Float The max distance the button can move in PressAxis direction
PressThreshold Float If pressed more than this amount, the button is considered pressed.
ReleaseThreshold Float If pressed less than this amount, the button is considered released.
IsPressed Bool Whether the user has the button pressed.
IsHovering Bool Whether the user is hovering their interaction source at the button (laser or tip touch source)
IsHolding Bool Whether the user is holding the button.
IsPressedOrHolding raw output of Bool Whether the button is being held down or being pressed.
Hold Bool Whether the button can be held down.
HoldDepthRatio Float How far the button has to be pressed before it is considered being held down.
BeginPressVibration VibratePreset How to vibrate a user's hand when they begin to press the button.
PressVibration VibratePreset How to vibrate a user's hand when they press the button.
HoverVibration VibratePreset How to vibrate a user's hand when they point at the button.
Label IField`1<String> The field to drive with a label describing this button.
_currentPressingDepth Float The current amount that the button is being pushed down.
_buttonOffset Float3 The initial position of the button's transforms in local space.
_buttonPosition field drive of Float3 the field to drive to influence the position of the button for pressing.

Usage

Attach to a slot under another slot. the slot hiearchy this is on should have a collider in order to be able to press the button. Hooking this up to ProtoFlux, or using the Button Events this generates will give this button functionality.

Miscellaneous Notes

When adding this component to an object that has the Grabbable component, you will notice that the object may not be grabbable anymore. To remedy this, create a child object on the main object you want to be your button. Then, on that child object, attach this component. You should now have an object that is grabbable and functions as a button.

Examples

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


See Also