Re: Hot to get exactly hit point in Pick?
From: Jack Hoxley (Jack.Hoxley_at_ntlworld.com)
Date: 09/15/04
- Next message: Eyal Teler: "Re: Translucent Textures w/ colorkey (Still can't make it work)"
- Previous message: Jack Hoxley: "Re: problem with state restoration after ID3DXFont::DrawText"
- In reply to: pingyingtu: "Hot to get exactly hit point in Pick?"
- Next in thread: David Cameron: "Re: Hot to get exactly hit point in Pick?"
- Messages sorted by: [ date ] [ thread ]
Date: Wed, 15 Sep 2004 09:27:28 +0100
I don't have the information to hand, but I thought that D3DXIntersect()
returned the triangle index and a pair of barycentric coordinates. Look
through the vertex buffer/index buffer for your mesh to identify the three
vertices that make up the identified triangle. Then feed these values, along
with the barycentric coordinates from Intersect() into Vec3Barycentric() and
you should get the exact coordinate of intersection.
The code itself shouldn't be too complicated as long as you read through the
SDK helpfiles, as it's just a case of swapping/changing a few parameters and
return codes around.
hth
Jack
"pingyingtu" <pingyingtu@hotmail.com> wrote in message
news:3cca2ed3.0409141911.505ececb@posting.google.com...
> Hi,
> I am a newbie of DX9. I'm studying Pick sample in SDK now.
> This sample uses "D3DXIntersect()" to check if hit or not. and I know
> which triangle hit.
> Could I get exactly hit point in this triangle?
> I found a message from google say:
>
> >you also get back barrycentric
> >coordinates. You can use the D3DXVec3BaryCentric to convert these
> >values, plus the three vertex locations of the hit face, into the
> >coordinates where the intersection occurred.
>
> But I don't know hot to code.
> Somebody give any sample code is appreciated.
> Thanks a lot.
- Next message: Eyal Teler: "Re: Translucent Textures w/ colorkey (Still can't make it work)"
- Previous message: Jack Hoxley: "Re: problem with state restoration after ID3DXFont::DrawText"
- In reply to: pingyingtu: "Hot to get exactly hit point in Pick?"
- Next in thread: David Cameron: "Re: Hot to get exactly hit point in Pick?"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|