GetCollisionType

Returns an entity's collision type. Collision types are used to control what kind of objects will register collisions when they come into contact.

Syntax

Returns

Returns the entity's collision type.

Example

--Create a window
window = Window:Create()
context = Context:Create(window)

world = World:Create()

local camera = Camera:Create()
camera:SetRotation(35,0,0)
camera:Move(0,0,-8)

local light = DirectionalLight:Create()
light:SetRotation(35,35,0)

--Create the ground
local ground = Model:Box(10,1,10)
ground:SetColor(0.0,1.0,0.0)

--Create a shape
local shape = Shape:Box(0,0,0, 0,0,0, 10,1,10)
ground:SetShape(shape)
shape:Release()

--Create a model
entity1 = Model:Box()
entity1:SetColor(0.0,0.0,1.0)
entity1:SetPosition(-2,5,0)
entity1:SetMass(1)
entity1:SetCollisionType(Collision.Prop)

--Create a shape
shape = Shape:Box()
entity1:SetShape(shape)
shape:Release()

--Create a second model
entity2 = entity1:Instance()
entity2:SetPosition(2,5,0)
entity2:SetCollisionType(Collision.None)

while true do
if window:Closed() or window:KeyHit(Key.Escape) then return false end
Time:Update()
world:Update()
world:Render()

context:SetBlendMode(Blend.Alpha)
context:DrawText("Entity 1 collision type: "..entity1:GetCollisionType(),2,2)
context:DrawText("Entity 2 collision type: "..entity2:GetCollisionType(),2,22)

context:Sync()
end