Rigid Body Roller Coaster

previous next


This physics-based simulation shows a rigid body attached to a curved "roller coaster" path. Uses the myPhysicsLab 2D Rigid Body Physics Engine.

Click with your mouse to apply a spring force to the block. Several path shapes are available. Try changing gravity or damping.

This simulation uses the same math shown on the roller coaster page to make a numerical table of the path data. A special kind of joint connector called PathJoint is used to connect the rigid body to the path.

The "circle" path has a PathEndPoint which stops the movement of the PathJoint from going past the top of the circle. The PathEndPoint is not required, it is added as a demonstration.

The "hump" path has two PathEndPoints, and also defines a GenericMemo which disconnects the block when it moves past a certain spot on the path.

Also available: source code, documentation and how to customize.

This web page was first published November 2016.

previous next Valid HTML 4.01