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

#1 2010-10-21 09:18:02

juststickman
Scratcher
Registered: 2009-05-31
Posts: 1000+

Rotating something...

Ok, what would I do if...

I have an object with an x coordinate and a y coordinate. When I press D, camera rotation is increased by 5 and A camera rotation is decreased by 5. The object will rotate around 0,0 according to rotation.

need any more information? If not, please figure out how to do this purely with math (no cheating with go to, point towards, move and go back kind of thing)


http://is.gd/iBQi2 Add grob to your sig and help with world dominiation!http://is.gd/iBQ9Q                                                             Hey guys, we're seriously naming our team bob?

Offline

 

#2 2010-10-21 09:21:46

Jwosty
Scratcher
Registered: 2009-12-19
Posts: 500+

Re: Rotating something...

What do you mean? This isn't clear to me...  hmm


http://i39.tinypic.com/18ert5.png Google it.  smile

Offline

 

#3 2010-10-21 09:25:35

AtomicBawm3
Scratcher
Registered: 2009-06-27
Posts: 1000+

Re: Rotating something...

you mean use trig?  Just have an angle that's set to point towards the center.  As that variable is increased, his direction should also, so you simply need:

x=sin(direction) * distance wanted
y=cos(direction) * distance wanted

If this what you meant, then great!  But I don't think it is, so could you elaborate?


http://i50.tinypic.com/j0yw0p.jpg

Offline

 

#4 2010-10-21 11:19:51

justtestingstickman
Scratcher
Registered: 2009-07-04
Posts: 100+

Re: Rotating something...

Ok, here's what I want....

Basically, I have a set point, let's say it's 0,0:
<point>

Now I have an object.
<object>
-
-
---------------<point>

Now if I press A,
<object>
-
------------------------------------<point>
Object rotates around point, remaining at the same distance.


http://img509.imageshack.us/img509/2126/smalladvert.pnghttp://img175.imageshack.us/img175/8867/advertisementfor3sprite.pnghttp://img696.imageshack.us/img696/6061/failc.png
This signature has too many lines.

Offline

 

#5 2010-10-21 11:29:11

Blade-Edge
Scratcher
Registered: 2009-06-13
Posts: 1000+

Re: Rotating something...

You mean orbit? What if you just move that center cross thing to the point you want it to orbit around


http://img29.imageshack.us/img29/5145/scratchycat.gif CLASSY

Offline

 

#6 2010-10-21 11:34:44

juststickman
Scratcher
Registered: 2009-05-31
Posts: 1000+

Re: Rotating something...

I want to do this just with math.


http://is.gd/iBQi2 Add grob to your sig and help with world dominiation!http://is.gd/iBQ9Q                                                             Hey guys, we're seriously naming our team bob?

Offline

 

#7 2010-10-21 11:36:27

Blade-Edge
Scratcher
Registered: 2009-06-13
Posts: 1000+

Re: Rotating something...

I don't think you can


http://img29.imageshack.us/img29/5145/scratchycat.gif CLASSY

Offline

 

#8 2010-10-21 12:27:50

SSBBM
Scratcher
Registered: 2009-10-09
Posts: 100+

Re: Rotating something...

You mean like this


http://goo.gl/zVfAp http://goo.gl/laci8

Offline

 

#9 2010-10-21 12:30:43

juststickman
Scratcher
Registered: 2009-05-31
Posts: 1000+

Re: Rotating something...

Yes, like that.

Just too lazy to do math today.


http://is.gd/iBQi2 Add grob to your sig and help with world dominiation!http://is.gd/iBQ9Q                                                             Hey guys, we're seriously naming our team bob?

Offline

 

#10 2010-10-21 12:35:46

SSBBM
Scratcher
Registered: 2009-10-09
Posts: 100+

Re: Rotating something...

juststickman wrote:

Yes, like that.

Just too lazy to do math today.

Doesn't that have the math in it?


http://goo.gl/zVfAp http://goo.gl/laci8

Offline

 

#11 2010-10-21 13:05:40

juststickman
Scratcher
Registered: 2009-05-31
Posts: 1000+

Re: Rotating something...

I just want a really simple thing without any moving around, just orbiting around a center. Must use an original x/y position and a formula to calculate where it goes (not just simply moving a certain distance away from origin).

Yes, yes I am really, really tired today.


http://is.gd/iBQi2 Add grob to your sig and help with world dominiation!http://is.gd/iBQ9Q                                                             Hey guys, we're seriously naming our team bob?

Offline

 

#12 2010-10-21 14:41:01

fullmoon
Retired Community Moderator
Registered: 2007-06-04
Posts: 1000+

Re: Rotating something...

Jens has a project that demonstrates what I think you're describing, but the math is insane, I would never try to replicate it!


http://i302.photobucket.com/albums/nn100/fullmoon32/wow.jpg

Offline

 

#13 2010-10-21 17:26:06

Taneb
Scratcher
Registered: 2009-07-07
Posts: 100+

Re: Rotating something...

For a given orbited point (oX,oY), distance above the orbited point (h), and distance from the orbited point(d), the co-ords for the orbiting object are (oX±√(d²-h²),oY+h) and the angle is asin(H/d).

I think.

Offline

 

#14 2010-10-22 07:17:50

juststickman
Scratcher
Registered: 2009-05-31
Posts: 1000+

Re: Rotating something...

Taneb wrote:

For a given orbited point (oX,oY), distance above the orbited point (h), and distance from the orbited point(d), the co-ords for the orbiting object are (oX±√(d²-h²),oY+h) and the angle is asin(H/d).

I think.

I'm guessing I have to do something with distance?

And anyone know how to find the cube root of something?


http://is.gd/iBQi2 Add grob to your sig and help with world dominiation!http://is.gd/iBQ9Q                                                             Hey guys, we're seriously naming our team bob?

Offline

 

#15 2010-10-22 19:01:09

HD123
Scratcher
Registered: 2009-12-05
Posts: 500+

Re: Rotating something...

juststickman wrote:

Taneb wrote:

For a given orbited point (oX,oY), distance above the orbited point (h), and distance from the orbited point(d), the co-ords for the orbiting object are (oX±√(d²-h²),oY+h) and the angle is asin(H/d).

I think.

I'm guessing I have to do something with distance?

And anyone know how to find the cube root of something?

http://en.wikipedia.org/wiki/Cubic_function


~~HD123~~
Treat others as you want to be treated. |  big_smile  | http://i.imgur.com/OaNrY.gif | http://blocks.scratchr.org/libstatus.php?user=HD123&amp;online=http://lemonfanatic.webs.com/ONLINE.png&amp;offline=http://lemonfanatic.webs.com/OFFLINE.png

Offline

 

Board footer