Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 05 Dec 2011
Offline Last Active Oct 27 2014 03:56 PM

Posts I've Made

In Topic: Help me solve the last 5% in my collision response

23 September 2014 - 12:45 AM



i have followed this document a little bit and also tried to implement the things you pointed on, seperate detection and response.

I now have a function that returns data that we need when solving response.



I think the key to the good routine my first version compared to my latest is to not just "push-out". Instead, calculate time of impact from a velocity.

Then get new velocity and run checks again.


And my pseudo code works like this now:.


Before movement, see if the player is free: 1.0 = free < 1.0 = we hit something and return the time t of impact.

If we dont hit anything, just move player

If we hit we check:
If player is not very very close, move the player close to the impact line - a little value
Now take the new velocity and run the function again recursivly.


This works now brilliant on edges corners, but have some problems in the vertex edges.


My next update will be to add checks for "edges" first and handle them seperatly.


I have uploaded a new document Version 4.

In Topic: Help me solve the last 5% in my collision response

19 September 2014 - 12:53 AM

I think your approach with cutting the velocity before the circle hits is the best one.

This makes the circle always stop at the intersection point of the first line.


Now i will have to fix the last part.


Check vertex of the lines (points)

Give new slide vector after player got hit forst time.

So i my recursive method i will have something like (playersVelocityCut = true)

then give him a slide vector again etc.


the problem now is my slide vector is so small after cutting the velocity. So i need to have some sort of where player wants to go slide vector.

i will base the sliding based on where the player wants to go.

In Topic: Help me solve the last 5% in my collision response

17 September 2014 - 11:33 AM

Ok Update.


Now i fully understand the code. It takes a percentage of the velocity to cut it before the player overpasses the lines.

This way i don+t need to push out that much.


This makes first part ultra-correct.


A Fint the closest intersection

B Cut the velocity so the remaining velocity reaches the intersection point

C Calculate the sliding vector

D Check recursive the new velocity AND if something is hit, DONT calculate a new sliding velocity, simply just CUT the speed.


I was up last night coding, and i did exactly like this, put i didnt finish with taking off percentage of the velocity, and i think that that is what makes it really good when fining intersection point.


It is still some jitter, and i dont understand the 0.5, shouldent it be like 1.001 (the pushout and then some extra just to be safe)?

In Topic: Help me solve the last 5% in my collision response

17 September 2014 - 06:13 AM

Wow. There are so many tips/correction in your post. And i think you really nailed the problems, because i recognize the ping-pong effect.


Now, when i think of it of course i should only calculate the sliding velocity once, and then cut the length when the next collision occurs! =) 

Its like you say, if the next collission then is up against a big wall, i would just simply stop instead of calulatin the new direction and velocity.


I am in a rush right now, but i will work on my demo tonight and update.


Thank you so much for your answer.

In Topic: Help me solve the last 5% in my collision response

17 September 2014 - 03:31 AM

thanks for your kind words.


The problem is when sliding slow with really big velocity in the obtuse angles, then the circles starts to jitter a bit.

Also in the Problem area nr 2, (the big V) the circle dont stops at the closest place on the line when entering with big velocity.


going in the "V" shape with full speed, the circle stops sometimes 2-3mm from the line and then one-two jerky movements to get out of there.


The HasCollission function has a bug, i was missing its input parameters, but that function isnt used in the collission code.



Next test:


I will try to do test after the pushout has been done. get the length again for the closest line (only two) and then push the circle at the closest point if that is not the case.

This will be second test after the pushout.

The new sliding-velocity works only perfect if the circle is superclose to the line, otherwise jittering will appear.