Skip to main content
GameDev.net gamedev.net
🔒 Locked

Billboarding Problem

Started by CastorX Apr 14, 2005 at 12:51 PM 0 replies 400+ views
Original Post
CastorX
CastorX
I crated a function (with the NeHe article 19: Billboarding), but it is working !incorrectly!. PLEASE help me! What is wrong in my program? The Drawing and Matrix Initialisation function: void DrawBBFace(...) { ... Look=CamPos-Emitter.pos; D3DXVec3Normalize(&Look,&Look); Up.x=0.0f;Up.y=1.0f;Up.z=0.0f; D3DXVec3Cross(&Right,&Look,&Up); D3DXVec3Cross(&Up,&Look,&Right); M._11=Right.x; M._12=Up.x; M._13=Look.x; M._14=Emitter.pos.x; M._21=Right.y; M._22=Up.y; M._23=Look.y; M._24=Emitter.pos.y; M._31=Right.z; M._32=Up.z; M._33=Look.z; M._34=Emitter.pos.z; M._41=0; M._42=0; M._43=0; M._44=1; D->SetTransform(D3DTS_WORLDMATRIX(0),&M); ... }
jollyjeffers
jollyjeffers
I haven't read the NeHe article you reference, but if the snippet you've posted is a direct translation (e.g. call-for-call conversion) then you need to realise that DirectX and OpenGL use different coordinate systems (Left Hand or Right Hand), so the matrix maths doesn't directly convert.

I'm not an expert at maths, so can't tell you a solution that way. But there are lots of billboarding articles for DirectX kicking around - I suggest you have a read of those.

hth
Jack
<hr align="left" width="25%" />
Jack Hoxley <small>[</small><small> Forum FAQ | Revised FAQ |

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.