I'm beginning to suspect that this forum doesn't like me.
Any time I try to include something using the 'Code:' section, the code is non-displayable.
Any attempts to attach a zip file cause a non-forum specific error page when I submit the post. It states 'The page cannot be displayed'. The zip file is 936KB in size, under the specified maximum. I have tried in various browsers (including your basic Internet Explorer).
When I posted to the 'DarkSDK Bugs' thread, even though I can see my post in the page, the summary page doesn't indicate my post (in the 'Last Post@' column). I do a complete refresh regularly to see what comes up new and other posts trigger changss in 'Last Post@'. This appears be a bug in the forum software for threads that have more than one page. The same phenomenon can be observed in the 'SDK Update' thread.
A previous thread, using a more complete (ie. complex) version of the sample has had people some viewers, but no help or suggestions offered.
I would really like some help with my problem, or recognition that it is a bug (which will hopefully be fixed).
Here it is again:
I have run into two, possibly related, problems. Fixing either would allow me to build my games easier (I can brute force a solution, but would rather to it properly).
1. The dbLimbAngleY function does not return the proper value, even when the limb is clearly changing angle
2. The dbObjectPosition<X><Y><Z> and dbObjectAngle functions do not return values for an object that is glued to a limg, even when the object is moving
I will send the model and .Net project to anyone interested in looking into this.
The only headers needed are the standard DarkSDK and C++ ones. So this code is easily tested in VC6 as well.
The model was built with 3ds max 6 and converted to .x using Deep Exploration.
I have tested this under both Windows 2000 and Windows XP Pro, both with all the latest patches and both with the latest DirectX.
#include "DarkSDK.h"
#include <stdlib.h>
#include <stdio.h>
#include <stdarg.h>
// key scan codes of interest
#define ciScanCode_P 25
// set id values for objects
int modid=20;
int objid=30;
int lmbid=2;
// for anyone not familiar with using variable
// number of argumentsthe ',...' does NOT
// indicate missing parameters
// it is the convention used to indicate a
// variable number of parameters
// the 'va_*' functions access the extra
// parameters so that the 'vsprintf'
// function uses them
void doDbText(int& yloc,const char* format,...)
{
char szTxt[1024];
va_list marker;
// initialise variable arguments
va_start(marker,format);
// build local string
vsprintf(szTxt,format,marker);
// close it off
va_end(marker);
// write it out
dbText(10,yloc,szTxt);
// update the y location
yloc += 14;
}
void DisplayInformation()
{
float lx,ly,lz,la;
float ox,oy,oz,oa;
int yloc=10;
int fps=dbScreenFPS();
// get information about the limb
lx = dbLimbPositionX(modid,lmbid);
ly = dbLimbPositionY(modid,lmbid);
lz = dbLimbPositionZ(modid,lmbid);
la = dbLimbAngleY(modid,lmbid);
// get information about the objid object
ox = dbObjectPositionX(objid);
oy = dbObjectPositionY(objid);
oz = dbObjectPositionZ(objid);
oa = dbObjectAngleY(objid);
// set color
dbInk(dbRGB(255,255,0),dbRGB(255,255,255));
// show frames per second
doDbText(yloc,"FPS=%d",fps);
// output instructions
doDbText(yloc,"'P' key to animate object");
doDbText(yloc," and show limb/object movement");
// output frame information
doDbText(yloc,"object#=%d limb=%d",modid,lmbid);
doDbText(yloc,"frames=%d",dbTotalObjectFrames(modid));
doDbText(yloc,"current=%5.2f",dbObjectFrame(modid));
// output limb position
doDbText(yloc,"limb x=%.1f z=%.1f",lx,lz);
doDbText(yloc,"limb y=%.1f angle=%.1f",ly,la);
// output object position
doDbText(yloc,"object x=%.1f z=%.1f",ox,oz);
doDbText(yloc,"object y=%.1f angle=%.1f",oy,oa);
}
void DarkSDK(void)
{
// set the desired display mode (if available)
if (dbCheckDisplayMode(640,480,16)) dbSetDisplayMode(640,480,16);
// turn on synchronisation and set rate
dbSyncOn ();
dbSyncRate(60);
// set the directory for stuff
dbSetDir("media\\");
// load model to be tested
dbLoadObject("testmodel.x",modid);
dbPositionObject(modid,100.0f,0.0f,100.0f);
// make a thing to attach to limb
dbMakeObjectBox(objid,0.5f,10.0f,1.0f);
dbGlueObjectToLimb(objid,modid,lmbid);
// initialise camera position
dbPositionCamera(56.0f,42.5f,56.0f);
dbYRotateCamera(45.0f);
while (LoopSDK())
{
// check for one kind of break
if (dbEscapeKey()) break;
switch (dbScanCode())
{
case ciScanCode_P:
dbSetObjectSpeed(modid,10);
dbPlayObject(modid);
break;
}
// show stuff
DisplayInformation();
// update display
dbSync();
}
// stop playing if in motion
if (dbObjectPlaying(modid)) dbStopObject(modid);
// remove the object
dbDeleteObject(modid);
}
Cheers,
Ancient Lady