Archived

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

Camera Problems~!

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 to all: I have a 3d character walking through a 3d game word. On his way, there are lots of obstacles that can block his route. My camera is always behind the character, following it. It sounds all fine until one problem appears. When my character bumps into an obstacle,because the camera is still behind the character ,players see the hollow inside of the obstacle model which they are not supposed to see. My solution is to make the obstacle model half transparent when the character bumps into it. Can anyone please tell me how I can do this in Directx?? Thanks for your help in advance

Share this post


Link to post
Share on other sites
One option is to give every object a bounding box and if the camera position is in it the render it transparently:


  
if (c.x>boxmin.x)
if (c.x<boxmax.x)
if (c.y>boxmin.y)
if (c.y<boxmax.y)
if (c.z>boxmin.z)
if (c.z<boxmax.z)
{
Turn_On_Alpha();
}
DrawObstacle();


Neil

WHATCHA GONNA DO WHEN THE LARGEST ARMS IN THE WORLD RUN WILD ON YOU?!?!

[edited by - thedo on August 28, 2002 3:43:01 AM]

Share this post


Link to post
Share on other sites
I don''t see how that will really help. This will just render the inside of a hollow semi-transparent box.

Some games turn objects semi-transparent because they are in the way of the camera and are thus preventing the player from seeing something. However, you probably want to implement some camera collision detection to avoid the camera entering the boxes in the first place.

At its simplest form it varies very little from the players collision detection. ie. If the camera is within the bounding box of an obsticle then move it out.

Camera collision gets a little more complex as you consider the possibilities of the camera being one side of an object and the player being the other, and try to resolve this. Something programmers still seem to struggle with now.

Cheers,
John

John Reynolds
Creative Asylum Ltd
www.creative-asylum.com

Share this post


Link to post
Share on other sites