XNA Game Development Forums
2012/05/21 19:13:53 *
Welcome, Guest. Please login or register.

Login with username, password and session length
 
   Home   Help Search Calendar Login Register  
Pages: [1]
  Print  
Author Topic: Ahem, Me again :)  (Read 3153 times)
EclipsE
Full Member
***
Offline Offline

Posts: 111


View Profile
« on: 2007/05/01 05:37:35 »

So, I want to draw a 3d model on the screen. But the problem is that the model needs to be in a white box, which has coordinates 300, 400 on the screen. So, how can I get X, Y and Z position where the model should be to appear correctly on the screen??

Logged
inbreed
Newbie
*
Offline Offline

Posts: 23


Beer! more beer!


View Profile
« Reply #1 on: 2007/05/01 05:56:52 »

Does your Model affect with the scene?

im thinking about just to render it to a texture... set on screen by shader, independet from camera..
Logged
EclipsE
Full Member
***
Offline Offline

Posts: 111


View Profile
« Reply #2 on: 2007/05/01 08:24:02 »

The model should just rotate around the Y axis, only that. But, if I render it to a texture, how can I make only the model visible, and not the blackness of the texture??
Logged
inbreed
Newbie
*
Offline Offline

Posts: 23


Beer! more beer!


View Profile
« Reply #3 on: 2007/05/01 09:40:54 »

if its within a WHITE box...
use a WHITE background for its rendering?
Logged
EclipsE
Full Member
***
Offline Offline

Posts: 111


View Profile
« Reply #4 on: 2007/05/01 10:12:20 »

We'll I just said white box but it isn't white lol, it's the menu's texture
Logged
Chr0n1x
Global Moderator
Sr. Member
*****
Offline Offline

Posts: 307


View Profile WWW
« Reply #5 on: 2007/05/01 20:57:23 »

You can get the XY of the screen by multiplying the Vector3 of the model with the WorldViewProjection. Just like you do in the shader. This will give you the XY of the center of the model, or whatever Vector3 you put in.
Logged

Nemo Krad
Global Moderator
Hero Member
*****
Offline Offline

Posts: 512


I have seen the fnords


View Profile WWW
« Reply #6 on: 2007/05/02 00:54:37 »

This code is on here some where too. DaphydTheBard and I both put methods up of how to do that... (I think that's what you are after any way)
Logged
EclipsE
Full Member
***
Offline Offline

Posts: 111


View Profile
« Reply #7 on: 2007/05/02 01:29:31 »

No, that's how to get 2D screen coordinates of a model, but I need to get the Vector3 position of the model on X 300, Y 400
Logged
Chr0n1x
Global Moderator
Sr. Member
*****
Offline Offline

Posts: 307


View Profile WWW
« Reply #8 on: 2007/05/02 01:56:49 »

Ah, well then check out the XNA GSE documentation  about picking, and modify the code there and rather than providing the Mouse X,Y positions, you just give your values.
ms-help://MS.VSExpressCC.v80/MS.VSIPCC.v80/MS.XNAFX.1033/XNA/Math_HowTo_DetectClicked3DObject.htm
Logged

DaphydTheBard
Jr. Member
**
Offline Offline

Posts: 55


View Profile
« Reply #9 on: 2007/05/07 15:14:18 »

This might prove difficult, as a point on screen in 2D space could represent an infinite number of vectors in 3D space dependant on distance from the camera...

Logged
Chr0n1x
Global Moderator
Sr. Member
*****
Offline Offline

Posts: 307


View Profile WWW
« Reply #10 on: 2007/05/09 00:33:25 »

Well if you modify the picking code to take the screen coords as 300x 400y, then you can check against every object and see which it collides with, thus picking the one under that point.
Logged

Nemo Krad
Global Moderator
Hero Member
*****
Offline Offline

Posts: 512


I have seen the fnords


View Profile WWW
« Reply #11 on: 2007/05/09 01:57:18 »

This any use?

http://www.thehazymind.com/smf/index.php/topic,124.msg6356.html#msg6356
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.12 | SMF © 2006-2009, Simple Machines LLC Valid XHTML 1.0! Valid CSS!
Page created in 0.098 seconds with 17 queries.