D3DXVec3Unproject help

Started by
18 comments, last by Anddos 13 years, 6 months ago
Quote:
D3DXVec3Unproject(&UnProjected,		  &Src,		  &V9,		  &gCamera->proj(),	          &gCamera->view(),	          &i);


Anddos, for one thing, your arguments are out of order. Src and V9 need to be reversed.

Please don't PM me with questions. Post them in the forums for everyone's benefit, and I can embarrass myself publicly.

You don't forget how to play when you grow old; you grow old when you forget how to play.

Advertisement
Quote:Original post by Buckeye
Anddos, for one thing, your arguments are out of order. Src and V9 need to be reversed.
Not according to the docs? Did you miss the first parameter when looking at his code like I did the first time [smile]?

Quote:Original post by Anddos
This is what i am trying todo steve
And..?
what do you mean , Out is the first param so thats the UnProjected,*Pv is the source which is Src, i dont get what you mean :/
:)
What is the actual problem? Does the app crash? Do you get "wrong" values (and if so, what values, and how do you know they're wrong)? Do pixies fly out of the DVD drive?
i can draw lines from Src and CameraPos like this

l.LineBuffer = wl->LoadMultipleLinesToWorld(Src,gCamera->mPosW);

just not getting any lines rendering with UnProjected,gCamera->mPosW

so creating ,xyz positon from mouse cant be working

anyway here is a pic so you get the idea

http://img89.imageshack.us/img89/7407/gunline.jpg
:)
If mPosW is the camera's world position, then drawing a line from there to the picked point will give you a single pixel (And possibly none at all, I'm not sure how single pixel lines work), since the camera is looking directly along that vector. What if you draw a quad at the picked point instead?
Quote:Did you miss the first parameter when looking at his code like I did the first time [smile] ?

[embarrass] Yoiks. Sorry, Anddos. Ignore my comment on the order of the arguments.

Please don't PM me with questions. Post them in the forums for everyone's benefit, and I can embarrass myself publicly.

You don't forget how to play when you grow old; you grow old when you forget how to play.

Ah, I didn't see the screenshot before.

Where are you actually clicking on the screen in that screenshot? You should be getting two points, not just one, as Erik Rufelt said. And what is gCamera->mPosW? Is that your camera position in world space?
yeh, thats the world camera pos ,
i am trying to figure out if my level is like on a slope how do you make the camera.y goes up etc, i dont think picking will work and retrieve the XYZ with d3dxintersecttri, as it seems expensive to lock in the render thread..

so here is the picked face of the building
http://img259.imageshack.us/img259/4421/gunpick.jpg,
now if i use that to find the floor height , i dont think its going to work
so i am stuck with how to make the camera move up stairs and stuff ..
:)
now i am trying to place a ray at the camera position and direction then its converted to the same space as the stairs,i cant seem to get it to intersect and i dont know why
D3DXVECTOR3 RayPos(gCamera->mPosW.x,gCamera->mPosW.y,gCamera->mPosW.z);	D3DXVECTOR3 RayDir(gCamera->mLookW.x,gCamera->mLookW.y,gCamera->mLookW.z);D3DCOLOR_XRGB(255,0,0)));	D3DXVECTOR3 TransLook,TransNorml,TransPos;	DWORD FaceIndex; 	BOOL Hit;	D3DXMATRIX i;	D3DXMatrixInverse(&i,NULL,&(bl2->BuildingWorld * gCamera->view()));	D3DXVec3TransformCoord(&TransPos,&RayPos,&i);	D3DXVec3TransformNormal(&TransLook,&RayDir,&i);	D3DXVec3Normalize(&TransLook,&TransLook);	D3DXIntersect(bl2->Mesh,&TransPos,&TransLook,&Hit,&FaceIndex,NULL,NULL,NULL,NULL,NULL);	if(Hit)	{		MessageBox(NULL,"Hit","",0);	}
:)

This topic is closed to new replies.

Advertisement