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!


KurtO

Member Since 05 Dec 2011
Offline Last Active Today, 12:04 PM

Topics I've Started

2D scroll game gravity problem with "slide" and "update after collision...

25 July 2015 - 04:23 PM

Hi!

 

I am almost finished with my 2D engine that supports polygons with all angles.

the way i do collision detection is:

 

move();

update() //pushed the players out again if there was some penetration that was not permitted (this is done recursivly with the smallest TOI first)

 

everything works great, BUT

 

one small thing is if my player is standing on a very small hill, he continues to slide very very small distance in the x-axis.

 

this is becuase the gravity vector is always added and the the player is being pushed down, and with the corrections it is resulting with a movement..

 

The way i slide is this:

                var dotN = current_pushvector.dot(game.player.vVel);
                game.player.vVel.x -= (current_pushvector.x * dotN);
                game.player.vVel.y -= (current_pushvector.y * dotN);

 

But this is wrong for 2D scrollers i think.

 

What kind of collision response do you do on 2D scrollers?

 

 

 

 


Capsule line intersectionpoint only

24 July 2015 - 05:44 AM

Hi

I have made a capsule by making two circles and two lines between them (on the edges)

I use lineintersection and closest point to find out if the capsule intersects any lines, this works perfect and i get the intersectionpoint on the lines and where the closest point to the sphere is.

My problem is, i cannot get the circles intersectionpoint with radius. I have tried cutting velocity according to distance etc but its only working 95% correctish.

Is it possible to get the circle intersection from the capsule intersection point?

Frustrating climb and descent energy (velocity)

01 March 2015 - 03:59 AM

I have a problem with my flight model. I miss the part with velocity acceleration during descent and extra drag during climb.

I have implemented Drag curve and Lift curve against these formulas. And it works really good. I only miss the extra energy (kinetic) when descending and loss of energy when climbing.

 

Iam not sure i have understood the resulting drag/acc to the models and cant find good resources on this.

 

I have attached an image to see if i have understood this correct.

 

Do you know if this is the correct approach?

Attached File  climbdescproblem.png   15.67KB   0 downloads

 

My lift function

 

  // L = Lift in Newton.
            // P = Airdensity kg / m3
            // V = velocity in m/s
            // S = Wingarea m2
            // Cl = Lift Coefficient - Angle of Attack lookup table (99% it is devided by ten)
            // L = (P / 2) * V^2 * Cl * S
            var L = (this.getCurrentAirDensity() / 2) * Math.pow(this.getVelocity(), 2) * this.getCoefficcientValue(ClCurve) * this.wingarea;
 
            return L;
 
My drag function
 
  // D = Drag
            // P = Airdensity kg / m3
            // V = velocity in m/s
            // S = Wingarea m2
            // Cd = Drag Coefficient - Angle of Attack lookup table (99% it is devided by ten)
            // D = Cd * S * 0.5 * P * V^2
            var D = this.getCoefficcientValue(ClDrag) * this.wingarea * 0.5 * this.getCurrentAirDensity() * Math.pow(this.getVelocity(), 2);
            return D;

temporary force, how to best code

26 February 2015 - 05:16 AM

Ok.

 

Lets say i have a sprite that have a weight * gravity.

 

How do you best code some "random" input force on the sprite?

 

Do you code the force like a particle system, min-force, max-force, force direction, and delta time the force has to develop.

 

Basically i am coding a small flight game and i want to simulate different wind-forces affecting the airplane.

I know how to do this, but i dont know if i am doing a good coding pattern for this.

 

 

airplane has 4 forces = lift weight drag and thrust.

 

I want to simulate a small wind force blowing the airplane up, i don´t want to include this is my basic formula for flying. I just want to push the airplane around i guess.

 

How would your approach be for this?

 

 


Calculate glide speed/thrust

24 February 2015 - 03:28 PM

Hello again! =)

 

I am having some trouble with my 2d flight simulator.

Does anybody have a formula for the thrust created forward when the airplane is pitched forward without engines, just gliding?

 

Basically i have my airplane flying with very good numbers with engine-thrust. But if i cut power, i wont accelerate if i point the nose down. (neither with engines)

 

I have some thought about taking the -angle-of-attack and take the absolute number and multiply it against some constant so that the thrust force increases when the angle of attack decreases.

But this is just a hack.

 

I wonder if there is a formula for this? Depending on Weight,angle of attack, Wingspan etc what thrust is being produced?


PARTNERS