Archived

This topic is now archived and is closed to further replies.

I wanna render objects in front of the camera

This topic is 5588 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello, could anybody tell my, how I could render objects in front of the camera ?? I believe, that I have to move the objects with ''SetTransform'' in front of the camera. Is this wrong ?? And which mode do I have to take ''D3DTRANSFORMSTATE_WORLD'' or ''D3DTRANSFORMSTATE_VIEW'' or ''''D3DTRANSFORMSTATE_PROJECTION'' ?? ciao Simon

Share this post


Link to post
Share on other sites
Move object in front of the camera?

I''m sorry but if you don''t get more precise, no one will answer. In fact... ALL objects you see on the screen are in front of the camera and those you don''t see are behind or aside.

So tell us, what do you mean by... in front of the camera?

However I will take a guess... do you mean that an object doesn''t move as you move the camera? In that case... try reading a little on transformed vertices.

Share this post


Link to post
Share on other sites
Oh sorry.
I wanna move the objects that I can see them. If I render the objects then I see everything like an Egoshooter.

Simon

Share this post


Link to post
Share on other sites
I''m guessing what you mean is to have something that is static in the screen, like a score in the game, or maybe a tint infront of the camera.

This is easy to do. All you need to do is have some variables for the camera positoin (which you should have anyway if you have a moving camera since you have to reset the angle every frame). Say that the camera is viewing into the Z angle, then all you have to do is take the camera position, and make the position of the object the same, with maybe a little added to the Z. If you have a camera that is looking in a different direction, not along an axis, then you''ll have to do a little trig to find out the exact position. Learn your sin''s and cos''s

--Vic--

Share this post


Link to post
Share on other sites
Thanks for the help :D
Can you still say me wich settransform commando do I have to take?? ''D3DTRANSFORMSTATE_WORLD'' or ''D3DTRANSFORMSTATE_VIEW'' or ''''D3DTRANSFORMSTATE_PROJECTION ??

Simon

Share this post


Link to post
Share on other sites
If your using d3d you should switch of the z-axis or projection by doing this
pd3dDevice->SetRenderState(D3DRENDERSTATE_ZENABLE,D3DZB_FALSE);

then draw the object so its always on top

pd3dDevice->SetRenderState(D3DRENDERSTATE_ZENABLE,D3DZB_TRUE);

or I think you can use D3DTLVERTEX which actully has 2D screen co-ordinates for the polygon to be drawn.

hope this helps

Share this post


Link to post
Share on other sites