Hi Vladislav, there are a few issues here.
First of all you have to add your shapes to the simulation using FulcrumPhy::makeBox(). As you are moving them yourself you also need to make them kinematic, FulcrumPhy::setKinematicOn().
You need to call getPhysicsResults() and simulate() in your main loop.
I presume you think that the raycast command takes two points in space and casts a ray between them, this is not the case. A ray needs a starting position and a direction, the direction is a vector, eg(0, 1, 0) is straight up.
Also, it would be useful to know what your aim is, why do you need the shape of the face the ray hits?
Anyway, retrieving the face normals will not give you the height or width of the face, the normals will give you direction the face is pointing only, remember that this is also in vector form.
There is only one ray, you cast it and then store(or deal with) any results you obtain and then cast it again.
The following should get you started:
/////////////////////////////////////
//VLADISLAV VALENTINOV 2010
#include "DarkGDK.h"
#include "FulcrumPhy.h"
FulcrumPhy WRECK_PHYSICS;//WRECK IS THE NAME OF MY PROJECT(RPG)
//VARS//---
int MAIN_ID=1,SATA_NUM=15;//CHANGE NUMBER OF SATELITES HERE
int NORMAL_HEIGHT=0,SCALE_FACTOR=15;//RECTANGLE SCALE FACTOR
float SAT_ANGLE=0,SAT_SPEED=0.5,SAT_DISTANCE=16.0,CAST_ANGLE=90;
bool DO_WIREFRAME=0;
//---
float SAT_X(float _ANGLE)
{
return dbSin(_ANGLE)*SAT_DISTANCE;
}
float SAT_Z(float ANGLE_)
{
return dbCos(ANGLE_)*SAT_DISTANCE;
}
//---
void DarkGDK ( void )
{
dbColorBackdrop(dbRGB(0,0,0));
WRECK_PHYSICS.start(true);
WRECK_PHYSICS.setGravity(0,-9.8,0);
dbSyncOn ( );
dbSyncRate ( 60 );
WRECK_PHYSICS.simulate();
//-----
srand(dbTimer());
for(int _p=MAIN_ID;_p<=MAIN_ID+SATA_NUM;_p++)
{
if(_p>MAIN_ID)
dbMakeObjectBox(_p,4,(rand()%10)+2,4);
else
dbMakeObjectBox(_p,4,4,4);
WRECK_PHYSICS.makeBox(_p, true);
WRECK_PHYSICS.setKinematicOn(_p);
dbColorObject(_p,dbRGB((rand()%255)+1,(rand()%255)+1,(rand()%255)+1));
}
//RAY visualization
dbMakeObjectTriangle(MAIN_ID+SATA_NUM+1,dbObjectPositionX(MAIN_ID),dbObjectPositionY(MAIN_ID),dbObjectPositionZ(MAIN_ID),
dbObjectPositionX(MAIN_ID),dbObjectPositionY(MAIN_ID),dbObjectPositionZ(MAIN_ID),dbObjectPositionX(MAIN_ID)+SAT_X(CAST_ANGLE),
dbObjectPositionY(MAIN_ID),dbObjectPositionZ(MAIN_ID)+SAT_Z(CAST_ANGLE));
dbSetObjectWireframe(MAIN_ID+SATA_NUM+1,1);
dbColorObject(MAIN_ID+SATA_NUM+1,dbRGB(255,0,0));
//CAM//--
dbPositionCamera(30,25,30);
dbPointCamera(dbObjectPositionX(MAIN_ID),dbObjectPositionY(MAIN_ID),dbObjectPositionZ(MAIN_ID));
//--
while ( LoopGDK ( ) )
{
WRECK_PHYSICS.getPhysicsResults();
if(SAT_ANGLE==360)SAT_ANGLE=0;
SAT_ANGLE+=SAT_SPEED;
//
for(int _h=MAIN_ID+1;_h<=MAIN_ID+SATA_NUM;_h++)
{
dbPositionObject(_h,dbObjectPositionX(MAIN_ID)+SAT_X(SAT_ANGLE+((_h-1)*(360/SATA_NUM))),dbObjectPositionY(MAIN_ID),dbObjectPositionZ(MAIN_ID)+SAT_Z(SAT_ANGLE+((_h-1)*(360/SATA_NUM))));
if(dbObjectCollision(MAIN_ID+SATA_NUM+1,_h)==1)
{
DO_WIREFRAME=1;
NORMAL_HEIGHT=dbObjectSizeY(_h);//NEED THE NORMALS HEIGHT,NOT THE OBJECTS(BECAUSE OF COMPLEX TRIANGLE MESHES);
dbBox(dbScreenWidth()-(10+(4*SCALE_FACTOR)),10,dbScreenWidth()-10,10+(NORMAL_HEIGHT*SCALE_FACTOR));
}
else
DO_WIREFRAME=0;
dbSetObjectWireframe(_h,DO_WIREFRAME);
}
//RAYCAST(HELP!!!)
//I WANT TO GET THE DISTANCE OR SOMETHING
int objID = WRECK_PHYSICS.raycast(dbObjectPositionX(MAIN_ID),dbObjectPositionY(MAIN_ID),dbObjectPositionZ(MAIN_ID), dbSin(90),
0 , dbCos(90));
float rayDist = WRECK_PHYSICS.getRayDistance();
float rayNormalX = WRECK_PHYSICS.getRayImpactNormalX();
float rayNormalY = WRECK_PHYSICS.getRayImpactNormalY();
float rayNormalZ = WRECK_PHYSICS.getRayImpactNormalZ();
char* objIDText = dbStr(objID);
dbText(10, 10, objIDText);
delete []objIDText;
char* rayDistText = dbStr(rayDist);
dbText(10, 20, rayDistText);
delete []rayDistText;
char* rayNormalXText = dbStr(rayNormalX);
dbText(10, 30, rayNormalXText);
delete []rayNormalXText;
char* rayNormalYText = dbStr(rayNormalY);
dbText(10, 40, rayNormalYText);
delete []rayNormalYText;
char* rayNormalZText = dbStr(rayNormalZ);
dbText(10, 50, rayNormalZText);
delete []rayNormalZText;
WRECK_PHYSICS.update();
WRECK_PHYSICS.simulate();
dbSync ( );
}
WRECK_PHYSICS.stop();
return;
}
FulcrumPhy::makeBox() failed for me a few times running this code, this has never happened before and I've used this command alot. I have never used it making random box sizes though, I will look into this issue although I just ran it about ten times without it happening

.
Let me know if you get this issue, a workaround might be to create your random numbers differently.
Lastly, I changed the way you call dbStr(), this command uses memory and if you don't get a pointer to this memory there is no way to ever delete it.
Hope this helps, it would be useful to know exactly what you are trying to do. This would make a good raycast demo, I may add a feature to draw the ray, similar to what you have done.
Good luck.