Billboarding in Mario Kart style game..?

Started by
14 comments, last by robertgamble 20 years, 7 months ago
Neoteric, thanks for your example it was very helpful

I''ve got it kind of working now, the only problem is if you move left or right it starts to get distorted. http://www.elephantsneverforget.co.uk/mode7b.htm

I think it''s how I''m working out the angle, how are you working out floor_ray_ang and angstep in your program?

Thanks for your help
Advertisement
Ray-ang step is 45 degrees / screen_height.

       /      /     /   o ___________________   <-- line of sight   z \   |  \___|___\________________   <-- intersection on floor        \         \           \     <==90 degree FOV / 2 = 45 / screen_height =                interpolattion_between_hight_&_low_scanlines   


I don''t think that''s the problem though, left_ang and right_ang seem to be going wrong. Hope that helps.

Doesn''t seem to be anything wrong with left_ang and right_ang, unless I''m missing something.. It almost looks like I''m getting radians & degrees mixed up somewhere, but that shouldn''t happen as I''m using luts for the trig functions...
Sorted it, the interpolation increments were being calculated wrong. Shouldn''t be using the absolute value, as it was causing the ray to always go up,right when it shouldn''t.

Thanks for your help with this, it seems faster now and hopefully I''ll get a nice boost in the GP32 version
Cool, I''d be interested in seeing it.
I''m still having trouble transforming and projecting the coordinates for cars and trackside objects though

this is how did tranform / projection in my proper 3d thing:-

while(curVect				//project, draw and transform this vector				distanceZ=(dspList[curObj].faces[curFace].points[curVect].z+dspList[curObj].z)-this.z;				distanceX=(dspList[curObj].faces[curFace].points[curVect].x+dspList[curObj].x)-this.x;				distanceY=(dspList[curObj].faces[curFace].points[curVect].y+dspList[curObj].y)-this.y;				ntY = parseInt(distanceY*cos[this.xa] - distanceZ*sin[this.xa]) 				ndistance = parseInt(distanceZ*cos[this.xa] + distanceY*sin[this.xa])				distanceY=ntY;				distanceZ=ndistance				ndistance = parseInt(distanceZ*cos[this.ya]) - (distanceX*sin[this.ya])  				ntX = parseInt(distanceX*cos[this.ya]) + (distanceZ*sin[this.ya])				distanceZ=ndistance				distanceX=ntX				ntX = parseInt(distanceX*cos[this.za]) - (distanceY*sin[this.za]) 				ntY = parseInt(distanceY*cos[this.za]) + (distanceX*sin[this.za])				distanceX=ntX;				distanceY=ntY;				distanceZ+=0.001;								tmpvec[curVect]=new vector3D();				tmpvec[curVect].z=distanceZ;				tmpvec[curVect].x=(lens*distanceX/distanceZ)+viewarea.centerx;				tmpvec[curVect].y=viewarea.centery-(lens*distanceY/distanceZ);				curVect++;				} 


I think I understand how to transform the coordinates, but not how to project them without a Z coordinate.. bah! Do you know of any simple open source games/demos that do this, it would be nice to see an example..

This topic is closed to new replies.

Advertisement