InteractionComponent

Component available to interact with an Entity.

# Properties

[{"index":"KeyboardKey ActionKey (Sync)","0":"Sets the usable Key for Interaction."}]

[{"index":"string ActionName (Sync)","0":"Sets the name of the Interaction displayed in the chat balloons."}]

[{"index":"Vector2 BoxOffset (Deprecated) (Sync)","0":"Available on previous systems where IsLegacy is true. Sets the center point position of the collider rectangle based on Entity."}]

[{"index":"Vector2 BoxSize (Sync)","0":"Specifies the width and height of the rectangular collider."}]

[{"index":"float CircleRadius (Sync)","0":"The radius of the circular collider. Valid when ColliderType is Circle."}]

[{"index":"string ColliderName (Deprecated) (ReadOnly) (HideFromInspector)","0":"This property is deprecated. Use CollisionGroup."}]

[{"index":"Vector2 ColliderOffset (Sync)","0":"Sets the center point position of the collider based on Entity. Available on new systems with IsLegacy set as false."}]

[{"index":"ColliderType ColliderType (Sync)","0":"Sets the type of collider. Available on new systems with IsLegacy set as false."}]

[{"index":"CollisionGroup CollisionGroup (ReadOnly) (HideFromInspector)","0":"Collider's collision group."}]

[{"index":"float HoldingDuration (Sync)","0":"When InteractionType is set to KeyHoldingDuration or KeyUpAfterHoldingDuration, it sets how long the key should be held down in seconds."}]

[{"index":"Vector2 InfoOffset (Deprecated) (Sync)","0":"This property is no longer used."}]

[{"index":"InteractType InteractionType (Sync)","0":"Sets the key input method required for interaction."}]

[{"index":"boolean IsLegacy (ReadOnly)","0":"Sets whether this Component will operate with the previous system. In a new system, the Collider is affected by TransformComponent's rotation and size. You can also use a circle-shaped collider by setting the ColliderType."}]

[{"index":"SyncList PolygonPoints (Sync)","0":"The positions of the points that make up the polygonal colliding body. Valid when ColliderType is Polygon."}]

[{"index":"boolean ShowActionInfo (Sync)","0":"Determines whether a chat balloon will appear and show the ActionName and ActionKey when a player approaches. A ChatBalloonComponent will be added automatically during gameplay to display the chat balloon."}]

##### inherited from Component:

[{"index":"boolean Enable (Sync)","0":"Checks whether Component is activated or not."}]

[{"index":"boolean EnableInHierarchy (ReadOnly) (HideFromInspector)","0":"Displays whether this Component is Enable in the hierarchy. If Entity Enable is false regardless of Component Enable, returns false."}]

[{"index":"Entity Entity (ReadOnly)","0":"The Entity that owns this component."}]

# Methods

[{"index":"void OnEnter() (Deprecated) (ScriptOverridable)","0":"This function is deprecated. Use InteractionEnterEvent."}]

[{"index":"void OnInteraction() (Deprecated) (ScriptOverridable)","0":"This function is deprecated. Use InteractionEvent."}]

[{"index":"void OnLeave() (Deprecated) (ScriptOverridable)","0":"This function is deprecated. Use InteractionLeaveEvent."}]

[{"index":"void SetOnEnter(func onEnterFunction) (Deprecated)","0":"This function is deprecated. Use InteractionEnterEvent."}]

[{"index":"void SetOnInteraction(func onInteractionFunction) (Deprecated)","0":"This function is deprecated. Use InteractionEvent."}]

[{"index":"void SetOnLeave(func onLeaveFunction) (Deprecated)","0":"This function is deprecated. Use InteractionLeaveEvent."}]

##### inherited from Component:

[{"index":"boolean IsClient()","0":"Returns whether the current execution environment is a client or not."}]

[{"index":"boolean IsServer()","0":"Returns whether the current execution environment is a server or not."}]

# Events

[{"index":"InteractionEnterEvent","0":"The event occurs when entering the interaction area."}]

[{"index":"InteractionEvent","0":"The Event occurs during Interaction."}]

[{"index":"InteractionLeaveEvent","0":"The Event occurs when leaving the Interaction area."}]

# Examples

When Interaction occurs, the InputSpeed of the MovementComponent for the Player Entity changes to 3.
    
    
    @Component
    script InteractionEffectController extends Component
        @EventSender("Self")
        handler HandleInteractionEnterEvent(InteractionEnterEvent event)
        -- Parameters
        local InteractionEntity = event.InteractionEntity
        --------------------------------------------------------
        if self:IsClient() then
        	return
        end
    
        local effectRoot = _EntityService:GetEntityByPath(EntityPath)
        effectRoot.Enable = true
        end
    
        @EventSender("Self")
        handler HandleInteractionLeaveEvent(InteractionLeaveEvent event)
        -- Parameters
        local InteractionEntity = event.InteractionEntity
        --------------------------------------------------------
        if self:IsClient() then
        	return
        end
    
        local effectRoot = _EntityService:GetEntityByPath(EntityPath)
        effectRoot.Enable = false
        end
    
        @EventSender("Self")
        handler HandleInteractionEvent(InteractionEvent event)
        -- Parameters
        local InteractionEntity = event.InteractionEntity
        --------------------------------------------------------
        if self:IsServer() then
        	return
        end
    
        InteractionEntity.MovementComponent.InputSpeed = 3
        end
    end
    

# SeeAlso

  * MovementComponent
  * InteractionEnterEvent
  * InteractionEvent
  * InteractionLeaveEvent
  * EntityService