![]() |
Rune Engine
Version 0.2.7-alpha
Documentation for how to make games using the Rune Engine.
|
Adding physical interactions is an important and fun part of making your game! In Rune, adding physics is as simple as attaching a physics::RigidBody component to your rune::GameObject.
In your GameObject constructor, you will be required to initialize the RigidBody in one of two ways. One way is by doing nothing, this will create a RigidBody component with infinite mass that isn't allowed to move, but other RigidBodies will collide with happily.
If you would like to have your object move, you will need to specify the mass of the RigidBody. You can do this like so:
After you have initialized a RigidBody in your GameObject header file, go ahead and apply it to the GameObject. Remember that both of the arguments in the RigidBody constructor are optional, and can be left out completely. Refer to the physics::RigidBody page for more information about these parameters.
Now your object will be subjected to gravity and collisions!