Spielerhöhe automatisch anpassen/automaticly adjust altitude

Get technical support about the C++ source code and about Lua scripts for maps, entities, GUIs, the console, materials, etc. Also covered are the Cafu libraries and APIs, as well as compiling, linking, and the build system.
Post Reply
denis_marasovic
Posts:4
Joined:2004-11-24, 16:01
Spielerhöhe automatisch anpassen/automaticly adjust altitude

Post by denis_marasovic » 2004-11-24, 16:17

Ich entwickele ne kleine 3d-Engine zum testen unter directgraphics9 und will damit einfache bis mittelkomplexe levels darstellen.

Das klappt soweit sogut. Das sortieren der Polygone wird mittels BSP-Bäumen erledigt, und jene Bäume werden auch für den Kollisionstest verwendet.

Ich berechne,von der kamera ausgehend, einen "strahl" nach allen Richtungen. Wenn das Ende des Strahls sich "in der Verbotenen" Zone befindet erfolgt eine Kollision und die Kamera wird nicht bewegt.

Was mir jetzt noch fehlt ist ein Algorithmus für die automatische Anpassung der Spielerhöhe über dem "Fussboden".
Denn jetzt ist es so, das sich der Spieler nur auf der XZ-Ebene bewegt, was nicht gut ist.

Ich stelle mir das mit der Anpassung , inetwa so vor:

Man berechnet einen Strahl der lange genug ist nach unten.
dann wird geprüft welches das erste Leaf unter den Füßen des Spielers/camera ist(es könenn ja mehrere Konvexe Räume übereinander sein).
Man nimmt dem Schnittpunkt vom Ende des Strahls mit der Ebene des allernächsten Polygones/leafs und addiert einen Wert darauf welcher die Höhe des Spielers über dieses Polys/leafds definiert.

Naja.. die Theorie klingt leider einfacher als die Praxis.

Habt ihr vielleicht einige Lösungsvorschlöge in Form von Algorithmen oder Pseudocodes.

danke für kommende antworten.

sorry, i can#t explain this whole question in english!
User avatar
Thrawn
Posts:302
Joined:2004-08-30, 10:38
Location:NRW, Germany
Contact:

Post by Thrawn » 2004-11-24, 21:39

Wrong forum? This is a Carsten's 3D engine specific coding forum. You should go to an gamedev board or something like that ;)
User avatar
Carsten
Site Admin
Posts:2170
Joined:2004-08-19, 13:46
Location:Germany
Contact:

Post by Carsten » 2004-11-24, 23:13

Hello Denis, welcome to the Ca3DE forum.
Well... the problem is that Stormtrooper is right:
a) This is an English-only forum, as that is the common language of our international members. I'd guess that more than 90% of all those who read your post didn't get a single word. Writing good English is tedious for most of us, btw. ;-)
b) This indeed is not the place for general game programming questions.

Here are some clues to your problem anyway:
Your basic approach sounds right, but does not generalize well. Tracing axis aligned bounding boxes (AABBs, i.e., volumes) through BSP trees is inherently much more difficult than tracing infinitely thin rays.
Search Google Groups for the keywords "aabb kekoa", and read everything by Kekoa Proudfoot on that matter. He explains it very well. But be prepared for some intense stuff. You have been warned. :)
The direct link to the groups search is http://groups.google.de/groups?hl=de&lr ... btnG=Suche
There also used to be really advanced stuff at http://www.xp-cagey.com/ but it seems that the site is currently down.

Another option is to be more precise by what you meant with "the theory is simpler than the implementation". As mentioned above, your approach does still sound basically right.
Best regards,
Carsten
User avatar
Shadow
Posts:195
Joined:2004-08-28, 06:00
Location:Minesota, USofA
Contact:

Post by Shadow » 2004-11-26, 02:50

i live in the USA and i still have trouble writing decent english lol
If i knew wut u wanted to know i prolly could help you but :P
Image
PBX CONTINUES!!!
CLICK HERE!!
RAZOR
Posts:17
Joined:2004-08-23, 07:44
Location:New Zealand

Post by RAZOR » 2004-11-26, 04:35

Hmm, I wonder if I'm the only one here who has english as a first language but still knows German. Well a bit of german anyway...

Perhaps I can translate the basic question:

I'm developing a small testing 3d engine using directX 9 and want to run simple - medium complexity levels on it.

So far so good. The sorting of polygons is done using a bsp tree which will also be used for collision.

