A simple set of tutorials for getting up and running with physics in Babylon.js using Ammo.js physics engine. The following is the list of tutorials done so far.
- Simple Box (single box falling under gravity)
- Multiple Boxes (multiple boxes falling under gravity)
- Shooting (shows how to make a ball shoot in the viewing direction)
- Simple Joint (simple distance joint)
- Simple Ball (simple roll ball physics)
- Picking (raycast to pick meshes on mouse click)
- Bridge (simple bridge using hinge joints)
- Cloth (simple cloth modeled using soft body physics)
- Vehicle (simple car modelled using raycast physics)
- Tank (simple tank modelled using raycast physics)
Following are the details of the tutorial demos.
Shows how to add a single rigid body - Live Demo - Babylon.js Playground
Shows how to add multiple rigid bodies - Live Demo - Babylon.js Playground
Shows how to handle the left mouse click to launch projectile in the viewing direction for shooting balls on the boxes - Live Demo - Babylon.js Playground
Shows how to add a simple point to point constraint - Live Demo - Babylon.js Playground
Showing how to create rolling ball physics. This demo shows you how to make a ball roll on the ground using the keyboard keys
Press 'w' to roll ball forward
Press 's' to roll ball backward
Press 'a' to roll ball to the left
Press 'd' to roll ball to the right
Live Demo - Babylon.js Playground
Shows how to use the left mouse button to pick a rigid body - Live Demo - Babylon.js Playground
Shows how to use the hinge joint to make a bridge - Live Demo - Babylon.js Playground
Shows how to make a cloth softbody - Live Demo - Babylon.js Playground
Shows how to make a vehicle
Press 'w' to accelerate the car forward
Press 's' to decelerate the car backward
Press 'a' to turn the car left
Press 'd' to turn the car right
Live Demo - Babylon.js Playground
Shows how to make a tank using raycast vehicle. This demo is based on the excellent open source project: https://github.com/RuanLucasGD/Simple-Militay-Tank-Physics. The tank rig is also from the same repo. so a huge shout out to RuanLucasGD. The fbx was converted to gltf using the 3dsmax babylon exporter.
Press 'w' to accelerate the tank forward
Press 's' to decelerate the tank backward
Press 'a' to turn the tank left
Press 'd' to turn the tank right
Press 'q' to lower the gun down
Press 'e' to lift the gun up
Press 'z' to turn the turret left
Press 'c' to turn the turret right
Live Simple Tank Demo - Babylon.js Playground
Click the image below to watch a youtube capture of the tank demo.
Live Simple Tank Demo with Tracks using TrailMesh - Babylon.js Playground with Tracks using TrailMesh