this is what I tried:
#include "DarkGDK.h"
#include "DarkPhysics.h"
#include "DarkAI.h"
#include "DarkLights.h"
#include "ShaderData.h"
#pragma comment ( lib, "DarkPhysics.lib" )
#pragma comment ( lib, "DarkAI.lib" )
#pragma comment ( lib, "DarkLights.lib" )
#pragma comment ( lib, "ShaderData.lib" )
void DarkGDK ( void ) {
//Settings
dbSyncOn();
dbPhyStart();
dbPhySetGravity(0,-200,0);
dbSyncRate(60);
dbBackdropOn();
dbPositionCamera(0,0,-10,30);
//Player
dbMakeObjectSphere(1,40);
dbPositionObject(1,0,50,0);
dbColorObject(1, RGB(0,255,0));
//Other Objects
dbMakeObjectBox(2,2000,1,2000);
dbColorObject(2,RGB(126,235,21));
dbMakeObjectCube(3,80);
dbColorObject(3,RGB(255,0,0));
dbPositionObject(3,0,0,30);
dbMakeObjectSphere(4,20);
dbColorObject(4,RGB(255,0,0));
dbPositionObject(4,0,0,-50);
//Setting up physics
dbPhyMakeRigidBodyDynamicSphere(1);
dbPhyMakeRigidBodyStaticMesh(2);
dbPhyMakeRigidBodyStaticMesh(3);
dbPhyMakeRigidBodyStaticMesh(4);
//Get collisions
for( int i=1; i<4; i++)
{
float coly = dbPhyGetCollision(1,i);
}
//Camera
dbRotateCamera(0,90,0,0);
//Loop
while( LoopGDK ( ) ) {
//Declare player position as x,y,z
float x = dbObjectPositionX(1);
float y = dbObjectPositionY(1);
float z = dbObjectPositionZ(1);
float objectexist = dbObjectExist(2);
//Movement
if (dbKeyState(200) == 1) {
dbPhyAddRigidBodyForce(1,0,0,5,2);
}
if (dbKeyState(208) == 1) {
dbPhyAddRigidBodyForce(1,0,0,-5,2);
}
if (dbKeyState(205) == 1) {
dbPhyAddRigidBodyForce(1,5,0,0,2);
}
if (dbKeyState(203) == 1) {
dbPhyAddRigidBodyForce(1,-5,0,0,2);
}
//Jumping (attempt)
if (dbKeyState(57) == 1) {
if (coly == 0) {
dbPhyAddRigidBodyForce(1,0,10,0,2);
}
}
//Position camera to player
dbPositionCamera(0,x,y+300,z);
dbShowObject(2);
//Display x,y,z
dbInk(RGB(250,0,160),RGB(250,0,160));
dbText(0,0,dbStr((int)x));
dbText(0,10,dbStr((int)y));
dbText(0,20,dbStr((int)z));
dbText(0,30,dbStr((int)coly));
dbText(0,40,dbStr((int)objectexist));
//Update Screen and Physics
dbPhyUpdate();
dbSync();
}
}
and it didn't work
I am pretty much trying to use it for checking an object over and over (say object 2-5) for collision, it's much easier than writing out the code for each object.
I want coke, not Pepsi!