What I'm missing is an algorithm to keep the player at the right height over the "floor".
At the moment the player only moves on the x and z axes, and that's not good.

I'm thinking of doing it something like this:
You trace a ray downwards.
Then you work out which is the first leaf under the player/camera's feet (there can be several convex rooms on top of each other).
Then you take the intersection point on the ray (gets tough to translate here) and the one with the very next polygon/leaf and add a weight based on the height of the player over the polys/leafs.

Yea well.. easier said than done.

Any algorithmic or pseudo code solutions perhaps?

Thanks in advance.

Tut mir leid, ich kann deise ganze frage nicht in deutsch erclaren.

Ok, so I ended up translating the whole thing (even the bit in english) but at least now you know if you want something translated so it sounds natural, you can just ask me. You guys mostly do it pretty well though... But I can probably do it faster, it's easier my way around.
No-one quite knows why I'm here...
denis_marasovic
Posts:4
Joined:2004-11-24, 16:01

problem

Post by denis_marasovic » 2004-11-26, 08:28

For the first i think a simple ray that goes from the camera to the ground is enough. Than the intersection between the first Polygon under the player/Camera and the Ray musbt be calculated. Ands finally a constant musst be added(to the calculation) to define the "Player-altitude" from the ground.


"theory is simpler than..."

I mean with that sentence, im not sure how to implement this(above).

thx denis
User avatar
Carsten
Site Admin
Posts:2170
Joined:2004-08-19, 13:46
Location:Germany
Contact:

Post by Carsten » 2004-11-26, 12:17

Denis, the problem with your question is that you provide by far not enough details for us to be able to help you.

Your question reduces to tracing a ray through a BSP tree.
I'd post the code that does this for Ca3DE, but you'd probably have more trouble with it than it gives answers.

Thus, I searched Google for "trace ray bsp tree", and found e.g. http://www.nathanostgard.com/tutorials/ ... collision/
Searching Google Groups for the same keywords yields
http://groups.google.de/groups?hl=de&lr ... btnG=Suche
Please read what you find there!
Another Google Groups search for the same keywords + "kekoa" yields
http://groups.google.de/groups?q=trace% ... a=N&tab=wg
As mentioned earlier, please read all those posts (at least on the first results page). They are highly educative.

Denis, I'm sorry for not being able to provide a better answer. I also don't want to tease or worry you. However, you should thoroughly learn to use Google and Newsgroups all by yourself. That's for your own good, and it will help you with future questions. Many people get really upset these days if you ask questions that are already answered elsewhere. And often they are right -- you really could have typed "trace ray bsp tree" into Google yourself. See http://www.catb.org/~esr/faqs/smart-questions.html for more details.
Once more, let me point out that no personal offense is meant.
Best regards,
Carsten
User avatar
Carsten
Site Admin
Posts:2170
Joined:2004-08-19, 13:46
Location:Germany
Contact:

Post by Carsten » 2004-11-26, 12:24

RAZOR wrote:[...] but at least now you know if you want something translated so it sounds natural, you can just ask me. You guys mostly do it pretty well though... But I can probably do it faster, it's easier my way around.
Good to hear that -- thanks!! :)
Best regards,
Carsten
denis_marasovic
Posts:4
Joined:2004-11-24, 16:01

problem

Post by denis_marasovic » 2004-11-27, 13:46

Thank Carsten for the Q3-Collision-Tutorial.

General Information:

The graphical output ,of my 3d-engine,is done by DirectX 9(DirectGraphics9).

The BSP-Tree is Solid Leaf and the tree has been builded during loading(self-definded level-format) the Level-geometry.

I know ,you are right, this problem description is to general.

What details ,you think, are missed in my description?


Carsten. I have studied(from an older enginedownload) the physics.cpp file, which contain the function GroundMove().

This function is responsible that the player "stay on ground/walk an ground" ? I will also realise such functionality to my camera.

I can later,,in the next days, post code-fragments of my engine where are responsible for collission detection(camera-class,bsp-tree-builder).


Thanks for the answer


ps. I wrote in my first posting that my camera can only be moved in the xz-plane(collision worked in all directions, but "only" the plajey-height is not adjusted an the ground). I assume you now that the coordinate-system in DirectX is different than in OGL/QuakeLevel-format. The y-axies shows top/down(in DirectX) in quake,i think, forward/backward?!
User avatar
Shadow
Posts:195
Joined:2004-08-28, 06:00
Location:Minesota, USofA
Contact:

