Jump to content
  • Advertisement
  • entries
    117
  • comments
    119
  • views
    106166

Success

Sign in to follow this  
alfith

396 views

I corrected my cylinder/cylinder collision detection. It was really wrong.
What I was doing:
(1) cylinder 1 is defined by the points P1 and P2 and radius R1,
(2) cylinder 2 is defined by the points Q1 and Q2 and radius R2,
(3) compute shortest segment [P';Q'] between the lines (P1;P2) and (Q1;Q2),
(4) if P' is on [P1;P2] and Q' is on [Q1;Q2] then,
(5) if length of [P';Q'] is <= R1 + R2 consider there is a collision

What I am doing now:
(1) and (2) same as before
(3) project P1 on (Q1;Q2) it gives you P1'
(4) if P1' is on [Q1;Q2] and length of [P1;P1'] is <= R1 + R2 then there is a collision
(5) else project P2 on (Q1;Q2) it gives you P2'
(6) if P2' is on [Q1;Q2] and length of [P2;P2'] is <= R1 + R2 then there is a collision
(7) else project Q1 on (P1;P2) it gives you Q1'
(8) if Q1' is on [P1;P2] and length of [Q2;Q2'] is <= R1 + R2 then there is a collision
(9) else project Q2 on (P1;P2) it gives you Q2'
(10) if Q2' is on [P1;P2] and length of [Q2;Q2'] is <= R1 + R2 then there is a collision

I think that the resulting tested volumes are not exactly cylinders but it is even better like this. I did a quick test and everything looks OK.

I don't have time to do a video now (it is 00:25 here and I must wake up at 6h00) but here are screenshots of a new creature: an undead tree (again no shadows, the game was running on my computer).







Have a nice day (or night)...
Sign in to follow this  


0 Comments


Recommended Comments

There are no comments to display.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • 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!