Jump to content

  • Log In with Google      Sign In   
  • Create Account

Finalspace

Member Since 29 Mar 2012
Offline Last Active Apr 27 2013 07:05 AM
-----

Posts I've Made

In Topic: What is wrong with my SAT implementation?

18 March 2013 - 09:22 AM

Hmm, i have a problem with my implementation. If seems if i move the second object - (Displacement of B) everything goes off.

 

The resulting projection / time of factor is incorrect - because of the relative velocity. Adding the velB to the relative velocity is no solution after all.

What i am looking for is a solution to find always the correct projection (Multiply vel A to a amount that its just touching Obj B, even when obj B moves then it shoud touches the movement of Obj B). Is there a solution for that? Currently i could not come up with anything working at all sad.png

 

What i am trying to achive is to create a speculative contacts system using separating axis theorem. The essence of that technique requires that obj A vel must be decrease to a level to just touch obj A even if obj B is moving. Basically the Time-Of-Impact factor (Earliest time enter) takes care of that by multiplies the relative velocity (vA - Vb) to fix that.

 

To see that in real, check out my latest update: http://jsfiddle.net/sbYnp/6/

See the green box is wrong projected, cause it uses relative velocity.

 

It would be really great is someone can push me in the right direction.

 

Thanks,

Final


In Topic: What is wrong with my SAT implementation?

12 March 2013 - 03:49 PM

k i made it a little simpler and got it working now. Ghost projections still happens but these are fine, because this will be filtered out in the next collision step before i can get to the next stage to calculate the exact contact points  / pairs - wahh what a pain.

 

Here is the update: http://jsfiddle.net/sbYnp/4/


In Topic: What is wrong with my SAT implementation?

12 March 2013 - 01:34 PM

Everything looks correct, except maybe this:

 

 

- Swap time enter with time leave if required (Time enter must always be smaller than time leave)

 

 

1)  Keep track of your latest "time enter" and earliest "time leave"

2)  If  (time enter > time leave), there is no collision.

3)  When all axes are checked and there is a collision, Time of Impact = latest "time enter"

 

HTH.

 

Thanks for your answer - i fixed most of the issues but i am not sure if i made it correct... one thing remains is to cancel the projection drawing when there is no real swept overlap. Ghost projections appears :(

 

I made new js fiddle: http://jsfiddle.net/sbYnp/

 

It would be glad if you can help me to make it right. It seems that its nearly fine.


In Topic: Need help in 2D Platform Game Physics

30 March 2012 - 06:51 AM

Do X motion and Y motion in separate steps, so stopping X from hitting a wall doesn't stop you from falling, and stopping Y motion from the ground doesn't stop you from walking Posted Image


This i do already, but i am having trouble determine which tile i need to check for collision.
For the moment i want to detect the tile beneath me, detect collision with the players bottom rect and set vely to 0 and set also y to foundtile y - player height.

How is this done?

PARTNERS