You are viewing PyUnity docs under the develop branch. As such, they are only applicable if you installed from source. Go to for the most recent release.

pyunity.physics package


Module contents

A basic 3D Physics engine that uses similar concepts to the Unity Engine itself. Only supports non-rotated colliders.

To create an immoveable object, use math.inf or the provided Infinity variable. This will make the object not be able to move, unless you set an initial velocity. Then, the collider will either push everything it collides with, or bounces it back at twice the speed.


>>> cube = GameObject("Cube")
>>> collider = cube.AddComponent(BoxCollider)
>>> collider.SetSize(,
>>> collider.velocity = Vector3.right()


If you want to change some configurations, import the config file like so:

>>> from pyunity.physics import config

Inside the config file there are some configurations:

  • gravity is the gravity of the whole system. It only affects Rigidbodies that have Rigidbody.gravity set to True.