Scripting API

Home Scripting API Index Class Overview

com.nolimitscoaster

Class Simulator


public final class Simulator
extends Object

Used to access the Simulator Mode API

This is the class for accessing functionality that can be used in Sim Mode (play mode)

Method Summary

void addFrameListener(FrameListener listener)
  Registers a FrameListener. FrameListeners are callbacks that will be called for each computed frame.
bool containsFrameListener(FrameListener listener)
  Checks if a listener was previously registered with addFrameListener
ExternalRideView createExternalRideView()
  Create an external ride view handle
TrackPos findNearestCoasterTrack(nlvm.math3d.Vector3f pos, float range)
  Searches for the nearest track of a coaster within a specified range.
float getCloudIntensity()
  Returns the cloud intensity
Coaster getCoaster(String name)
  Gets a handle to a coaster using a name
Coaster getCoasterAt(int n)
  Returns a coaster at index
int getCoasterCount()
  Returns the number of coasters
Coaster getCoasterForEntityId(int id)
  Gets a handle to a coaster using an internal entity ID
double getCurAbsSimulationTimeSec()
  Returns the current overall simulation time from start of the simulation
float getCurSimulationSpeed()
  Returns the current simulation speed
float getCurSimulationTickSec()
  Returns the current tick step time of the current frame in seconds
float getCurSunAzimuth()
  Returns the current sun direction
float getCurSunElevation()
  Returns the current sun elevation
float getCurTimeOfDay()
  Returns the current time of day
float getCurUnscaledTickSec()
  Returns the current tick step time (not affected by simulation speed) of the current frame in seconds
float getCurWindAzimuth()
  Returns the current wind direction
float getCurWindSpeed()
  Returns the current wind speed in meters per second
float getFogIntensity()
  Returns the fog intensity
float getOvercastIntensity()
  Returns the overcast intensity
float getRainIntensity()
  Returns the rain intensity
SceneObject getSceneObject(String name)
  Gets a handle to the first scene object instance having the name
SceneObject getSceneObjectForEntityId(int id)
  Gets a handle to a scene object instance using an internal entity ID
com.nolimitscoaster.SceneObject[] getSceneObjectsWithName(String name)
  Gets and array with all handles of scene objects instances having the same name
float getSnowIntensity()
  Returns the snow intensity
float getTerrainHeight(float x, float z)
  Gets the height of the terrain at coordinates x,z in meters
float getTerrainHeightAndNormal(float x, float z, bool smoothNormal, nlvm.math3d.Vector3f normal)
  Gets the height of the terrain at coordinates x,z in meters and also returns the normal vector
float getTerrainHeightAndNormalApprox(float x, float z, nlvm.math3d.Vector3f normal)
  Gets the approximated height of the terrain at coordinates x,z in meters.
float getThunderIntensity()
  Returns the thunder intensity
TrackTrigger getTrackTriggerForEntityId(int id)
  Gets a handle to a track trigger using an internal entity ID
void getViewMatrix(nlvm.math3d.Matrix4x4f matrix)
  Gets the orientation and position of the viewer as a matrix.
void getViewPos(nlvm.math3d.Vector3f pos)
  Gets the position of the viewer.
float getWindIntensity()
  Returns the wind intensity
bool isViewerInsideSphere(nlvm.math3d.Vector3f center, float radius)
  Checks if the viewer is inside a sphere.
void removeFrameListener(FrameListener listener)
  Unregister a FrameListener that was previously registered with addFrameListener
void setCloudIntensity(float f)
  Sets the cloud intensity
void setCurTimeOfDay(float t)
  Sets the current time of day
void setFogIntensity(float f)
  Sets the fog intensity
void setOvercastIntensity(float f)
  Sets the overcast intensity
void setRainIntensity(float f)
  Sets the rain intensity
void setSnowIntensity(float f)
  Sets the snow intensity
void setThunderIntensity(float f)
  Sets the thunder intensity
void setWindIntensity(float f)
  Sets the wind intensity


Method Detail


addFrameListener

public final void addFrameListener(FrameListener listener)

Registers a FrameListener. FrameListeners are callbacks that will be called for each computed frame.

Parameters:

listener - instance of FrameListener

containsFrameListener

public final bool containsFrameListener(FrameListener listener)

Checks if a listener was previously registered with addFrameListener

Parameters:

listener - An instance of FrameListener

Since:
    2.6.3.3


createExternalRideView

