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

#1 2010-12-19 12:14:28

nickbrickmaster
Scratcher
Registered: 2010-02-02
Posts: 500+

Can someone Help? PLEEEEEAAASSEE?

I need to know about trig. I read something about it on the forums, forgot and i need it now.  How do I get something to rotate around something not it's center of rotation. (I read something about this on a post)  yikes


Ask me what I'm doing, wait an hour than roll a die, if it's 4-6, I'm playing Skyrim, if it's 1, I'm eating, if it's 2-3 I'm programming.
Steam: nickbrickmaster | RotMG: PwnThemAll | Minecraft: nickbrickmaster | League Of Legends: BaneOfTitans

Offline

 

#2 2010-12-19 12:19:55

Kileymeister_test
Scratcher
Registered: 2010-01-31
Posts: 100+

Re: Can someone Help? PLEEEEEAAASSEE?


Kileymeister's test account.  I upload engines and demos and stuff for public use.
Currently Working on: Grapple Arms!

Offline

 

#3 2010-12-19 12:28:08

Kileymeister
Scratcher
Registered: 2008-04-17
Posts: 1000+

Re: Can someone Help? PLEEEEEAAASSEE?

To explain, basically, using trig, the sprite first calculates its distance to the object (without the distance block, instead it uses the distance formula), then uses the atan (tangent^-1) function to find it's direction relevant to the point it is supposed to revolve around.  This does not change its true direction, but calculates a new, figurative one.

Next, you can align your sprite to the object by making your x value the sin of the new direction times the distance to the object.  Same for y value but you would use cosine.  This will align it to the point it's already on, you can alter the new direction by a few degrees but keep the distance the same, meaning it will rotate around the object but stay the same distance from it.

Phew, I just reread that and it sounded mighty complex.  Did you understand all of that?

Last edited by Kileymeister (2010-12-19 12:32:48)


I'm back, and showcasing two new* projects!  Click left or right on the image below to see!
http://img109.imageshack.us/img109/7905/part1l.pnghttp://img859.imageshack.us/img859/6417/part2bf.png

Offline

 

Board footer