Gamestudio/A7 Physics 

Gamestudio/A7 contains a physics subsystem partially based on the Open Dynamics Engine (ODE), which allows for realistic motion of models. It supports rigid bodies, meaning that the 3d models will not deform during simulation or upon impact. From version A8 on, Gamestudio uses a different physics system based on the PhysX engine.

Because this type of simulation is CPU intensive, the physics subsystem is disabled by default. When you wish to use it, you have to register physical entities and then enable them for simulation. This means you delegate exclusive motion control of these objects to the engine. When you no longer need a physical entity, you should unregister it or disable the physics system. While it may be tempting to simply register every object in your game as a physical entity, we strongly advice against it because of performance reasons.

Whenever motion is simulated using physical approximations, there is a risk of "explosions". Basically this means that your objects will do unexpected things such as flying off at full speed. Reasonable effort has been put into the physics subsystem to prevent these explosions, but a 100% failsafe method is not feasible. Despite all of these warnings simulated physics is a great way to spice up your game by allowing the player to immerse himself into this artificial environment doing new and unexpected things. See the Physics FAQ page for any problems you might encounter.

As with all collisions, the level must sit in a hollowed sky block for physics collisions to work. Non-physics objects must not collide with physics objects, but physics objects can collide with non-physics objects. You can find physics examples - a car driving over terrain or a crane to pick up items from the ground - on the download page.

Functions Overview

There are three function categories dealing with the control of physical objects in Gamestudio:
ph_ Global functions that change the behavior of the physics simulator or the simulated world
phent_ Physical entity functions which operate on a single entity at a time
phcon_ Constraint functions, which limit the movement of physical entities

Entity Functions

Only 3D entities such as MDL or WMB models can become physical entities. The basic steps in setting up a physical entity are:

1.Create the entity using ent_create or setting it up in WED
2.Move the entity to its desired starting position
3.Call phent_settype to inform Gamestudio that you want this object to be controlled by the physics subsystem
4.Set the object's attributes ( phent_setmass, phent_setdamping, phent_setgroup )
5.Set gravity using ph_setgravity.
6.Enable the physics subsystem by calling ph_selectgroup.

Disclaimer

Open Dynamics Engine
Copyright (c) 2001- 2008, Russell L. Smith.
All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

Neither the names of ODE's copyright owner nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

 

► latest version online