public final ExternalRideView createExternalRideView()

Create an external ride view handle

Returns:
    ExternalRideView object


findNearestCoasterTrack

public final TrackPos findNearestCoasterTrack(nlvm.math3d.Vector3f pos, float range)

Searches for the nearest track of a coaster within a specified range.

This method is very slow, it is not recommended to call this method each frame.

Parameters:

pos - position in 3D editor space
range - Range of sphere (in meters) to search a coaster within. When negative, no range test will be performed.

Returns:
    A TrackPos object that represents the track and position, or null if no coaster and track is within range.


getCloudIntensity

public final float getCloudIntensity()

Returns the cloud intensity

Returns:
    intensity of clouds (0..1)


getCoaster

public final Coaster getCoaster(String name)

Gets a handle to a coaster using a name

Parameters:

name - name of coaster as specified in editor

Returns:
    coaster handle, or null if there is no coaster with that name


getCoasterAt

public final Coaster getCoasterAt(int n)

Returns a coaster at index

Parameters:

n - Index of coaster from 0...getCoasterCount()-1

Returns:
    Coaster or null if invalid index

Since:
    2.2.3.5


getCoasterCount

public final int getCoasterCount()

Returns the number of coasters

Returns:
    Number of coasters

Since:
    2.2.3.5


getCoasterForEntityId

public final Coaster getCoasterForEntityId(int id)

Gets a handle to a coaster using an internal entity ID

Parameters:

id - entity ID of coaster

Returns:
    coaster handle, or null if there is no coaster with that ID


getCurAbsSimulationTimeSec

public double getCurAbsSimulationTimeSec()

Returns the current overall simulation time from start of the simulation

Returns:
    simulation time in seconds starting from 0


getCurSimulationSpeed

public final float getCurSimulationSpeed()

Returns the current simulation speed

Returns:
    simulation speed factor (1 = standard speed)

Since:
    2.5.5.1


getCurSimulationTickSec

public final float getCurSimulationTickSec()

Returns the current tick step time of the current frame in seconds

Returns:
    simulation time since last frame in seconds


getCurSunAzimuth

public final float getCurSunAzimuth()

Returns the current sun direction

Returns:
    sun azimuth angle (in radians)


getCurSunElevation

public final float getCurSunElevation()

Returns the current sun elevation

Returns:
    sun elevation angle (in radians)


getCurTimeOfDay

public final float getCurTimeOfDay()

Returns the current time of day

Returns:
    time of day in decimal hours (0..24), e.g. 6.2f corresponds to 6:12h


getCurUnscaledTickSec

public final float getCurUnscaledTickSec()

Returns the current tick step time (not affected by simulation speed) of the current frame in seconds

It is similar to getCurSimulationTickSec() divided by getCurSimulationSpeed(). Used only in rare cases. In most cases getCurSimulationTickSec() is the better choice.

Returns:
    time (not affected by simulation speed) since last frame in seconds

Since:
    2.5.5.1


getCurWindAzimuth

public final float getCurWindAzimuth()

Returns the current wind direction

Returns:
    wind direction in azimuth angle (in radians)


getCurWindSpeed

public final float getCurWindSpeed()

Returns the current wind speed in meters per second

Returns:
    wind speed (in meters per second)


getFogIntensity

public final float getFogIntensity()

Returns the fog intensity

Returns:
    intensity of fog (0..1)


getOvercastIntensity

public final float getOvercastIntensity()

Returns the overcast intensity

Returns:
    intesity of weather overcast (0..1)


getRainIntensity

public final float getRainIntensity()

Returns the rain intensity

Returns:
    intensity of rain (0..1)


getSceneObject

public final SceneObject getSceneObject(String name)

Gets a handle to the first scene object instance having the name

Parameters:

name - name of scene object instance as specified in editor

Returns:
    scene object instance handle, or null if there is no scene object instance with that name


getSceneObjectForEntityId

public final SceneObject getSceneObjectForEntityId(int id)

Gets a handle to a scene object instance using an internal entity ID

Parameters:

id - entity ID of scene object instance

Returns:
    scene object instance handle, or null if there is no scene object instance with that ID


getSceneObjectsWithName

public final com.nolimitscoaster.SceneObject[] getSceneObjectsWithName(String name)

Gets and array with all handles of scene objects instances having the same name

Parameters:

name - name of scene object instances as specified in editor

Returns:
    scene object instance handle array. Returns empty array if there is no scene object instance with that name. Never returns null.

