Jump to content

  • Log In with Google      Sign In   
  • Create Account

Banner advertising on our site currently available from just $5!


1. Learn about the promo. 2. Sign up for GDNet+. 3. Set up your advert!


h4tt3n

Member Since 02 Apr 2008
Offline Last Active Today, 12:00 AM

Posts I've Made

In Topic: inifinite mass and a jitter problem

29 April 2015 - 02:49 PM

I don't get it. The moving body rests when sitting on two adjacent infinite masses, but doesn't when sitting on two infinite masses joined by an internal edge. It's the same thing.


In Topic: inifinite mass and a jitter problem

23 April 2015 - 10:59 AM

Could you pass me the values of k, d, and iterations? If k and d are both 1.0 you should reach the exact solution within just one iteration, ie. the moving box is exactly touching but not overlapping the non-moving box and has a tangent velocity of exactly 0.0. Could you check if it really does that, just to make sure everything is okay? You may improve the result by applying gravity as an impulse before the solver, so it can take it into account and get rid of sinking.

 

Cheers,

Mike


In Topic: inifinite mass and a jitter problem

21 April 2015 - 02:48 AM

Hi again,

 

It looks like your program is first lifting the finite mass object free of contact with the infinite mass object (SolvePenetration), and then applies a separation impulse of some magnitude (SolveImpulse). So in short, your code lifts the movable object free of the ground and then applies a velocity away from it. This will always create jitter. 

 

I would drop SolvePenetration completely and only apply an iterative impulse that separates the objects and dampens them, in principle like a damped spring but formulated as an impulse. Something like this, where k and d are stiffnes and damping coefficients between 0 and 1 (start with 0.3 or something like that). Number of iterations could be anything from 1 to 20, you should see a noticeable difference. You may need to swap signs somewhere to make it work properly, remember I can't test this, only compare to my own code. 

 

Cheers,

Mike

void Contact::solveImpulse(){
    
    Vec2 rel_vel=b2->vel-b1->vel;

    float sep_vel=rel_vel.dot(ci.normal);

    float tot_i_mass=b1->i_mass+b2->i_mass;

    b1->vel+=ci.normal*(-ci.pen*(1.0f/(float)FPS)*k+sep_vel*d)*((b1->i_mass/(tot_i_mass));
    b2->vel-=ci.normal*(-ci.pen*(1.0f/(float)FPS)*k+sep_vel*d)*((b2->i_mass/(tot_i_mass));

}

In Topic: How to create a circular orbit and an angry bird space like orbit ?

17 April 2015 - 12:09 AM

Believe me deltaweb, it's a much more rewarding experience to actually learn the theory, implement it yourself and see it work than just hack something toghether that only looks real. I should have seen this coming, but I overlooked the angry birds warning. :-)


In Topic: How to create a circular orbit and an angry bird space like orbit ?

16 April 2015 - 10:41 AM

deltaweb, I'm not certain what you mean, could you make a more detailed description? does the gameobject go into orbit even if it's not a circular one? Can the central planet move by applying force to it, or is it fixed in place?


PARTNERS