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

#1 2013-05-02 08:35:29

PERCE-NEIGE
Scratcher
Registered: 2009-05-24
Posts: 9

A parabolic equation

Hi,

I have a character who throw a ball to another one in one of my script, I want the ball to follow a parabolic way. I don't remember what is the equation for a parbolic throw?
Please, give me hints one by one, I'd like to see if I can do it by myself with your hints.
If I'm stuck, I'll ask you for other hints on this same thread.

Thanks!


Frenchie :-)

Offline

 

#2 2013-05-02 12:29:35

firedrake969_test
Scratcher
Registered: 2012-08-08
Posts: 500+

Re: A parabolic equation

Here's some pseudocode for you to get an idea:
go to start
set yv to (y velocity whatever you want, about 5-15)
set xv to (x velocity whatever you want, about 15+)
forever
     change x by xv
     change y by yv
     set yv to yv * .98
     set xv to xv * .98
     change yv by -1



Hope that helped!

Oh, and welcome, Snowdrop!

Last edited by firedrake969_test (2013-05-02 12:56:14)


Alt of Firedrake969.

Offline

 

#3 2013-05-02 16:01:01

ErnieParke
Scratcher
Registered: 2010-12-03
Posts: 1000+

Re: A parabolic equation

firedrake969_test wrote:

Here's some pseudocode for you to get an idea:
go to start
set yv to (y velocity whatever you want, about 5-15)
set xv to (x velocity whatever you want, about 15+)
forever
     change x by xv
     change y by yv
     set yv to yv * .98
     set xv to xv * .98
     change yv by -1



Hope that helped!

Oh, and welcome, Snowdrop!

Ummm... That wouldn't follow a parabolic arch. The y velocity would eventually flatten out to 50, and would never exceed that, making this some weird equation that's not parabolic, which isn't needed here.

To PERCE-NEIGE:
Well, since your asking for the equation and not some code, here are two hints:

-b
___
2a

x^2


I hope that this helps!

With regards,

ErnieParke

Last edited by ErnieParke (2013-05-02 16:02:01)


http://i46.tinypic.com/35ismmc.png

Offline

 

#4 2013-05-03 02:30:13

PERCE-NEIGE
Scratcher
Registered: 2009-05-24
Posts: 9

Re: A parabolic equation

Thank you! Just perfect.
Yes, -b/2a reminds me something! I brainstorm and I come back when I'm free.


Frenchie :-)

Offline

 

#5 2013-05-03 16:29:10

Hyperbola
Scratcher
Registered: 2013-03-15
Posts: 100+

Re: A parabolic equation

ErnieParke wrote:

firedrake969_test wrote:

Here's some pseudocode for you to get an idea:
go to start
set yv to (y velocity whatever you want, about 5-15)
set xv to (x velocity whatever you want, about 15+)
forever
     change x by xv
     change y by yv
     set yv to yv * .98
     set xv to xv * .98
     change yv by -1



Hope that helped!

Oh, and welcome, Snowdrop!

Ummm... That wouldn't follow a parabolic arch. The y velocity would eventually flatten out to 50, and would never exceed that, making this some weird equation that's not parabolic, which isn't needed here.

I think it's like a version with air resistance, except the formula isn't exactly right (I think the air resistance force was proportional to something like v^2, not v.


Tip of the whatever: Don't post in threads older than 2 weeks unless your post will actually be useful.
It's the last day of 1.4! *cries* (quote from NeilWest, rest by me) by the time you read this it probably will be 2.0  sad

Offline

 

#6 2013-05-04 08:56:47

Firedrake969
Scratcher
Registered: 2011-11-24
Posts: 1000+

Re: A parabolic equation

ErnieParke wrote:

firedrake969_test wrote:

Here's some pseudocode for you to get an idea:
go to start
set yv to (y velocity whatever you want, about 5-15)
set xv to (x velocity whatever you want, about 15+)
forever
     change x by xv
     change y by yv
     set yv to yv * .98
     set xv to xv * .98
     change yv by -1



Hope that helped!

Oh, and welcome, Snowdrop!

Ummm... That wouldn't follow a parabolic arch. The y velocity would eventually flatten out to 50, and would never exceed that, making this some weird equation that's not parabolic, which isn't needed here.

To PERCE-NEIGE:
Well, since your asking for the equation and not some code, here are two hints:

-b
___
2a

x^2


I hope that this helps!

With regards,

ErnieParke

Actually it would...

Even if it theoretically wouldn't work, it works in practice.

EDIT:  E-P, if you're reading this, it does work.  I'm uploading a proof-of-concept project soon.  So yes, it does work, P-N.

Last edited by Firedrake969 (2013-05-05 16:17:39)


Click the sign.
https://s3.amazonaws.com/eterna/eterna2/logo2.png

Offline

 

#7 2013-05-04 09:09:35

dracae
New Scratcher
Registered: 2013-04-05
Posts: 42

Re: A parabolic equation

IDK, but maybe

set y to ((((x position) * (x position)) * (-0.25)) + (100))

Offline

 

#8 2013-05-04 10:42:02

7734f
Scratcher
Registered: 2010-12-23
Posts: 500+

Re: A parabolic equation

PERCE-NEIGE wrote:

Thank you! Just perfect.
Yes, -b/2a reminds me something! I brainstorm and I come back when I'm free.

It's quadratic Form  wink

Part of it anyway...

Last edited by 7734f (2013-05-04 10:42:15)


http://internetometer.com/image/38992.png   http://i37.tinypic.com/2qixx6c.png

Offline

 

Board footer