Hi, i'm wondering if anyone can help me with a maths problem that's been bugging me, i'm trying to code a kind of black hole, that will suck particles towards the center. But i can't seem to work out the angle between the particles current x,y, and the center of the black hole. Here's some psuedo code to show you what i'm doing wrong...
Can anyone explain how to fill in the gap?
Any help much appreciated :)
Method Particle.Update() For Dist:Distorter = Eachin Distorters Range = Sqr(DX * DX + DY * DY ) If Range < Dist.Radius Dist.ProcessParticle( Particle, Range, DX, DY ) Endif Next End Method Method Distorter.ProcessParticle(Particle:Particle, Range, DX, DY) Local Strength:Float = 1 - (Range / Dist.Radius ) 'Here's where im stuck... need to calculate the new angle so the particle will face the center of the black hole Particle.X = Particle.X + ( NewX * Strength ) Particle.Y = Particle.Y + ( NewY * Strength ) End Method
Can anyone explain how to fill in the gap?
Any help much appreciated :)