This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2012-08-23 10:21:21

Scratcher456
Scratcher
Registered: 2010-12-04
Posts: 58

Creating a Realistic Glider Engine

So... I'm working on a game where you're like this sort of James Bond, Mission Impossible, super spy-ish... dude. In the first level you have to use your epic spy glider to infiltrate the enemy base. Just one problem: the glider. I can't seem to come up with a reasonably good glider script. I just need something that will start at one corner of the screen and be flown to the bottom in a controlled way. The important bits:

1. The glider has to model lift, drag, and gravity. In other words, all the important things about flying.

2. The glider has to have some way of telling how hard you hit the 'ground', and saying that you died if you hit too hard.

3. I don't really care what the glider looks like, if it's not what I want, I'll make a new costume for it.

4. If anyone wanted to help with the rest of this game, I'd be much obliged.  smile


Mining diamonds, mining diamonds, mining diamonds...

Offline

 

#2 2012-08-23 18:59:11

Scratcher456
Scratcher
Registered: 2010-12-04
Posts: 58

Re: Creating a Realistic Glider Engine

Ermegerd. Bump.


Mining diamonds, mining diamonds, mining diamonds...

Offline

 

#3 2012-08-24 13:40:54

fg123
Scratcher
Registered: 2008-11-13
Posts: 1000+

Re: Creating a Realistic Glider Engine

Does this seem like what you want?
http://scratch.mit.edu/projects/fg123_tests/2745191


Hai.

Offline

 

#4 2012-08-24 13:50:58

Molybdenum
Scratcher
Registered: 2012-06-17
Posts: 1000+

Re: Creating a Realistic Glider Engine

fg123 wrote:

Does this seem like what you want?
http://scratch.mit.edu/projects/fg123_tests/2745191

No, that's a rocket engine. I think he needs a glider engine like the one in Learn to Fly (the flash game, not the scratch project).


"The Enrichment Center is required to remind you that you will be baked, and then there will be cake."
(|Balls and Platforms: Stay on!|) (|NaOS-H: An operating system... Or is it?|)

Offline

 

#5 2012-08-24 14:03:12

fg123
Scratcher
Registered: 2008-11-13
Posts: 1000+

Re: Creating a Realistic Glider Engine

I see, that shouldn't be too hard, if he is looking for something like that.


Hai.

Offline

 

#6 2012-08-24 16:34:24

Scratcher456
Scratcher
Registered: 2010-12-04
Posts: 58

Re: Creating a Realistic Glider Engine

fg123 wrote:

I see, that shouldn't be too hard, if he is looking for something like that.

Do you think you could try that?


Mining diamonds, mining diamonds, mining diamonds...

Offline

 

#7 2012-08-24 16:41:45

Scratcher456
Scratcher
Registered: 2010-12-04
Posts: 58

Re: Creating a Realistic Glider Engine

Molybdenum wrote:

fg123 wrote:

Does this seem like what you want?
http://scratch.mit.edu/projects/fg123_tests/2745191

No, that's a rocket engine. I think he needs a glider engine like the one in Learn to Fly (the flash game, not the scratch project).

OK, so, I just played Learn To Fly, and basically, that's about it. Just... maybe a bit less pudgy and that actually FLIES to start with XD.


Mining diamonds, mining diamonds, mining diamonds...

Offline

 

#8 2012-08-24 16:44:40

Molybdenum
Scratcher
Registered: 2012-06-17
Posts: 1000+

Re: Creating a Realistic Glider Engine

Scratcher456 wrote:

Molybdenum wrote:

fg123 wrote:

Does this seem like what you want?
http://scratch.mit.edu/projects/fg123_tests/2745191

No, that's a rocket engine. I think he needs a glider engine like the one in Learn to Fly (the flash game, not the scratch project).

OK, so, I just played Learn To Fly, and basically, that's about it. Just... maybe a bit less pudgy and that actually FLIES to start with XD.

Technically, the gliders in LtF don't fly, they glide. The only way to actually fly in LtF is with rockets.


"The Enrichment Center is required to remind you that you will be baked, and then there will be cake."
(|Balls and Platforms: Stay on!|) (|NaOS-H: An operating system... Or is it?|)

Offline

 

#9 2012-08-24 17:32:25

fg123
Scratcher
Registered: 2008-11-13
Posts: 1000+

Re: Creating a Realistic Glider Engine

So you want scrolling and like a landing pad to land on?


Hai.

Offline

 

#10 2012-08-24 20:02:28

gamer2012
Scratcher
Registered: 2011-04-17
Posts: 100+

Re: Creating a Realistic Glider Engine

I saw this yesterday and started work on an engine. I'm not done with it (and I won't add scrolling), but it will meet all other requirements.


Coming soon: Nothing much 'till Scratch 2.0. Oh, here's one of my classics!  tongue  Square Quest: (You BETTER click here!!! XD)

Offline

 

