Jump to content

  • Log In with Google      Sign In   
  • Create Account

h4tt3n

Member Since 02 Apr 2008
Offline Last Active Yesterday, 06:57 AM

#5271558 Rope and sails?

Posted by h4tt3n on 17 January 2016 - 10:06 AM

Two things here:

 

First thing - As a seasoned sailer (viking ships) I'd like to point out that there is much more to sails than "the wind fills it like a bag and pushes the ship forward". What accellerates the ship is really the sucktion created *in front of* the sail, not the wind caught behind it. Sailships move considerably faster when the wind hits the sail edge-on, at a less-than 90 degree angle to the direction the ship is sailing in, than when the ship moves directly down wind, and the sail is expanded by the wind like a balloon. In other words, a sailship will move much faster at - say - 40 degrees up against the wind than with the wind coming directly from behind!  Programming this is going to be non-trivial.

 

Second thing - Ropes and sail (cloth) can easily be programmed with point masses and springs. If you implement an iterative method you'll get incredibly stable and rigid materials. I can give you some small, fuctional code samples to work with, but you may have to translate them to your own preferred programming language.

 

Cheers, Mike




#5266775 Spaceship course calculation

Posted by h4tt3n on 17 December 2015 - 08:50 AM

Well, since there is a good deal of non-physics going on, like stars with fixed positions, kinematic clockwork orbits and ftl warp speed space travel, I suggest a non-physical solution. Simply make the ship disappear from its starting position and re-appear in orbit around the desired target after a pre-determined travel time.




#5223871 How to create a circular orbit and an angry bird space like orbit ?

Posted by h4tt3n on 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. :-)




#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 velocity-part 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 N-Body 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 good-enough ok?

 

"Good-enough" is sufficient, using RK4 integration along with the Barnes-Hut 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 n-body 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 time-stepping 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 two-body interaction.

 

http://en.wikipedia.org/wiki/Kepler%27s_laws_of_planetary_motion

http://www.slideshare.net/IngesAerospace/orbital-mechanic-4-position-and-velocity-as-a-function-of-time

 

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 so-called 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

 
Cheers,
Mike



#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 pre-defined recipies, but instead let the properties of the potion emerge from some pre-defined laws. THis way, not even the game designer himself knows what might happen in every case. This is essentially what makes physics-based games so rewarding, and why they have such a high degree of re-playability. So instead of pre-coding a limited number of recipies, you need to pre-code 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




#5012122 billiard/pool balls

Posted by h4tt3n on 18 December 2012 - 12:07 PM

Hi there,

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.real-world-physics-problems.com/physics-of-billiards.html

Cheers,
Mike




PARTNERS