Jump to content
  • Advertisement
Sign in to follow this  
LinkOfTime

A collision problem...

This topic is 4861 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 everybody My problem is that after implementing collision detection in my 3D program, when getting too close to the wall and rotation, the wall becomes "invisble", meaning, you can look right through it... I have been told that my problem is that the D3D object doesn't render objects (such as the wall) when I come too close to them. How do I fix it? Thanks in advance for the help everyone :) P.S: I am using DX7 with VB6... :)

Share this post


Link to post
Share on other sites
Advertisement
what do you mean invisible it is impossible.... invisible ... its a magic

Share this post


Link to post
Share on other sites
When I come close enough and turn (rotate), I can see through the wall even though it's still there... (I can't move through it, just see what's on the other side)

Share this post


Link to post
Share on other sites
Whats happening is that the wall is coming closer to you than your near clip plan (you defined this when you set up the projection matrix). There are two solutions:

1) Make the near clip plan closer to the camera. I wouldn't advise doing this too much, because keeping the ratio between far clip distance and near clip distance low is important for good ZBuffering.

2) Set a minimum distance to the wall, and never let someone get closer than that. It should be at least the near clip distance so that the wall does not disappear. This doesn't have the disadvantage of potentially messing up your ZBuffering either. I would say this is the preffered solution.

Share this post


Link to post
Share on other sites
Thanks for the help so far everybody... :)
I have tried what you suggested intrest86, the second option that is, but then I got into a different problem. Since I didn't know how exactly to set the viewport a few inches away from the camera frame, I had to create a different frame for "player", and had to set the camera a few inches away from that frame, which, was the colliding one. On the one hand, it really helped when I came close enough to the wall and it stopped me from crashing into it, yet on the other, when I rotated near the wall it was the "player" frame rotating and the camera frame was always behind it, causing a larger view of the outside by the few inches the camera was from "player" frame. Hope I wrote it in an understandable way... If you have an idea on solving this problem then tell me please... :)

Thanks again for all the help :)

Share this post


Link to post
Share on other sites
Well, I looked at the program again and it seems that my problem wasn't a collision one, but, a drawing in 3D one. :)

The thing is that I am tring to draw a wall in the method of building a surface with coordinates, but it comes out in 2D instead of 3D (8 coordinates) and I just can't it drawn right in 3D.

Here is my code for drawing a wall, hope anyone can help me... and thanks for the help in advance :)

D3DSurfaceFace.AddVertex X, Y, Z 'Creates front side wall
D3DSurfaceFace.AddVertex X, Y + SY, Z
D3DSurfaceFace.AddVertex X + SX, Y + SY, Z
D3DSurfaceFace.AddVertex X + SX, Y, Z
D3DSurfaceFace.AddVertex X, Y, Z 'Creates back side wall
D3DSurfaceFace.AddVertex X + SX, Y, Z
D3DSurfaceFace.AddVertex X + SX, Y + SY, Z
D3DSurfaceFace.AddVertex X, Y + SY, Z

Share this post


Link to post
Share on other sites
Thanks, I didn't know what culling is... (still don't exactly understand it...) :)

Can you please explain a bit and how to do it... :)

Thanks again

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
This is sort of a related question (it has to do with changing the near plane and good ZBuffering): For my flight-combat terrain engine, I have a near plane that is pretty far away from the camera (50.0f) so that I can get good fog effects in the distance. However, I would like to change the near plane the closer the player's aircraft gets to the terrain. Is it O.K. to change the near plane based on camera distance to the ground, or is this not advisable? Thanks :)

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!