Advertisement Jump to content
  • Advertisement


  • Content Count

  • Joined

  • Last visited

Community Reputation

255 Neutral

About Kurt-olsson

  • Rank

Personal Information

  • Interests
  1. Hi When i started out i had big troubles with collision detections and collision response, i tried several months/years (on and off) and did not get any progress. But i kept on trying and i improved my code. 😃 I remember when starting out i was looking for a small noncomplex code/samples that i could look at but there werent not many that was simple and easy to setup. So now i have a small Demo in JavaScript that i would like to share. I think this is a simple way to solve CollisionResponse and maybe someone can use this or find this helpful. Collision Detection Sphere.html Oh, it also shows the problem when the velocity gets bigger than the spheres radius and the "tunneling" effect occurs. 😃 Oh, a tip that always is repeated. Start small, (means do not make a Quake 3 replica in Direct3D like i did) Visualize everything (thats how you find bugs) Brake problems down to very tiny and small and solve from there.
  2. Hi.   I am pretty confused about what routine to take when trying to create a 2d scroller game. I want to use a rectangle as bounding box and i want to have all kinds of angles and rotating objects, elevetors etc.   right now i like "the move -> get penetration delta ->push back" concept, this is the one i get to be stable without jittering. And with recursive checks this works great in small corners etc. Also other moving objects "pushes" the player for "free"   If i try to sweep and get the TOI and change the velocity to sliding for example, this always gives me jitters and jerkiness. The same with the oldPos vs newPos when saving position and then check for collisions and if found, then revert back to the safe position. This i also get jitters when implement. Should i still be doing the "push-back" even if i calculate the TOI?     What is the "standard" way of doing when creating a FPS in 3D and in my example 2D scroller.   The problem with the push right now is that i get sliding from the gravity vector even though my velocity is set to zero, this is due to the pushback vector. So this is why i want to try something new, otherwise i really like that technique.   And if you were to do a 2D scroller with different angles for floors, would you use AABB and then line intersection? I am checking the minkowskis sum, but i think there might be simpler stuff for the scroller.     I am stuck with prototyping right now and cant get progress, so any input is helpful =) 
  3. Kurt-olsson

    Practical Collision Detection

    Wow, wonder if it is the "real" Jonathan Blow that published this? The dude is a rock star! I have listen to so many sessions by him and he has so many smart things to say! Love the "Game prototype" session. So much good content and i like the "hardcoded vs generic" topic. I have always agreed that the simplest solution is often more powerful! =)   This article is easily 5/5!
  4. Kurt-olsson

    Am i missing something, can i sweep like this?

    Thanks for all replies.   Yeah, i think i have to look at the more traditional AABB, OBB intersections techniques.   Now i am starting to read up on Minkowskis sum, that seems to be very nice way for handeling polygons of all shapes. If i can just add and use the algorithm right it should be easy to cast a ray and get the intersection point as well.   I really got it to work with the Sphere, but it is not good in 2D scrolling game. Now i want to use a rectangle instead. =(
  5. Hi.   I am thinking of a way to sweep polygons and rectangles against another polygon and get the Time of Impact.   If i draw lines between the vertexes startposition and endpositionof the polygon (or rectangle) and test those lines for intersections of the other polygon (or rectangle).  If i then take the intersection point and compare it to the length of that line, that will give me time of impact.   It has of course be the earliest time of impact compared with all the intersections.   Can i really do it like this? It would be great, because then i can only do line-line intersection test between the vectexes of the shapes.     i submitted a file to illustrate this better.   I am using a sphere in my game now, and i dont think it works with my character.    
  6. Thanks alot. Didnt think the last 5% should be so tricky, but it is lots of trimming to get the jump and friction plus slide to work and create a good gameplay. Excellent links, thank you very much.
  7. 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 =;                 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?        
  8. Kurt-olsson

    Capsule line intersectionpoint only

    I did some test with two points and 3 rays that were traced for collision. I ended up with just shooting one ray for my solution and i also didnt need to have the exact position of collision, this is just to prevent the player from going through walls at great speeds.    It ended up working great with just line-line intersection checks and then cut the velocity with the time (vel / distance of intersection) - some small value to be safe. I forgot to say this is only in 2D.   thanks for the help! 
  9. 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?
  10. Kurt-olsson

    Frustrating climb and descent energy (velocity)

    Ok. I just want to share how i solved this.   Frist misstake.   My thrust and drag and lift was NOT predicular to the wings. They need to be. Once they are, the vectors iteself will create drag against the weight when climbing. After fixing my other problem (had only one engine hehe) the aircraft climbs really really well and have the same speeds as in the real 737.   Problem solved
  11. Kurt-olsson

    Frustrating climb and descent energy (velocity)

    I dont simulate rotation in my simple 2D. But i am taking all real world values of the 737-800. I have added a picture where i print all my values. Lift is Correct, Drag is correct, Weight is correct,Altitude Density is correct. (not taking temperature into count right now though) Thrust is correct. But still i think the airplane climbs to easy.   I have one thing to solve, and that is forward acceleration on desc, and backwards weight force when climbing. Then i think i would hit the numbers like in real simulators.   Here is a picture of my game just after takeoff (the rotation speed was a littlebit high, but this is for flaps 0!, in real life flaps 1-15 is used.)[attachment=26199:climbdescproblem.png]
  12. Kurt-olsson

    Frustrating climb and descent energy (velocity)

    Ok so if i understand this correct, i will end up with this picture. You think this looks correct?   [attachment=26197:climbdescproblem2.png]
  13. Kurt-olsson

    Frustrating climb and descent energy (velocity)

    Ok. it makes more sence that it is only gravity thats the "affecting" force when goining speed on descent. I guess i can calculate depending on what pitch the aircraft has the amount (fraction) of that gravity is giving thrust forward.   This has been a tip from previous member for me.   But is it also gravity that makes the airspeed loss when climbing? So then the thrust is directed backwards (a fraction of the gravity, that will say)?
  14. 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? [attachment=26178:climbdescproblem.png]   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;
  15. Kurt-olsson

    temporary force, how to best code

    Many thanks Erik, then i am not so off at all.  I will use the "external" force.   I will prob do as you suggest with a wind-object that lives over time with different dir and vel.
  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. 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!