hyperPad's Physics Power: How Chipmunk2D Works in Your Games
hyperPad's physics power comes from Chipmunk2D, an open-source 2D physics engine built into the app. You get gravity, collisions, friction, bounce, joints, and springs on iPad without writing any physics code. You set an Object's physics properties, connect Behaviors to apply forces or attach Objects together, and press Play to see the result. Here's what Chipmunk2D brings to hyperPad and what you can build with it.
What is Chipmunk2D?
Chipmunk2D is a mature, MIT-licensed 2D rigid body physics library. Many games and engines use it, including games on iOS. It was designed for fast collision detection and constraint solving, which suits real-time games on mobile devices.
Its main features include:
- spatial partitioning and collision detection
- constraints such as joints, springs, and sliders
- bindings for several programming languages
- sample code and examples on the Chipmunk2D site
Because it's open source, it has had years of fixes and optimization from its community.
How physics works in hyperPad
You set values, and Behaviors do the rest
In hyperPad, you build logic by connecting Behaviors in the Behavior Editor. Physics usually means math and careful tuning. With Chipmunk2D built in, you choose values and the engine handles the simulation.
Each Object has physics properties such as mass, friction, and bounciness (restitution). Physics modes control how each Object takes part in the simulation. Behaviors like Apply Force, Apply Torque, and Set Velocity push Objects during play.
Joints and attachments
Chipmunk2D's constraints show up in hyperPad as attach Behaviors:
- Pivot Attach for hinges, like a swinging door or a wheel
- Spring Attach for bouncy connections
- Rope Attach for ropes and chains
- Weld Attach to lock two Objects together
You can change physics values during play too. Set Bounce, Set Friction, and Set Mass let a power-up turn ice slippery or make a crate heavier.
Quick iteration on iPad
You place an Object, set its collision shape, adjust a value, and press Play. That loop happens on the same iPad, so you can feel the difference a small change makes. Fast feedback is how you find movement that feels right.
Performance on mobile
Chipmunk2D's core is lean and built for real-time simulation, so it's a good fit for mobile hardware. Your Scene still has a budget, though. The number of moving bodies, collisions, and joints all add to the work each frame.
What you can build with physics
- Platformers: slopes, moving platforms, bouncing surfaces, and Objects the player can push.
- Physics puzzles: levers, weights, seesaws, and stacking blocks.
- Arcade action: projectiles, ricochets, and bouncing hazards.
- Breakable structures: welded pieces that come apart when hit hard enough.
- Mechanisms: ropes, chains, pulleys, and spring systems.
Tips for tuning physics
- Change one value at a time. Mass, friction, damping, and restitution all affect each other. Adjust one, test, then move on.
- Watch your body count. Keep the number of moving Objects, collisions, and joints reasonable. Remove Objects the player will never see.
- Edit collision shapes. A collision shape that matches the art closely makes contacts feel fair. The collision editor lets you draw circles, boxes, and polygons.
If you want to understand why a setup behaves the way it does, Chipmunk2D's own documentation explains the concepts behind the simulation.
Build a physics test Scene
Open a new Project and add a ball, a ramp, and a few crates. Give the ball a high bounce value and the crates a heavier mass, then press Play and roll the ball into the stack. Change one value, play again, and keep going until the collision feels the way you want.
