SetPhysicsCollisionFlags

Definition

SetPhysicsCollisionFlags(string group1, string group2, bool flag)

Description

Each physics actor in Vanda engine belongs to a specific group. For example, a dynamic physics actor belongs to the “DYNAMIC” group, while a static physics actor belongs to the “STATIC” group. With this function one can set whether collisions should be detected between physics actors belonging to a given pair of groups at runtime. You can also use the Tools > Current VScene Properties menu to enable/disable collision detection between physics actors belonging to a given pair of groups. Initially all pair of physics groups except (Trigger vs. Ground Plane) pair are enabled, meaning that collision detection happens between all physics actors except (Trigger vs. Ground Plane).
Collision detection between two physics actors a and b occurs if: SetPhysicsCollisionFlags(a->groupb->group, true).

Parameters

group1
Specifies the first group. The following group types are supported:

“KINEMATIC”
Kinematic is a dynamic actor that can ignore some rules of physics, and its rotation and translation is controlled by prefab instance.
“DYNAMIC”
A dynamic actor has its position and rotation updated by the physics simulation and controls the translation and rotation of its prefab instance.
“TRIGGER”
Triggers allow colliders to perform overlap tests.
“STATIC”
Static actor is immovable by the physics simulation.
“GROUND”
Default physics ground plane.

group2
Specifies the second group. The supported groups are similar to the group1 description.

flag
This boolean value specifies whether collisions should be detected between physics actors belonging to a given pair of groups. Accepted values are true and false. The true value means that collision detection between two physics actors a and b belonging to group1 and group2 occurs.

Example 1

function Init()
    SetPhysicsCollisionFlags("DYNAMIC""DYNAMIC"false)
end

function Update()

end
In this case, collision detection is disabled for all dynamic physics actors.

Example 2

function Init()
    SetPhysicsCollisionFlags("DYNAMIC""STATIC"false)
end

function Update()

end
In this case, collision detection between dynamic and static physics actors is disabled.

Example 3

function Init()
    SetPhysicsCollisionFlags("DYNAMIC""KINEMATIC"true)
end

function Update()

end
In this case, collision detection between dynamic and kinematic physics actors is enabled.
adminSetPhysicsCollisionFlags