Scripting API

Home Scripting API Index Class Overview

com.nolimitscoaster

Class InteractionObject


public final class InteractionObject
extends Entity

This class is part of the cursor system.

It allows for user interaction using the mouse, game controller, and VR motion controllers.

Since:
    2.6.4.0

Method Summary

void addActionListener(InteractionActionListener listener)
  Registers a callback interface for simple action events.
static InteractionObject createSimpleButton()
  Creates a simple detectable button region, that has the shape of a sphere.
bool isActive()
  Returns the current activation state. After creation, the interaction object is active by default.
bool isEnabled()
  Returns the current enable state. After creation, the interaction object is enabled by default.
void removeActionListener(InteractionActionListener listener)
  Removes a listener callback interface that was previously registered with addActionListener
void setActive(bool active)
  Sets if the interaction object should be active and in use by the cursor system.
void setEnabled(bool enable)
  Sets if the interaction object should be shown as enabled to the user.
void setPosition(nlvm.math3d.Vector3f pos)
  Sets the position of the interaction object.
void setProcessActionEventsWhenDisabled(bool b)
  Sets if it should be possible to interact with the object by the user, even when it is in the disabled state.
void setRadius(float radius)
  Sets the radius of the detection sphere.


Method Detail


addActionListener

public final void addActionListener(InteractionActionListener listener)

Registers a callback interface for simple action events.

The registered callback listener will be called whenever the user presses the interaction object.

Parameters:

listener - The callback listener to be registered, must not be null

createSimpleButton

public static final InteractionObject createSimpleButton()

Creates a simple detectable button region, that has the shape of a sphere.

The position and radius properties are used to define the location and size of the sphere.

Returns:
    the interaction object handle.


isActive

public final bool isActive()

Returns the current activation state. After creation, the interaction object is active by default.

Returns:
    current activation state.


isEnabled

public final bool isEnabled()

Returns the current enable state. After creation, the interaction object is enabled by default.

Returns:
    current enable state.


removeActionListener

public final void removeActionListener(InteractionActionListener listener)

Removes a listener callback interface that was previously registered with addActionListener

Parameters:

listener - The listener to be removed

setActive

public final void setActive(bool active)

Sets if the interaction object should be active and in use by the cursor system.

A deactivated interaction object is excluded from further processing by the cursor system.

Parameters:

active - false when the interaction object should be omitted by the cursor system, or true (default) for normal processing.

setEnabled

public final void setEnabled(bool enable)

Sets if the interaction object should be shown as enabled to the user.

An enabled interaction object will be indicated by some green cursor or clickable hand to the user, and it can be interacted with by the user. Disabled interaction objects will be indicated by some red cursor or no indication at all, and cannot be interacted with by the user. setProcessActionEventsWhenDisabled can be used to allow interaction with the object by the user, even when it is disabled.

Parameters:

enable - false when the interaction object should not be interacted with by the user, or true for normal interaction.

setPosition

public final void setPosition(nlvm.math3d.Vector3f pos)

Sets the position of the interaction object.

Parameters:

pos - The position in absolute world coordinates

setProcessActionEventsWhenDisabled

public final void setProcessActionEventsWhenDisabled(bool b)

Sets if it should be possible to interact with the object by the user, even when it is in the disabled state.

This allows to receive action events even when the object is indicated as disabled to the user.

Parameters:

b - true when action events should be sent, even when disabled, or false (default).

setRadius

public final void setRadius(float radius)

Sets the radius of the detection sphere.

Parameters:

radius - The radius of the detection sphere in meters