RayCastPlugin

IMML example

<Plugin Name="RayCastPlugin" Enabled="True" Source="http://id.vastpark.com/VastParkWS/get.vpws?name=RayCastPlugin&amp;publisher=Tulloh&amp;domain=vastpark&amp;context=park">
    <Element Name="RayCastingObject" />
    <Parameter Key="rayVector"           Value="0,0,1" />
    <Parameter Key="rayStartPointOffset" Value="0,5,2" />
    <Parameter Key="distThreshold"       Value="20" />
    <Parameter Key="checksPerSec"        Value="5" />
    <Parameter Key="hitScript"           Value="MyHitScript" />
    <Parameter Key="missScript"          Value="MyMissScript" />
    <Parameter Key="collidePhysicsOnly"  Value="true" />
    <Parameter Key="collideVisibleOnly"  Value="true" />
</Plugin>

Properties

Vector3 rayVector

  • Summary: A vector in the direction of the desired ray, relative to the ray casting element.

Vector3 rayStartPointOffset

  • Summary: A vector to offset the rayVector, relative to the ray casting element (defaults to 0,0,0).

float distThreshold

  • Summary: The distance the ray will check in the direction of rayVector. The number of times the ray cast will check for collisions per second.

float checksPerSec

  • Summary: The number of times the ray cast will check for collisions per second.

bool collidePhysicsOnly

  • Summary: If true, the ray will only be tested against objects with phyics enabled (defaults to false).

bool collideVisibleOnly

  • Summary: If true, the ray will only be tested against objects with visibility enabled (defaults to true).

string hitScript

  • Summary: The name on the IMML script element to be fired upon ray collision. It will receive the parameters (obj, args)
  • obj - the object that was hit by the ray
  • args.data.hitDistance - the distance from the ray origin to the collision point
  • args.data.hitPosition - a vector3 in world space to the collision point

string missScript

  • Summary: The name on the IMML script element to be fired when no collision is detected. It receives no parameters.

string ignoreList

  • Summary: A list of names of elements that should be ignored by ray detection.

bool Enabled

  • Summary: Turns the check on/off.

Functions

void Load()

  • Summary: Sets the defaults for the plugin.

void AddElement(ImmlElement element)

  • Summary: There can only be one element at a time. This element will be the object that the ray is cast from.
  • Parameters
    • element: The name of the IMML element to add.

void Update()

  • Summary: Called every update. Its actions are limited by the user defined checksPerSecond property.

void Dispose()

void SetParkEngine(IParkEngine parkEngine)