Since:
    2.5.5.0


getSnowIntensity

public final float getSnowIntensity()

Returns the snow intensity

Returns:
    intensity of snow (0..1)


getTerrainHeight

public final float getTerrainHeight(float x, float z)

Gets the height of the terrain at coordinates x,z in meters

Parameters:

x - coordinate x in meters
z - coordinate z in meters

Returns:
    height (y) in meters at x,z


getTerrainHeightAndNormal

public final float getTerrainHeightAndNormal(float x, float z, bool smoothNormal, nlvm.math3d.Vector3f normal)

Gets the height of the terrain at coordinates x,z in meters and also returns the normal vector

Parameters:

x - coordinate x in meters
z - coordinate z in meters
smoothNormal - When true, the normal will be interpolated smoothly (using Phong), otherwise it is flat just like the polygons inside the program.
normal - receives the normal vector at the terrain coordinates. May be null.

Returns:
    height (y) in meters at x,z

Since:
    2.2.4.0


getTerrainHeightAndNormalApprox

public final float getTerrainHeightAndNormalApprox(float x, float z, nlvm.math3d.Vector3f normal)

Gets the approximated height of the terrain at coordinates x,z in meters.

This method is faster than getTerrainHeight and getTerrainHeightAndNormal but returns less precise values. The normal vector is optional. Just like the height, it will only be approximated and therefore might be less precise than the real terrain normal.

Parameters:

x - coordinate x in meters
z - coordinate z in meters
normal - receives the approximated normal vector at the terrain coordinates. May be null when the normal vector is not required.

Returns:
    height (y) in meters at x,z

Since:
    2.2.4.0


getThunderIntensity

public final float getThunderIntensity()

Returns the thunder intensity

Returns:
    intensity of thunder (0..1)


getTrackTriggerForEntityId

public final TrackTrigger getTrackTriggerForEntityId(int id)

Gets a handle to a track trigger using an internal entity ID

Parameters:

id - entity ID of track trigger

Returns:
    track trigger handle, or null if there is no track trigger with that ID


getViewMatrix

public final void getViewMatrix(nlvm.math3d.Matrix4x4f matrix)

Gets the orientation and position of the viewer as a matrix.

Parameters:

matrix - receives the viewer's camera matrix. Must not be null.

Since:
    2.0.5.6


getViewPos

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

Gets the position of the viewer.

Parameters:

pos - will receive the position. Must not be null.

getWindIntensity

public final float getWindIntensity()

Returns the wind intensity

Returns:
    intensity of wind (0..1), 1 corresponds to 12 bft


isViewerInsideSphere

public final bool isViewerInsideSphere(nlvm.math3d.Vector3f center, float radius)

Checks if the viewer is inside a sphere.

Can be used for quickly testing if the viewer is inside a sphere. This is faster than a manual computation using getViewPos.

Parameters:

center - the center of a sphere in world coordinates (meters). Must not be null.
range - the radius of a sphere in meters.

Since:
    2.5.6.0


removeFrameListener

public final void removeFrameListener(FrameListener listener)

Unregister a FrameListener that was previously registered with addFrameListener

Parameters:

listener - An instance of FrameListener

setCloudIntensity

public final void setCloudIntensity(float f)

Sets the cloud intensity

Parameters:

f - intensity of clouds (0..1)

setCurTimeOfDay

public void setCurTimeOfDay(float t)

Sets the current time of day

Parameters:

t - time of day in decimal hours (0..24), e.g. 6.2f corresponds to 6:12h

Since:
    2.6.2.0


setFogIntensity

public final void setFogIntensity(float f)

Sets the fog intensity

Parameters:

f - intensity of fog (0..1)

setOvercastIntensity

public final void setOvercastIntensity(float f)

Sets the overcast intensity

Parameters:

f - intensity of weather overcast (0..1)

setRainIntensity

public final void setRainIntensity(float f)

Sets the rain intensity

Parameters:

f - intensity of rain (0..1)

setSnowIntensity

public final void setSnowIntensity(float f)

Sets the snow intensity

Parameters:

f - intensity of snow (0..1)

setThunderIntensity

public final void setThunderIntensity(float f)

Sets the thunder intensity

Parameters:

f - intensity of thunder (0..1)

setWindIntensity

public final void setWindIntensity(float f)

Sets the wind intensity

Parameters:

f - intensity of wind (0..1), 1 corresponds to 12 bft