Page 1 of 1

Weird distance behaviour

PostPosted: Tue Jun 26, 2007 5:24 pm
by Troodon
Hi,
I've got this in the draw actor of actor Rocket. It works perfectly without the altitude line but with the altitude line it starts shaking and finally goes throw the ground and disappears somewhere down left. Maybe somebody sees what I made wrong? Or is it a bug? The rocket isnt touching the ground. (it's on a launchpad)

Code: Select all
yvelocity -= kiihtyvyys;
temp = temp_out + temp_in;
mass = 89000 + mass_payload + fuel;
altitude = distance(Rocket.x, Rocket.y, ground.x, ground.y);

if (burning == 1 && fuel >= 0)
{
    kiihtyvyys = 356/mass;
    CreateActor("smoke", "smoke 01", "no parent", "no path", 7, 20, false);
}

if (burning == 0 && altitude > 0)
{
    kiihtyvyys -= 1;
}

PostPosted: Tue Jun 26, 2007 8:19 pm
by pixelpoop
I think you just want the distance off the ground right? and not the distance on the x axis?
maybe you shouldn't use distance and just use altitude=Rocket.y-ground.y;

or am I missing what you are trying to do?

PostPosted: Tue Jun 26, 2007 9:31 pm
by Troodon
I tried the y2-y1 code earlier but it didn't work. Now I realised that I had a problem in my code and after solving it it worked. But what's the point where it counts the distance pixel? I think it counts from the most left and upper pixel.

PostPosted: Wed Jun 27, 2007 3:08 am
by pixelpoop
only one way to find out...
hint: it calculates from the middle of the actors you don't need to download the example.
Although it does calculate from the top left for the view actor.

PostPosted: Wed Jun 27, 2007 8:41 am
by Troodon
Ok, thanks.