Post by Shadow » 2004-11-28, 03:00

thats not hard to fix
just do something like this
x=qz*scale
y=qx*scale
z=qz*scale
it think it should work
Image
PBX CONTINUES!!!
CLICK HERE!!
User avatar
Carsten
Site Admin
Posts:2170
Joined:2004-08-19, 13:46
Location:Germany
Contact:

Re: problem

Post by Carsten » 2004-11-28, 12:10

denis_marasovic wrote:What details ,you think, are missed in my description?
Everything that helps us to help you, and to do so fast.
The limited ressource of most people, including myself, is time. So e.g. if you post some data structures and code fragments, both reduced to a minimum to show your problem, you have a good change that someone throws the missing pieces in. ;)
[...] GroundMove(). This function is responsible that the player "stay on ground/walk an ground" ?
It's for player moves that start on ground and thus need e.g. stair steps, but no gravity taken into account. The move may end not over ground, though (air over an abyss).
I assume you now that the coordinate-system in DirectX is different than in OGL/QuakeLevel-format.
Good thing is that that doesn't matter for the math.
Best regards,
Carsten
denis_marasovic
Posts:4
Joined:2004-11-24, 16:01

problem

Post by denis_marasovic » 2004-11-28, 20:25

Thank you for the answers.


I will now post some (a lot;-)) code fragments which are important for collision detection.

I will begin with the important structures:

Code: Select all

The Bounding-Box. Each node have one.

//###################### Bounding-Box ########################
typedef struct BBOX{
 
 VECT vMin; //---Maximaler Eckpunkt
 VECT vMax; //---Minimaler Eeckpunkt
 VECT vMitte; //---Mitte der Bounding Box

}boundBox;

used for normal determination/calculation.

//######################## plane #####################
typedef struct PLANE{

VECT atPlane; //---Punkt auf Ebene;
VECT normale;
float     distanz;


}pPlane;

What the player/camera can see. Each leaf contain a polygon-list.

//#### polygon structure ####
typedef struct POLYGON{
int id;
int anzVertexe; //---anzahl der Punkte
int prim_count; //---primitive count
D3DLVERTEX punkte[4]; 
PLANE ebene; //--- teilungsebene
BOOL splitter; //--- war splitter??
int anzIndexe;
WORD indexListe[100];
char* textr_name;

}pPolygon;

//######### BSP node structure ##########
typedef struct TREENODE{

int id; //---id dieses Nodes
PLANE ebene; //--- ebene welche die nodes in front&back spaltet
BOOL isLeaf; //--- Ist der raum konvex? dann ein Leaf!
TREENODE *front_node; //---zeiger auf den Frontzweig
TREENODE *back_node;  //---zeiger auf den Heck-zweig
int anzPolygone; //--- anz. der Polygone wenn node ein leaf
POLYGON *poly; //---zeiger auf diePolygonliste wwenn node ein Leaf
BBOX bdBox; //--- Bounding Box
}tNode;



Next the BSP-Building-Function, because BSP-Collision-Detection is used, the comments are in german:

Code: Select all

