Jump to content
  • Advertisement

Archived

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

nes8bit

Collision Detection Needs Fixing!

This topic is 6913 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

My problem is quite minor. My collision detection works except for collisions against corners. See my horrible diagram. It shows the player going through the corner instead of stopping or sliding across the wall. My collision response would immediately push the player in the direction of the arrow in the red area as soon as the player moves into the red area. HELP!

Share this post


Link to post
Share on other sites
Advertisement
just add another if statement for that part
it would be simpler for us to help if you post the part of your code that checks the collision for the 2 red parts you have in figure 1. that way we can atleast have an idea of how you''re checking the other 2 and what needs to be added in order to check the corner part

- pouya

Share this post


Link to post
Share on other sites
Hmm, it''s in VB. I hope you can read it. I''ll post the code in about an hour because I am at school right now. I can give you an idea of how it checks though. It does a basic sphere to plane collision check using dot products and plane normals. Basically it checks if the source and destination point goes through the plane. After that, it checks if the point where it collides is within the triangle. If it intersects, it moves the camera back at exactally 100 units away from the plane by using the plane normal so it slides like quake. My problem is in the picture. The red zones represent the collision response. The reason it does not check corners is because the collision response pushes back only if the point is within the 100 units of the player AND if it is within the boundaries of the triangle. It''s kinda weird explaning. I''ll try to draw more pictures and post my VB source. Hopefully my pictures will be in .gif or .jpg because this mac does not read bmp''s.

Share this post


Link to post
Share on other sites
Nevermind, I think I figured it out. I''ll just resize the block and get the planes from that...

Share this post


Link to post
Share on other sites
ok, fine
see, you didn''t even need our help...

- pouya
--------------
Sometimes I think the surest sign that intelligent life exists elsewhere in the universe is that none of it has tried to contact us

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

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

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!