SetFriction

Sets an entity's static and kinetic friction.

Syntax

Parameters

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,0.1,10)
ground:SetColor(0.0,1.0,0.0)

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

--Create a model
entity1 = Model:Box()
entity1:SetColor(0.0,0.0,1.0)
entity1:SetPosition(-2,1,2)
entity1:SetMass(1)
entity1:SetFriction(0,0)
entity1:AddForce(0,0,-200)

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

--Create a second model
entity2 = entity1:Instance()
entity2:SetPosition(2,1,2)
entity2:SetFriction(1,1)
entity2:AddForce(0,0,-200)

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

Time:Update()
world:Update()
world:Render()
context:Sync()
end