Rotation Calculation Question
Hey all,
So if anyone is good with the formulas for calculations I could use some help. I have a large Swinging Axe actor that is on my platformer that continually rotates counter clockwise.
I'd like to be able to calculate whether my hero actor is touching either end where the axes are located. Now I'm positive this is doable. It would obviously be in a rule that gives a range compared to the Hero actors pos x. I'm just uncertain as to which formulas to use to calculate off of the current rotation of the axe to where the 2 axes are located on either side (it is all 1 image/actor).
Lets say my axe wasn't rotating I could easily make a range that says if my Hero actors pos x <= self(axe).pos.x+50 AND hero pos x >= self(axe).pos-50 AND Axe collides with Hero actor (more specifically if I added a range for the Y's it would also figure if out if I'm touching the right area of the axe). Those rules would give me what I am looking for without it rotating. So now I just need to figure out where those locations are when it is in the middle of rotating if you get what I mean.
Anyways thanks and sorry if I confused anyone. Let me know if you need clarification.
So if anyone is good with the formulas for calculations I could use some help. I have a large Swinging Axe actor that is on my platformer that continually rotates counter clockwise.
I'd like to be able to calculate whether my hero actor is touching either end where the axes are located. Now I'm positive this is doable. It would obviously be in a rule that gives a range compared to the Hero actors pos x. I'm just uncertain as to which formulas to use to calculate off of the current rotation of the axe to where the 2 axes are located on either side (it is all 1 image/actor).
Lets say my axe wasn't rotating I could easily make a range that says if my Hero actors pos x <= self(axe).pos.x+50 AND hero pos x >= self(axe).pos-50 AND Axe collides with Hero actor (more specifically if I added a range for the Y's it would also figure if out if I'm touching the right area of the axe). Those rules would give me what I am looking for without it rotating. So now I just need to figure out where those locations are when it is in the middle of rotating if you get what I mean.
Anyways thanks and sorry if I confused anyone. Let me know if you need clarification.
Comments
Make three real (game level) attributes. How about calling them axeX, axeY, and axeWidth
In the double headed axe actor give these game level attributes their working values:
axeX -> self.position.X
axeY -> self.position.Y
axeWidth -> self.width
In the hero actor you would create an attribute called distanceFromAxeCenter;
Constrain Attribute: (self.distanceFromAxeCenter) To: (magnitude(game.axeX-self.Position.X,game.axeY-self.Position.Y))
Then have a rule in the Hero;
When (all conditions are valid):
Attribute (self.distanceFromAxeCenter) < (game.axeWidth/2)
Actor receives event (overlaps or collides) with (actor of type) (DoubleAxe)
-- do your thing
otherwise
-- do your other thing
That should get you close to what you want.....
Thanks again you rock.