void Build_Tree(TREENODE *currNode){

int polyClass;
TREENODE *back = NULL,*front = NULL;
BOOL currentPlane;

  //---calculate bbox for this node
   /*currNode->bdBox = this->createBBox(currNode->poly,currNode->anzPolygone);*/

   //---get the best splitting-plane
   currentPlane =       GetPlane(currNode->poly,
	                             currNode->anzPolygone,
								 &currNode->ebene);
   if(!currentPlane){
    /*
	  ---  CreateSolidLeaf() ---
	  So.. hier ist nun ein konvexer Bereich,dh.Leaf
	  Hier werden die Polygone weiter in Front/Backliste unterteilt
	  bis alle Polygone(auch normale Splitter) Splitter/Teilungsebenen
	  waren!

	   
	*/
	   /*currNode->isLeaf=TRUE;
	   currNode->back_node = NULL;
	   currNode->front_node = NULL;*/
	   
	   CreateSolidLeaf(currNode);
	
	/*FILE *tt;
	tt = fopen("debug1.txt","a");
	fprintf(tt,"Klassifizierung gegen Ebene übersprungen! Irgendwas stimmt nicht\n");
	fclose(tt);*/
	
	return;
   }

   //---Nodes aus Node-Array reservieren
   front = &tNodePool[tNodePoolIndex++];
   back = &tNodePool[tNodePoolIndex++];

   //---Polygonzähler für aktuelle Knoten auf NULL setzen
   front -> anzPolygone = 0;
   back -> anzPolygone = 0;
   
   //---speicher für diese Polygonlisten reservieren
   front->poly = (POLYGON*)malloc(sizeof(POLYGON)*currNode->anzPolygone);
   back->poly = (POLYGON*)malloc(sizeof(POLYGON)*currNode->anzPolygone);
   
   
    for(int x=0; x < currNode->anzPolygone; x++){
    //---Polygon gegen ebene Klassifizieren
    polyClass =              KlassifizierePoly(currNode->ebene,
		                                       &currNode->poly[x]);
    /*FILE *fp;
	fp = fopen("debug.txt","w");
	fprintf(fp,"sortiere Polygon NO[%i]....\n"
		        "Klassifizierungs ergebnis: %i\n",
				x,polyClass);
	fclose(fp);*/

    if(polyClass == POLY_FRONT){
	//---Polygon in Frontliste einteilen
	front ->poly[front->anzPolygone] = currNode->poly[x];
	front ->anzPolygone++;
	/*this-> anz_front++;*/
	}
	else if(polyClass == POLY_BACK){
	//---Polygon in Backliste einteilen
	back ->poly[back->anzPolygone] = currNode->poly[x];
	back ->anzPolygone++;
	/*this->anz_back++;*/
	}

	else if(polyClass == POLY_SPLIT){
	POLYGON polypFront,polypBack;
	
	splitPoly(&currNode->poly[x],&currNode->ebene,
		            &polypFront,&polypBack);
	
	/*front->poly[front->anzPolygone] = currNode->poly[x];*/
	front->poly[front->anzPolygone] = polypFront;
	front->anzPolygone++;
	

	/*back->poly[back->anzPolygone] = currNode->poly[x];*/
	back->poly[back->anzPolygone] = polypBack;
	back->anzPolygone++;
	/*this->anz_split++;*/
	}
    
	else if(polyClass == POLY_PLANAR){
		//---Poly-Normal-Vektor gleiche richtung wie Teilungsebene??
                //--- ""     ""         same direction as splitting-plane
		float dotProduct;
		dotProduct = currNode->poly[x].ebene.normale.x *
			         currNode->ebene.normale.x +
					 currNode->poly[x].ebene.normale.y *
			         currNode->ebene.normale.y +
					 currNode->poly[x].ebene.normale.z *
			         currNode->ebene.normale.z;
		//---in Front oder Backliste einsortieren
		if(dotProduct >= 0){
		 //---Frontliste
         front->poly[front->anzPolygone] = currNode->poly[x];
		 front->anzPolygone++;
		
		}else{
          back->poly[back->anzPolygone] = currNode->poly[x];
		  back->anzPolygone++;
		}//---else
      /*this->anz_planar++;*/
    }//--if(PLANAR)
	
   }//---for(alle Polygone im Node durchlaufen und einsortieren);

   //---Speicher jetzt genau anpassen
   front->poly = (POLYGON*)realloc(front->poly,sizeof(POLYGON)*front->anzPolygone);
   back->poly = (POLYGON*)realloc(back->poly,sizeof(POLYGON)*back->anzPolygone);

   //---aktuelle Listen setzen
   currNode -> back_node = back;
   currNode -> front_node = front;

   //---alte listen löschen
   free(currNode->poly);
   currNode->poly = NULL;


Build_Tree(currNode->front_node);
Build_Tree(currNode->back_node);


return;
}
Next i listed the LineOfSight()- function which, return incorrect plane-intersection-values,
when i try to calculate the intersection point. The intersection point i need for my player-heigt-adjustion.

Code: Select all

//###################### LineOfSight() ########################

