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

#1 2012-02-20 07:31:29

bobbybee
Scratcher
Registered: 2009-10-18
Posts: 1000+

Projectile Angle

I'm working on some physics for a rocket projectile. The rocket can launch and move appropriately, however, I am having trouble getting the required trigonometry for direction. I am currently getting the difference between the last x/y and the new x/y, and then using the atan function with division, but the angle gets messed up when the slopes change.


I support the Free Software Foundation. Protect our digital rights!

Offline

 

#2 2012-02-20 07:34:44

roijac
Scratcher
Registered: 2010-01-19
Posts: 1000+

Re: Projectile Angle

script, bro

Offline

 

#3 2012-02-20 07:48:01

bobbybee
Scratcher
Registered: 2009-10-18
Posts: 1000+

Re: Projectile Angle

http://desmond.imageshack.us/Himg52/scaled.php?server=52&filename=snapfc.png&res=medium


I support the Free Software Foundation. Protect our digital rights!

Offline

 

#4 2012-02-20 10:49:49

bobbybee
Scratcher
Registered: 2009-10-18
Posts: 1000+

Re: Projectile Angle

bump.


I support the Free Software Foundation. Protect our digital rights!

Offline

 

#5 2012-02-20 11:12:53

Greenatic
Scratcher
Registered: 2009-05-03
Posts: 1000+

Re: Projectile Angle

Perhaps this project by Paddle2See might help?   hmm

Offline

 

#6 2012-02-20 15:24:52

bobbybee
Scratcher
Registered: 2009-10-18
Posts: 1000+

Re: Projectile Angle

Yeah, but I'm trying to do the physics, not just random trig.


I support the Free Software Foundation. Protect our digital rights!

Offline

 

#7 2012-02-20 19:06:45

nXIII
Community Moderator
Registered: 2009-04-21
Posts: 1000+

Re: Projectile Angle

I see two problems: (1) t does not change at the same rate as x, so you're stretching the function vertically; (2) you should use the atan2 function to map x, y -> θ, rather than just the atan function.


nXIII

Offline

 

#8 2012-02-20 19:21:22

bobbybee
Scratcher
Registered: 2009-10-18
Posts: 1000+

Re: Projectile Angle

How do you implement atan2 in Scratch?


I support the Free Software Foundation. Protect our digital rights!

Offline

 

#9 2012-02-20 19:26:02

nXIII
Community Moderator
Registered: 2009-04-21
Posts: 1000+

Re: Projectile Angle

bobbybee wrote:

How do you implement atan2 in Scratch?

http://en.wikipedia.org/wiki/Atan2#Definition


nXIII

Offline

 

#10 2012-02-20 20:09:36

what-the
Scratcher
Registered: 2009-10-04
Posts: 1000+

Re: Projectile Angle

You want the rocket to point towards the next xy location?
You might want to look at a script I made which does that.
http://scratch.mit.edu/projects/what-the/1178312

It should be possible to make the script even smaller.

Last edited by what-the (2012-02-20 20:13:45)


http://imageshack.us/m/64/9034/ddfss.pngMy site
Find someone post count. Click posts under username. Find number of pages. Times that by 40 for min and 60 for max and you have a rough estimate of post count.

Offline

 

Board footer