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. :)
 Home
 » Viewing Profile: Reputation: h4tt3n
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 2008Offline Last Active Today, 11:35 AM
About Me
Blacksmithing
For the last decade and a half Mike has made a living off traditional blacksmithing, recreating iron age and viking era tools and weapons. Courses and school projects take up a big part of the time too, sharing the interest of ancient metal with other people.
Iron Smelting
As one of very few people in the world, Mike has learned the ancient craft of turning local ore into iron and steel in the same fashion as his ancestors, the danish vikings. The metal is folded and processed in much the same way as by japanese swordsmiths, and is forged into replicas of prehistoric tools and weapons.
Programming
Like so many others, Mike started programming on the Commodore 64, and later on the Amiga 500. While not having made coding a way of living, Mike has maintained his interest in this field and is today a self taught programmer, spanning across several languages, from HTML and php over the mean and fast FreeBASIC to C++. The main driving force is the everpresent fascination with physics simulations and all their applications.
Other Interests
When not doing any of the above, Mike is spending his time building, maintaining, and sailing viking ship replicas, horse riding, skiing (when the winters are snowy), and reading. Mike is also a pretty good draftsman, but he doesn't use that skill much at the time.
Community Stats
 Group Members
 Active Posts 406
 Profile Views 5,475
 Submitted Links 0
 Member Title Member
 Age 38 years old
 Birthday May 23, 1976

Gender
Male

Location
Denmark
#5223871 How to create a circular orbit and an angry bird space like orbit ?
Posted by h4tt3n on 17 April 2015  12:09 AM
#5222751 inifinite mass and a jitter problem
Posted by h4tt3n on 12 April 2015  09:16 AM
In my opinion the most robust solution is always to only apply some fraction of the total needed impulse, and then iterate through the velocitypart of the constraint until it reaches an equilibrium.
#5222672 inifinite mass and a jitter problem
Posted by h4tt3n on 11 April 2015  05:45 PM
Could it simply be that while the corrective impulse from interacting with brick #1 is exactly enough to counter the finite mass objects perp velocity vector due to movement and gravity, the the impulse caused by interaction with brick #2 does not take this into account and applies the same impulse, resulting in overshoot? I've experienced similar behaviour in some of my innumerable physics experiments.
Cheers,
Mike
#5222668 How to create a circular orbit and an angry bird space like orbit ?
Posted by h4tt3n on 11 April 2015  05:31 PM
Hi there,
Regarding your first problem, it seems that you have forgotten to apply the velocity perpendicular to the distance vector. Rather it seems like you are applying it in the direction of the attracting body. You do this by making the normalized vector perpendicular: n(x, y) > n(y, x) or n(y, x) depending on wether you want a clockwise or ccw orbit.
Regarding the second problem, angry birds space has very little to do with actual physics, so there can't be a definitive answer. Can you describe the desired effect in a little more detail? (Haven't played the game much).
Cheers,
Mike
#5217687 Star System NBody Simulation Over Long Time Periods
Posted by h4tt3n on 19 March 2015  12:29 PM
As long as the simulation is stable, do you really need high accuracy anyway, or is goodenough ok?
"Goodenough" is sufficient, using RK4 integration along with the BarnesHut method (for adaptive time steps and less complexity), together allowing me to increase time steps might do the trick. The system tends to become more stable over time and is initially rather chaotic with objects colliding frequently which is where more accuracy would be necessary. Anyway, I will see how that goes and report back later.
RK4 integration is *not* a good choice for nbody simulations, as it is not symplectic and looses energy over time. Instead I would like to recommend David Whysong's symplectic integrators, which can be found here:
http://www.projectpluto.com/symp.cpp
If you replace the timestepping method with Keplers equations of planetary motion, you can accurately compute the position of any celestial body at every conceivable point in time. The drawback is that the equations are limited to twobody interaction.
http://en.wikipedia.org/wiki/Kepler%27s_laws_of_planetary_motion
Cheers,
Mike
#5203057 Maths for maths haters
Posted by h4tt3n on 09 January 2015  05:20 AM
I'd like to join in and recommend the Khan Academy.
#5191904 Trajectory of a projectile
Posted by h4tt3n on 09 November 2014  01:41 AM
Hello there, you have made a good start. There are two ways of making the tracectory: A socalled analytic one, where the entire trajectory is computed once and for all. And a discrete one, where the projectile moves a little step at a time. For each step, gravity, and perhaps air resistance is added, and when you repeat the steps, the trajectory arc appears. The first method is good if you just want the trajectory and wants to know if you hit or not. The other one is good if you want an actual cannon ball which can bounce off planes, roll around, and be influenced by many different forces.
#5144448 Separating axis Theorem rotation issue
Posted by h4tt3n on 04 April 2014  03:30 PM
Hi Aardvajk. I don't actually calculate the distance, since it is not needed. If you want the distance, you need to solve the Pythagorean theorem, which means calling square root. It's getting late here in Europe so I won't go into a lengthy explanation on SAT, but here are some links you might find useful:
http://www.geometrictools.com/Documentation/MethodOfSeparatingAxes.pdf
#5144278 Separating axis Theorem rotation issue
Posted by h4tt3n on 04 April 2014  01:23 AM
@nicky95
It's hard to tell exactly what goes wrong without seeing any code.
@CJThomas
It seems like you are doing vector normalization in your code. This isn't necessary and requires a lot of cpu time. Your code should work just fine even if you remove "A.Normalize();"
Cheers,
Mike
#5123321 Jittering due to gravity and restitution
Posted by h4tt3n on 13 January 2014  11:52 AM
The damping you mention seems wrong. It should always apply force along some axis (along the constraint or normal to intersection), not just remove a fraction of all movement per game loop.
The folowing equation will compute the exact force to make your object align with the floor and come to rest in one step:
correction force =  ( object mass / timestep^2 ) * overlap distance along axis * coefficient  ( object mass / timestep ) * velocity along axis * coefficient
If you are dealing with impulses or velocities then the equation should be:
Correction impulse =  ( object mass / timestep ) * overlap distance along axis * coefficient  velocity along axis * coefficient
The coefficient is just a number between 0 and 1 determining how soft / rigid you want it to behave. Setting the coefficients to 1 will do the job in 1 loop, but may also introduce instability if there are several objects interacting at one time. Setting them between 0.5 and 0.05 should work just fine.
Cheers,
Mike
#5118623 Alchemy System, what would make alchemy fun?
Posted by h4tt3n on 21 December 2013  02:57 PM
Make it procedural. In ohter words, don't make a number of predefined recipies, but instead let the properties of the potion emerge from some predefined laws. THis way, not even the game designer himself knows what might happen in every case. This is essentially what makes physicsbased games so rewarding, and why they have such a high degree of replayability. So instead of precoding a limited number of recipies, you need to precode a limited number of laws or rules from which an infinite number of recipies will emerge.
Cheers,
Mike
#5066519 physics force problem
Posted by h4tt3n on 31 May 2013  02:51 PM
Hello Lomateron,
I've been working on the exact same problem, but I haven't solved it entirely yet. I've attached a small windows .exe + full source for a small program that propagates forces trough a chain of interconnected particles. It displays far more rigid behaviour than any iterative solver I know of. My method of doing this is very similar to yours, it seems :)
The only problem is that it's position based, and does not take velocity and acceleration into consideration. Still working on that...
Cheers,
Mike
Attached Files
 force propagation.zip 62.56KB 38 downloads
