@monotonic
Yep, I have all that in my code, I basically converted the DBPro Character Controller demo to DGDK.
#include "DarkGDK.h"
#include "DarkPhysics.h"
void MakeCharacterJump(void);
// the main entry point for the application is this function
void DarkGDK ( void )
{
// This program shows how to load an FPS Creator level
// and walk around it using the character controller
float OldCamAngleX, OldCamAngleY, CameraAngleX, CameraAngleY;
int key;
// Set up general properties
dbSyncOn();
dbSyncRate(0);
dbAutoCamOff();
dbPhyStart();
dbPhySetGravity(0,9.81,0);
dbSetCameraRange(0.5, 30000);
dbHideMouse();
//dbSetWindowOff();
// Move into the media directory
dbSetDir("media");
// Load the level and make a static mesh for it
dbLoadObject("universe.dbo", 1);
dbSetObjectLight(1, 0);
dbPhyMakeRigidBodyStaticMesh(1);
// Load our skybox
dbLoadObject("skybox2.x", 2);
dbSetObjectLight(2, 0);
dbSetObjectTexture(2,3,1);
dbScaleObject(2,30000,30000,30000);
// Come out of the media directory
dbSetDir("..");
// Create our box controller
dbMakeObjectBox(3,20,50,20);
dbPhyMakeBoxCharacterController(3,434,42,-517,10,35,10,1,10.5,45.0);
dbHideObject(3);
// Add some gravity type displacement to the forward and backwards movement
// Stops the character from flying if pointed upwards
dbPhySetCharacterControllerDisplacement(3,1000,1000);
// Display Dark Physics logo
dbLoadImage("logo.png",100000);
dbSprite(1,0,600-60,100000);
// Our main loop
while (LoopGDK())
{
// Display instructions
dbSetCursor(0, 0);
dbPrint("Using Dark Physics for collision detection of an FPS Creator level");
dbPrint("Use the arrow keys and mouse to move around");
// Rotate and position the camera based on the box controller
dbPositionCamera(dbObjectPositionX(3),dbObjectPositionY(3)+20, dbObjectPositionZ(3));
dbRotateCamera(dbObjectAngleX(3),dbObjectAngleY(3), dbObjectAngleZ(3));
OldCamAngleY = CameraAngleY;
OldCamAngleX = CameraAngleX;
CameraAngleY = dbWrapValue(CameraAngleY + dbMouseMoveX()*0.4);
CameraAngleX = dbWrapValue(CameraAngleX + dbMouseMoveY()*0.4);
dbYRotateObject(3, dbCurveAngle(CameraAngleY,OldCamAngleY,24));
dbXRotateObject(3, dbCurveAngle(CameraAngleX,OldCamAngleX,24));
// React to key presses and move the controller
key = 0;
if(dbUpKey())
{
key = 1;
dbPhyMoveCharacterController(3,200);
}
if(dbDownKey())
{
key = 1;
dbPhyMoveCharacterController(3,-200);
}
if(!key)
{
dbPhyMoveCharacterController(3,0);
}
// Update the simulation and screen
dbPhyUpdate();
dbSync();
}
}
Quote: "
If you have no movement to make you must still call it using 0.0 as the movement speed. This will make the character controller respond to gravity.
"
The character controller does not respond to gravity, at least not the gravity defined in the physics. That was the point I was trying to make in my last post, the physics is all being simulated. There is a small downward force simulation but it does not corresspond to the physics settings at all.
And if you point your character upwards and move forwards your character flys. Stop moving and it drops at a very slow rate. So to simulate real gravity (i.e where characters don't fly) you need to play with the displacement values as I did in the code above.
Out of interest have you implemented jumping?
No matter how good your code is, someone will improve on it