Skip to content

Physics Friction

App: apps/physics_friction/

Shows how Jolt’s friction coefficient affects dynamic rigid bodies on an inclined ramp. Boxes with different friction settings are placed at the top; R resets them to their starting positions.

Terminal window
% ./plume3d physics_friction
  • Loads Models/FrictionDemo.blend and instantiates GameCamera, GameLight, Environment (inclined ramp, static), and boxes with varying friction values (e.g. Box_Low, Box_Med, Box_High).
  • Tracks each box node and its initial position for resetting.
  • R — resets all boxes: node.setPosition, Physics.setLinearVelocity(..., 0,0,0), Physics.setAngularVelocity(..., 0,0,0), Physics.activate.
  • Shadow mapping enabled: light.castsShadows = true, Graphics.setShadowMappingEnabled(true).
if (Input.keyJustPressed("r")) {
for (i in 0..._boxes.count) {
var box = _boxes[i]
var pos = _initialPositions[i]
box.setPosition(pos[0], pos[1], pos[2])
Physics.setLinearVelocity(box, 0, 0, 0)
Physics.setAngularVelocity(box, 0, 0, 0)
Physics.activate(box)
}
}

Create Models/FrictionDemo.blend in Blender with the Plume3D addon:

ObjectDescriptionRigid Body
Ramp planeInclined static surfacePassive, Box, layer Ramp
Box_LowLow friction (e.g. 0.1)Active, Box, layer Boxes
Box_MedMedium friction (e.g. 0.5)Active, Box, layer Boxes
Box_HighHigh friction (e.g. 0.9)Active, Box, layer Boxes
CameraGameCamera
LightGameLight

Set friction on each box via Blender’s Rigid Body > Surface Response panel.

  • PhysicssetLinearVelocity, setAngularVelocity, activate.
  • ResourceloadBlend.
  • GraphicssetLights, setShadowMappingEnabled.
  • LightcastsShadows.