#11 2012-08-24 20:52:48

Scratcher456
Scratcher
Registered: 2010-12-04
Posts: 58

Re: Creating a Realistic Glider Engine

It doesn't need to scroll, if it turns out that I need more room to fly in, I'll just scale down the glider and the variables to make more out of less. I am pretty bad with physics in Scratch beyond simple gravity and stuff, so... Yah.


Mining diamonds, mining diamonds, mining diamonds...

Offline

 

#12 2012-08-25 08:47:01

Scratcher456
Scratcher
Registered: 2010-12-04
Posts: 58

Re: Creating a Realistic Glider Engine

gamer2012 wrote:

I saw this yesterday and started work on an engine. I'm not done with it (and I won't add scrolling), but it will meet all other requirements.

It's fine without scrolling. I hadn't planned on having it in there, anyway. If it turns out I need more room, I can just scale down the glider and all the variables and make less look like more.


Mining diamonds, mining diamonds, mining diamonds...

Offline

 

#13 2012-08-25 14:16:14

amcerbu
Scratcher
Registered: 2009-07-21
Posts: 500+

Re: Creating a Realistic Glider Engine

I'll get on it.  It shouldn't take me too long; I've got an idea about how to do it. 

The most important part of this entire engine is the part that takes the current angle and the current velocity and figures out the new velocity.  It's actually not terribly hard.  Here's how you do it:

- Project the current velocity vector onto the angle vector.  You can then find the vector rejection by subtracting the projection from the old velocity. 
- Multiply the projection by a friction variable, and multiply the rejection by an efficiency vector which represents how much air the glider catches.  For gilder efficiency, 0 represents "perfect gliding," where just being horizontal prevents you from falling at all, 1 is no gliding, and basically makes the script the same as a normal velocity script.  I would choose a value around 0.3. 
- Add together the newly scaled projection and rejection variables to get the velocity. 
- Change x and y by velocity. 

And that's all!  I'll upload an example to my test account some time soon.

Last edited by amcerbu (2012-08-25 14:16:58)

Offline

 

#14 2012-08-25 14:47:34

Scratcher456
Scratcher
Registered: 2010-12-04
Posts: 58

Re: Creating a Realistic Glider Engine

amcerbu wrote:

I'll get on it.  It shouldn't take me too long; I've got an idea about how to do it. 

The most important part of this entire engine is the part that takes the current angle and the current velocity and figures out the new velocity.  It's actually not terribly hard.  Here's how you do it:

- Project the current velocity vector onto the angle vector.  You can then find the vector rejection by subtracting the projection from the old velocity. 
- Multiply the projection by a friction variable, and multiply the rejection by an efficiency vector which represents how much air the glider catches.  For gilder efficiency, 0 represents "perfect gliding," where just being horizontal prevents you from falling at all, 1 is no gliding, and basically makes the script the same as a normal velocity script.  I would choose a value around 0.3. 
- Add together the newly scaled projection and rejection variables to get the velocity. 
- Change x and y by velocity. 

And that's all!  I'll upload an example to my test account some time soon.

See, this is why I ask for help on the forums... People like you actually understand this stuff, whereas it all goes completely over my head...


Mining diamonds, mining diamonds, mining diamonds...

Offline

 

#15 2012-08-25 15:10:23

amcerbu
Scratcher
Registered: 2009-07-21
Posts: 500+

Re: Creating a Realistic Glider Engine

Here's the link (it's my test account):
http://scratch.mit.edu/projects/ubrecma/2746805

Offline

 

#16 2012-08-25 19:25:58

Scratcher456
Scratcher
Registered: 2010-12-04
Posts: 58

Re: Creating a Realistic Glider Engine

Thank you to everyone who posted on here! Amcerbu came up with just what I was looking for. However, if anyone else has a glider engine, I (and probably quite a few other people) would like to see them, so post away!


Mining diamonds, mining diamonds, mining diamonds...

Offline

 

#17 2012-08-30 17:02:31

gamer2012
Scratcher
Registered: 2011-04-17
Posts: 100+

Re: Creating a Realistic Glider Engine

Should've posted this a WHILE ago: http://scratch.mit.edu/projects/gamer2012TEST/2746658

When you said glider, I assumed "hang glider". XD


Coming soon: Nothing much 'till Scratch 2.0. Oh, here's one of my classics!  tongue  Square Quest: (You BETTER click here!!! XD)

Offline

 

#18 2012-08-31 18:31:33

gamer2012
Scratcher
Registered: 2011-04-17
Posts: 100+

Re: Creating a Realistic Glider Engine

Updated version with scrolling and horizontal currents: http://scratch.mit.edu/projects/gamer2012/2756613

Last edited by gamer2012 (2012-08-31 18:32:15)


Coming soon: Nothing much 'till Scratch 2.0. Oh, here's one of my classics!  tongue  Square Quest: (You BETTER click here!!! XD)

Offline

 

Board footer