I am a flash programmer that has hit a snag and seeing as mathís has never been my strong point I need some help working this problem out
I have an object (say a ruler) and as I rotate it around the center of the ruler i want to move a box relative to the angle with out rotating the box too. So if the ruler angle was vertical (angle set to 0) then the box x and y cowardliness would be relative to that angle. i want is so no matter what angle the ruler is the box moves around with the ruler always staying with in a set distance to the ruler but never it self rotating
I can not work out how to get the angle and use it to move the box object around relatively with out also rotating it. I want to move the box around with the ruler but always have its actual rotation always at 0 as it moves around with the ruler
I want some thing like
box._x = Math.SomeThing(Take the rotation of the ruler and use its value to work out were the x position of the box needs to be so that it has rotated around with the ruler with out actually rotating it self i.e. so that as the box moves around with the ruler its rotation always remains at 0)
box._y = Math.SomeThing(Take the rotation of the ruler and use its value to work out were the y position of the box needs to be so that it has rotated around with the ruler with out actually rotating it self i.e. so that as the box moves around with the ruler its rotation always remains at 0)
I can use any of the following to help:
Computes an absolute value.
Computes an arc cosine.
Computes an arc sine.
Computes an arc tangent.
Computes an angle from the x-axis to the point.
Rounds a number up to the nearest integer.
Computes a cosine.
Computes an exponential value.
Rounds a number down to the nearest integer.
Computes a natural logarithm.
Returns the larger of the two integers.
Returns the smaller of the two integers.
Computes x raised to the power of the y.
Returns a pseudo-random number between 0.0 and 1.0.
Rounds to the nearest integer.
Computes a sine.
Computes a square root.
Computes a tangent.
Property summary for the Math class
All the following properties for the Math class are constants:
Eulerís constant and the base of natural logarithms (approximately 2.718).
The natural logarithm of 2 (approximately 0.693).
The base 2 logarithm of e (approximately 1.442).
The natural logarithm of 10 (approximately 2.302).
The base 10 logarithm of e (approximately 0.434).
The ratio of the circumference of a circle to its diameter (approximately 3.14159).
The reciprocal of the square root of 1/2 (approximately 0.707).
The square root of 2 (approximately 1.414).
Any ideas on how I can do this using some formula?
Aug 27th 2005, 11:42 PM
Dr. de Seis
It's sort of hard to visualize this... You have something rotating about a point, and then you have something else which you want to follow it around?
I have no experience with Flash, so I sort of skipped over the last half of your post. As far as I can tell, if you have your ruler rotating about a point, then why not just pick an "anchor" point for the "static" object? Say your ruler has a coordinate at (0,0) and (0,1). Call your anchor point something like (1,1). If you can center your static object on that anchor point, then you'll be just fine. All you'll need to do when the ruler is rotated about some point (x,y), by some angle theta, is rotate the anchor point about (x,y) by theta (and then of course re-center your static object).
I'm not sure how comfortable you are with parametric equations for rotations about a point... or how much you'll actually need them... but just tell me if anything I've said so far has helped.