#5012122 billiard/pool balls
Posted by h4tt3n on 18 December 2012  12:07 PM
There ae already a few tutorials covering this topic. Here are a few good ones found by googling "pool physics"
I've implemented some of these myself, and it works just fine!
http://www.gamasutra.com/view/feature/3168/physics_on_the_back_of_a_cocktail_.php
http://archive.ncsa.illinois.edu/Classes/MATH198/townsend/math.html
http://www.realworldphysicsproblems.com/physicsofbilliards.html
Cheers,
Mike
#5005227 Learning Soft Body
Posted by h4tt3n on 29 November 2012  02:37 AM
A good place to start is to make a loop of particles connected with springs. Then calculate the restarea (or "2d volume") using the equation found here, and save it.
For each program loop, calculate the current area and calculate a pressure force, which could look like this:
Fpressure = stiffnes * (area  rest area)
Which is essentially just Hooke's law of elasticity in another form. Then, for each spring, apply a perpendicular pressure force to the particles in each end of the spring.
Integrate with time using your favourite algorithm and repeat. This will make the loop of springs into a neat little water balloon :)
Cheers,
Mike
#4991783 Problem getting correct orbits of planets
Posted by h4tt3n on 19 October 2012  08:28 AM
No. F = ma. a = F/m, and the force is defined as F = G m1m2/r^2, so a = F/m = G m/r^2. This is correct. Gravitational acceleration is independent of the "receiving" object's mass.
Yes, you are completely right  But only if you pick the right mass, and I suspect this is where the error lies. Bugs are often harder to find in optimized, compacted code, and that's why I recommend using the original Newtonian force based equation. Also, for the acceleration based calculation to work you need two equations, one for each body. A1 = G m2/r^2 and A2 = G m1/r^2. Otherwise your simulation will not conserve momentum. Sorry if my first post was a bit unclear, I was in a bit of a hurry when writing it.
Cheers,
Mike