Weird distance behaviour

Non-platform specific questions.

Weird distance behaviour

Postby Troodon » Tue Jun 26, 2007 5:24 pm

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;
}
I can't die, I already tried
~on the forums since GE 1.3.3~
User avatar
Troodon
 
Posts: 1539
Joined: Thu Jan 12, 2006 3:29 pm
Location: HELL
Score: 56 Give a positive score

Postby pixelpoop » Tue Jun 26, 2007 8:19 pm

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?
User avatar
pixelpoop
 
Posts: 276
Joined: Tue Aug 29, 2006 9:32 pm
Score: 28 Give a positive score

Postby Troodon » Tue Jun 26, 2007 9:31 pm

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.
I can't die, I already tried
~on the forums since GE 1.3.3~
User avatar
Troodon
 
Posts: 1539
Joined: Thu Jan 12, 2006 3:29 pm
Location: HELL
Score: 56 Give a positive score

Postby pixelpoop » Wed Jun 27, 2007 3:08 am

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.
Attachments
distance_test.zip
shows where the distance function calculates from
(198.16 KiB) Downloaded 115 times
User avatar
pixelpoop
 
Posts: 276
Joined: Tue Aug 29, 2006 9:32 pm
Score: 28 Give a positive score

Postby Troodon » Wed Jun 27, 2007 8:41 am

Ok, thanks.
I can't die, I already tried
~on the forums since GE 1.3.3~
User avatar
Troodon
 
Posts: 1539
Joined: Thu Jan 12, 2006 3:29 pm
Location: HELL
Score: 56 Give a positive score


Return to General

Who is online

Users browsing this forum: No registered users and 1 guest