|
EclipsE
|
 |
« 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
Posts: 23
Beer! more beer!
|
 |
« 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
|
 |
« 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
Posts: 23
Beer! more beer!
|
 |
« Reply #3 on: 2007/05/01 09:40:54 » |
|
if its within a WHITE box... use a WHITE background for its rendering?
|
|
|
|
|
Logged
|
|
|
|
|
EclipsE
|
 |
« 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
|
 |
« 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
|
 |
« 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
|
 |
« 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
|
 |
« 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
|
 |
« 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
|
 |
« 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
|
 |
« Reply #11 on: 2007/05/09 01:57:18 » |
|
|
|
|
|
|
Logged
|
|
|
|
|