WHAT IS
3D RAD?
CLICK HERE
TO FIND OUT!


EventOnContact


This object starts/stops (or shows/hides) objects linked to it when a collision between two objects of a specified set is detected.

Typical usage includes emission of sounds on collisions, activation of pre-defined animations (for example an explosion), point assignments based on how/where an object is hit by a bullet and so on.

This object can itself be started and stopped by other event objects, allowing you to create chains and achieve articulated event management.

For more about event objects in general, please see this tutorial.


USAGE

Add the EventOnContact object to your project, link it to all the objects you want to monitor for collisions and also to all objects you want to start/stop when a contact is detected.

You link objects together in the Object List (left side of 3D Rad main screen), by selecting an object and then checking the other objects you want to link to it.

To configure the EventOnContact object, double-click it in the Object List to open the following property dialog:



Relationships

This list defines how the EventOnContact object relates to the objects that are linked to it. The following relationship types are supported:

  • IGNORE. Do nothing. Typically used for linked objects that are starters for this EventOnContact object itself (in a chain of event objects for example).


  • MONITOR. Check the object for collisions.


  • MONITOR (REFERENCE). Check the object for collisions. The object is also used as a reference when contact location bounds (or force bounds, or normal ranges) are used. Use simple MONITOR mode instead, if no bound/range option is used.


  • START ON CONTACT. Start the object when a contact between two monitored objects is detected. Note that the target object must provide some 'startable' action.


  • STOP ON CONTACT. Stop the object when a contact between two monitored objects is detected.


  • SWITCH ON CONTACT. Switch the object (start if stopped and vice-versa) when a contact between two monitored objects is detected. Note that, because the checking is performed 75 times per second, contacts may be reported several times, until the bodies are no longer in contact. This causes the target objects to be switched on/off repeatedly.


  • SHOW ON CONTACT. Show the object when a contact between two monitored objects is detected.


  • HIDE ON CONTACT. Hide the object when a contact between two monitored objects is detected.


  • S/H SWITCH ON CONTACT. Switch the object (show if hidden and vice-versa) when a contact between two monitored objects is detected.


  • RESET. Re-initialize the object completely, to its default state, as defined in the project.


  • Randomize target object

    If this option is checked, the specified action is applied to one target object only, picked randomly. If the option is not checked, the action is applied to all target objects instead.

    Use contact location bounds

    If enabled, the event action is only performed if the collision happened farther than the specified minimum distance and closer than the specified maximum distance (Radius min/max values), from the specified Target center.

    The target center location is relative to the center of the colliding, reference object. If none of the two objects colliding is marked as MONITOR (REFERENCE), the contact is not detected.

    This feature is typically used to only perform event actions on collisions happening on specific parts of an object.

    Use contact force bounds

    If enabled, the event action is only performed if the intensity of the forces generated by the collision is within the specified range.

    Note that intensity may vary greatly, depending on body masses and velocity.

    If none of the two objects colliding is marked as MONITOR (REFERENCE), the contact is not detected.

    Use contact normal ranges

    If enabled the event action is only performed if the X, Y, Z components of the surface normal vector, at contact location, are within the specified ranges.

    The surface normal describes the orientation of the surface of the reference body, at contact location. It is a unitary vector perpendicular to the surface. Its orientation is relative to reference object's orientation.

    This feature is useful to perform event actions on collisions happening on surfaces with a certain sloping only.

    If none of the two objects colliding is marked as MONITOR (REFERENCE), the contact is not detected.

    Working at start

    If this option is not checked, the EventOnContact object will not work until it is started by using another event object.

    The remaining controls are common to all objects.
    They are explained here.



    INTERNAL PARAMETERS


    The EventOnContact object has an internal parameter you can access by using other objects like EventOnValue or Script.

  • Contact force, read-only. If non zero, the value is the intensity of the force generated by the collision. Note that this parameter is non zero only when the conditions you have set for this event object are met (see above).