I tryed to make some sort of a gravity in DarkGDK so my 3D character would be always touching the ground (another 3D model)
my 3D character is made of 1 box(noticed C++ can't load spheres from .3ds files)
my 3D map is made of a large box.
Problem is: when the 2 3D objects collide, in the middle they would go perfect as they 3D objects don't go into eachother but when I go to the edge they would just go into eachother
Here's the source code I've made so far.
{
int p=1;
dbPositionCamera(0,0,0);
dbLoadObject("3D Models//model.3DS",1);
dbPositionObject(1,0,5,-3);
dbSetObjectCollisionToPolygons(1);
dbLoadObject("3D Models//map.3DS",2);
dbPositionObject(2,0,0,0);
dbSetObjectCollisionToPolygons(2);
dbLoadImage("3D Models//AI.JPG",1);
dbTextureObject(1,1);
dbLoadImage("3D Models//ME.JPG",2);
dbTextureObject(2,2);
while (p)
{
if (dbEscapeKey()) p=0;
dbPositionObject(1,dbObjectPositionX(1),dbObjectPositionY(1)+10,dbObjectPositionZ(1));
if(dbUpKey()) dbMoveObject(1,+0.1);
if(dbDownKey()) dbMoveObject(1,-0.1);
while (!dbObjectCollision(1,2))
{
dbMoveObjectDown(1,0.1);
}
dbPositionCamera(dbObjectPositionX(1),dbObjectPositionY(1)+3,dbObjectPositionZ(1)-10);
dbSync();
}
dbDeleteObject(1);
dbDeleteObject(2);
dbDeleteImage(1);
dbDeleteImage(2);
}