BOOL  LineOfSight(TREENODE *bspRoot,
	              D3DXVECTOR3 st_point,
				  D3DXVECTOR3 end_point,
				  PLANE *plane,TREENODE *currNode){

D3DXVECTOR3 schnittPunkt;
TREENODE *tempNode;
float tempVal;
int class_pos_1,class_pos_2;
/*currNode->ebene.atPlane.x = 5;
currNode->ebene.atPlane.y = 5;
currNode->ebene.atPlane.z = 2;*/

//---Wurzel-Node festlegen; falls akt. Node undefiniert
//---set root-node; if actual node undefinied
if(currNode == NULL) {
	tempNode = bspRoot;
}
else {
	tempNode = currNode;//--ansonsten rekursiver Aufruf

}

//---Punkte der Linie klassifizieren
//---classify points of the line

class_pos_1 = KlassifizierePunkt(tempNode->ebene,st_point);
class_pos_2 = KlassifizierePunkt(tempNode->ebene,end_point);
/*FILE *fp;
fp = fopen("section.txt","a");
fprintf(fp,"\nstartpunkt: %i\nendpunkt: %i\n",class_pos_1,class_pos_2);
fclose(fp);*/

//---LINIE: Startpunkt->Front && Endpunkt->Back
if((class_pos_1 == POLY_FRONT) && (class_pos_2 == POLY_BACK)){
    
	//---Teil der Sichtlinie im Solidbereich?
	if(tempNode->back_node ==NULL){
       if(plane != NULL) *plane = tempNode->ebene;
	   return FALSE;
	}//---if

	//---schnittpunkt der Linie zur ebene berechnen
        //---calculate the intersectionpoint between line and plane
	/*
	  Ersetzt das Liniensegment durch 2 Liniensegmente:
	  Segment1: Start = st_point && Ende = schnittpunkt
	  Segment2: Start = schnittpunkt && Ende = end_point
	*/
           interSectionPoint(&st_point,&end_point,&tempNode->ebene.atPlane,
		                     &tempNode->ebene.normale,&schnittPunkt,&tempVal);

	//---testet Liniensegmente ob diese durch solide Räume laufen
        //---test the line-segments if there "walked" through solid-space

	return(LineOfSight(NULL,st_point,schnittPunkt,plane,tempNode->front_node)
		   &&
		   LineOfSight(NULL,schnittPunkt,end_point,plane,tempNode->back_node) ); 
}//---if(LINIE:Startpunkt->Front && Endpunkt->Back)

//---LINIE: Startpunkt -> Back && Endpunkt -> Front
if( (class_pos_1 == POLY_BACK) && (class_pos_2 == POLY_FRONT) ){

	if(tempNode->back_node == NULL){
      if(plane !=NULL) *plane = tempNode->ebene;
	  return FALSE;
	}//---if

	//---Schnittpunkt der Linie zur Ebene berechnen
        //---calculate the intersectionpoint between line and plane

	 /*
	  Ersetzt das Liniensegment durch 2 Liniensegmente:
	  Segment1: Start = st_point && Ende = schnittpunkt
	  Segment2: Start = schnittpunkt && Ende = end_point
	*/
            interSectionPoint(&st_point,&end_point,&tempNode->ebene.atPlane,
		                     &tempNode->ebene.normale,&schnittPunkt,&tempVal);

   //--- Beide Liniensegmente GETRENNT darauf prüfen ob sie durch 
   //--- soliden Raum laufen, und das Ergebnis mit && verknupfen
   //--- A = SEG1=0 && SEG2 = 1 deutet darauf hin das sich im 
   //--- 1. Liniensegment solider Raum befindet, dh. Sichlinie unterbrochen!!

    /*
             test both line-segments seperate if there walked through solid space
             and concat the result with &&

             A = SEG1=0 && SEG2 = 1 ; mean that line-segment SEG1 contain solid space,
             the line of sight is "braked"

     */
   	return(LineOfSight(NULL,st_point,schnittPunkt,plane,tempNode->back_node)
		   &&
		   LineOfSight(NULL,schnittPunkt,end_point,plane,tempNode->front_node) ); 

}//---if(LINIE: Start -> Back && Ende -> Front)

if( ((class_pos_1 == POLY_PLANAR) && (class_pos_2 == POLY_PLANAR)) ||
   ((class_pos_1 == POLY_FRONT) || (class_pos_2 == POLY_FRONT)) ){
 //---Sichlinie prüfen falls node kein Leaf ist
 
 if(tempNode->isLeaf == FALSE){
   return LineOfSight(NULL,st_point,end_point,plane,tempNode->front_node);
 }else{
   return TRUE; //---Sichtlinie ist gültig,wenn Node ein Leaf!!
 }

}else{
    //---Falls Backnode NULL(Raum ist SOLIDE!!) Sichtline ungültig!
	if(tempNode->back_node == NULL){
      if(plane !=NULL) *plane = tempNode->ebene;
	  return FALSE;
	}else{
        //---Falls Backnode existiert prüfe dort auf gültige Sichtlinie
        //--if backnode exists test there for an proper lineofsight.
		return LineOfSight(NULL,st_point,end_point,plane,tempNode->back_node);
  	}//---else
}//---else


}//---function


