For all those who probably have read this topic here is my tip about moving platforms:
#include <DarkGDK.h>
#include <DarkPhysics.h>
#include <dinput.h>
int nGround = 1;
int nPlatform = 2;
void DarkGDK (void)
{
static char msg[256];
float x0, y0, z0;
float range_x, speed_x, angle_x=0.0;
float range_y, speed_y, angle_y=0.0;
float range_z, speed_z, angle_z=0.0;
dbPhyStart();
dbSyncOn();
dbSyncRate(60);
dbSetWindowOn();
dbSetDisplayMode(800, 600, 32);
dbMakeObjectBox(nGround, 50.0, 2.0, 50.0);
dbColorObject(nGround, 0x00FF00);
dbPhyMakeRigidBodyStaticMesh(nGround);
dbMakeObjectBox(nPlatform, 4.0, 0.5, 4.0);
dbColorObject(nPlatform, 0xFF0000);
dbPositionObject(nPlatform, 0.0, 4.0, 0.0);
dbPhyMakeRigidBodyDynamicConvex(nPlatform);
dbPhySetRigidBodyKinematic(nPlatform, true);
dbPositionCamera(0.0, 3.0, -15.0);
range_x = 4.0;
speed_x = 0.0; // 0.0 < speed_x < range_x
range_y = 4.0;
speed_y = 0.1; // 0.0 < speed_y < range_y
range_z = 4.0;
speed_z = 0.0; // 0.0 < speed_z < range_z
x0 = dbObjectPositionX(nPlatform);
y0 = dbObjectPositionY(nPlatform);
z0 = dbObjectPositionZ(nPlatform);
while ( LoopGDK() )
{
dbPhySetRigidBodyKinematicPosition(nPlatform, x0+dbSin(dbWrapValue(angle_x))*range_x*0.5, y0+dbSin(dbWrapValue(angle_y))*range_y*0.5, z0+dbSin(dbWrapValue(angle_z))*range_z*0.5);
angle_x += dbASIN(speed_x/range_x);
angle_y += dbASIN(speed_y/range_y);
angle_z += dbASIN(speed_z/range_z);
dbPhyUpdate();
dbSetCursor(0,0);
sprintf_s(msg, "x: %f", dbObjectPositionX(nPlatform));
dbPrint(msg);
sprintf_s(msg, "y: %f", dbObjectPositionY(nPlatform));
dbPrint(msg);
sprintf_s(msg, "z: %f", dbObjectPositionZ(nPlatform));
dbPrint(msg);
dbSync();
}
dbDeleteObject(nPlatform);
dbDeleteObject(nGround);
dbPhyEnd();
return;
}
If you will play with different values of speed_x, speed_y and speed_z you will get pretty nice results