Introduction
The idea for using 3D or a Physics engine is to reduce the amount of time and lines of code. So you can write your application without implementing the low-level stuff yourself. You can write an application faster, because you can focus on the things specific to your application, rather than every tiny detail about how it's rendered, the physics.
PeaceEngine is written in C++ to optimize speed and performance. It has built-in physics (in the development stage) and integrated 3D graphics with hardware accelerator using OpenGL. PeaceEngine has a standard API for use with various computer programming languages, currently supporting PYTHON, VB.NET and C#.
This example shows how to create a 3D physics simulation and how easy it is to use PeaceEngine.
We will create a little dominoes tower and hit it with a bullet.
To see how it looks go to http://youtube.com/watch?v=S3s6CEKxDrM
static int counter; //We will use it to count rendered frame for adding some liner interactive<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />
static int objcount; // this will counter how much object we created so we can tell engine which the last object we just create
static void drop_object() //this function for droping object to user scene current we use it to shoot the bullet
{
Random Random = new Random(); //create new instance of ramdom class use for generate randomize number
int x; //this is optional this variable for receive value returning from engine it useful for debuging
x = peSetObjPos(10.1f, -6.0f, 10.5f); //tell engine which position we want to create object in word space at X,Y,Z axis
x = peSetObjRot(Random.Next(), Random.Next(), Random.Next(), Random.Next() * 360); //tell engine how much angle of object we want to rotate before create it at X,Y,Z and how much angle value as radiant
x = peSetObjSize(0.5f, 0.5f, 0.5f); // how big of object relate to X,Y,Z axis
x = peSetDensity(2.0f); //is it heavy? o.5 is default value 2.0(bullet) mean 4 time heavier than 0.5(domino) if the volume is equal
x = peCreateObjEx(1); // now we create object here we tell engine what object type(shape) we want to create 0=box, 1 = sphere, 2 = capsule
x = peAddForce(objcount, -100.0f, 0.1f, -100.0f); // tell engine that we want to add force to which object in this case we add to bullet(lastly added) and vector X,Y,Z of force we want object to move(in which direction) more force cause more directional velocity to the subject.
objcount += 1; //we just created it so we will add 1 to our object counter
}
static void CreateTower() //Create domino tower. this function will call when initialize our scene
{
int x; //this is optional this variable for receive value returning from engine it useful for debuging. same as above
int a ; // collumn of tower counter
int k,j,i; // row of tower counters
a = 0; //initialize it
for (k=1;k<=7+1;k++)// we want to create 7 row of domino tower. this for "|" shape of dominos
{
for (i=1;i<=15+1;i++)// we want to create 15 column of domino tower
{
if (i == 15 + 1 - k * 1) // the higher of row have less column
{
break; //Exit For
}// End If
if (i <= a) // the higher of row have less column
{}
else
{
x = peSetObjPos(((i * 0.5f) - 4.9f), -6f, (k * (0.75f)) - 0.45f); //the same as above. we want to create domino and set position related to i,k values. Y axis will be static so just leave it -6.0
x = peSetObjRot(0, 0, 0, 0);
x = peSetObjSize(0.15f, 0.5f, 0.5f);
x = peCreateObjEx(0);
objcount += 1;
} //End If
} //Next i
for (j=1;j<=15+1;j++)// we want to create 15 column of domino tower. this for "--" shape of domino

kalu singh raoPosted Jul 19, 2016, 2:11 AM
Nice...
Vithal WadjePosted Sep 26, 2014, 2:01 PM
super keep it up