3DS Physics Sandbox

From GameBrew

3DS Physics Sandbox
Last Updated2016/08/06

3DS Physics Sandbox is a homebrew that allows you to play around in an environment with simple physics.


  • Manipulate multiple different sized squares with the stylus.
  • Objects will bounce off of each other.
  • The squares are affected by gravity, with walls and friction.
  • Modifiable gravity, collision elasticity, and friction values.
  • Collisions calculation uses momentum of squares.
  • Take a screenshot.
  • Control gravity by tilting 3DS (accelerometer).
  • Move camera with circle pad.
  • Walls that squares will bounce off of.
  • Different squares and walls can be made using on screen UI.



Available in 3DSX and CIA formats.

  • CIA - Install the .cia with the CIA manager of your choice.
  • 3DSX - Use the .3dsx provided with the Homebrew Launcher.


This requires sf2dlib and expects the libsf2d directory to be in the same directory as 3dsphysicssandbox. Just run the makefile to build.


Tap and Drag square - Move square

X - Reset entire world

B - bring selected square back to center of world

D-Pad Left/Right - Change modifiable value

D-Pad Up/Down - Increment current modifiable value

L/R - Change increment (multiply and divide by 10)

Circle Pad - move camera

Y - toggle gyroscope as gravity

Select - Save screenshot

Start - Exit


3DS Physics Sandbox v0.3 (PieFace)

Known issues

If squares are traveling fast enough, they can clip through walls (more apparent in smaller squares).

Sometimes squares get crushed against vertical walls because of x gravity.



  • Added support for up to 32 squares.
  • Added walls, immobile objects(lines) that objects bounce off of (up to 32).
  • Removed square bouncing on edges of screen (by default replaced by walls in the same locations).
  • Added camera, use circle pad to move view around.
  • Updated UI:
    • Now contains two columns of information, global variables and object specific variables.
    • Change the mod_val scope to switch between these two.
    • All data of squares and walls can be modified (position, size, etc).
    • Use obj_type to change between squares and walls.
    • Use curr_view to change which object you are looking at.
    • Use coord to change the objects position.
    • Use vel.x/y to change the square's velocity.
    • Use direction to change wall's direction.
    • Use length to change the objects size.
    • NOTE: the program stops searching through the array when it finds the first inactive object. Add new objects in order.
  • Press X to reset the entire world to default.
  • Press B to bring the currently selected square to the center of the world.
  • Started modularization of code.
  • Collision now takes momentum into account (more realistic collisions).


  • Press Y to toggle using gyroscope as gravity , or allow the square to follow tilt of 3DS.
  • Press select to take a screenshot (needs optimization).
  • Friction now takes into account appropriate gravity, resulting in mostly increased friction at the default value.
  • Fixed precision bug with increment.


  • Bugs fixed, banner added, v0.1 finalized.


  • Smealum - creator of ctrulib and the homebrew menu.
  • xerpi - creator of sf2dlib.

External links