The next function is the camera-function and is used for movement BSP-collision detection.
The main Problem that i have, is that the player height must be automatically adjustet at ground.

The m_camPos is an D3DXVECTOR and a member in the D_DXScene-Class.
The function LineOfSight() is used to check for collision detection.

Code: Select all

void D_DXScene::DMoveCamera(D_IMSG userMessage){

float pi2 = D3DX_PI / 2.0f;

D3DXVECTOR3 vStart;
D3DXVECTOR3 vEnd;


vStart = m_camPos;

   if(userMessage.flag == D_KEYBOARD_INPUT){

    switch(userMessage.kButton){
    
	//---rotation	
	case D_ROTLEFT:
		m_rotY -= 0.13f;
		break;
	case D_ROTRIGHT:
		m_rotY += 0.13f;
		break;
    
	//---moving
    case D_MOVEFRONT:
		vStart.x += 0.4f * sinf(m_rotY);
		vStart.z += 0.4f * cosf(m_rotY);

		break;

	case D_MOVEBACK:
		vStart.x -= 0.4f * sinf(m_rotY);
		vStart.z -= 0.4f * cosf(m_rotY);

		break;

	default:
        D3DXMatrixIdentity(&m_matTrans);

	}//---switch

	}
    
	
	if(userMessage.flag == D_MOUSE_INPUT){
        
		    
            m_rotY += userMessage.mX*0.005f;
			
			if( (m_rotX < pi2) && (m_rotX > -pi2))
			m_rotX += userMessage.mY*0.005f;
			/*FILE*fp;
              fp=fopen("mouse_move.txt","a");
			  fprintf(fp,"lx: %i ly: %i",userMessage.mX,userMessage.mY);
			fclose(fp);*/

	}
	
	if(userMessage.kButton == -1){

	D3DXMatrixIdentity(&m_matTrans);

	}
    
    

	//---blickrichtung der kamera berechnen (x,z ebene)
	m_LookAt.x = sinf(m_rotY) + m_camPos.x;
	m_LookAt.z = cosf(m_rotY) + m_camPos.z;

	//---the look height (y direction)
	m_LookAt.y = sinf(m_rotX) + m_camPos.y;
    D3DXVECTOR3 vecDir;
	vecDir.x = vStart.x - m_camPos.x;
	vecDir.y = vStart.y - m_camPos.y;
	vecDir.z = vStart.z - m_camPos.z;
	D3DXVec3Normalize(&vecDir,&vecDir);

    vEnd.x = vStart.x + 2.5f * vecDir.x;	
    vEnd.y = vStart.y + 2.5f * vecDir.y;
    vEnd.z = vStart.z + 2.5f * vecDir.z;

   //--test for collision
   if(LineOfSight(&NODE_ROOT,vStart,vEnd,NULL,NULL) == TRUE){
 
			//create new position and rotation for camera
	/*D3DXVECTOR3 camPos (m_camPos.x,m_camPos.y,m_camPos.z);*/
    m_camPos = vStart; 
	
   }//---if
   

  <-------------

      Here im tried to adjust the player-height, with the LineOfSight()-function.
      The 4Th param normally return an intersection with an plane, but the reurned result are
 not correct!
 <---------------
   

   	D3DXMatrixLookAtLH(&m_matView,
		               &m_camPos,
					   &m_LookAt,
					   &m_UpVect);

    lpD3DDevice_I1 -> SetTransform(D3DTS_VIEW,&m_matView);
}

I tried to test for a intersection with LineOfSight, below the collisin test to adjust the player-height.
I created a startvector/point with the same
coordinates as m_camPos and then a endpoint with the same coordinates as m_camPos except THE Y-Value.
A constant value about -100.0f was added to the endpoint y-value to face the "floor".

I thought the ray must go straight DOWN and intersect the next polygon(a poly-list is contained in the 1st params node)
plane (under the players feet), how i understand the function. And then the returned(4Param) intersection-point is used
to define the actuel player-height(plane-intersection plus an constant value about 1.8f).


I can later post a link to a sample application, witch demonstrates this "hover" problem with my camera.




Thank for your patience


M.f.G Denis Marasovic



Post Reply

Who is online

Users browsing this forum: No registered users and 14 guests