SimpleScript.OnCollisionOptionsAttribute

SimpleScript.OnCollisionOptionsAttribute Class

Set options for OnCollision events, or use to create more simple collision handlers.

Syntax

[Sansar.Script.Interface]
[System.AttributeUsage(System.AttributeTargets.Method, AllowMultiple=false)]
protected class SimpleScript.OnCollisionOptionsAttribute : SimpleScript.SimpleScriptOptionsAttribute

See Also

Remarks

This attribute is optional when overriding OnCollision which by default will respond to CollisionEventType.AllCollisions.

Add this attribute to any method that matches Action<CollisionData> to create extra collision event subscriptions.
C# Example
[OnCollisionOptions(EventType=CollisionEventType.CharacterContact)]
            void CharacterCollisionsOnly(CollisionData data)
            {
               // character collisions.
            }
              
            void OnCollision(CollisionData data)
            {
               // all collisions (including character) 
            }

Example

C# Example
            // Only receive events for collisions with users
            [OnCollisionOptions(EventType=CollisionEventType.CharacterContact]
            protected override OnCollision(CollisionData data)
            

Requirements

Namespace: Sansar.Simulation
Assembly: Sansar.Simulation (in Sansar.Simulation.dll)
Assembly Versions: 1.1.0.0

Members

See Also: Inherited members from SimpleScript.SimpleScriptOptionsAttribute.

Public Constructors

 
Set options for OnCollision events.

Public Properties

 
EventType CollisionEventType . Set the event type for the types of collisions to get events for.

Member Details

SimpleScript.OnCollisionOptionsAttribute Constructor

Set options for OnCollision events.

Syntax

public SimpleScript.OnCollisionOptionsAttribute ()

Remarks

 

Requirements

Namespace: Sansar.Simulation
Assembly: Sansar.Simulation (in Sansar.Simulation.dll)
Assembly Versions: 1.1.0.0

EventType Property

Set the event type for the types of collisions to get events for.

Syntax

[Sansar.Script.Interface]
[get: Sansar.Script.Interface]
[set: Sansar.Script.Interface]
public CollisionEventType EventType { get; set; }

Value

The type of collision events to subscribe to.

Remarks

 

Example

C# Example
            // Only receive events for collisions with users
            [OnCollisionOptions(EventType=CollisionEventType.CharacterContact]
            protected override OnCollision(CollisionData data)
            

Requirements

Namespace: Sansar.Simulation
Assembly: Sansar.Simulation (in Sansar.Simulation.dll)
Assembly Versions: 1.1.0.0


Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request

0 Comments

Article is closed for comments.