I have a circle (bounding circle) offset from the centre point of my entity and I'm looking on how to move that circle around the entity as it rotates so that it's always in the same spot of the character. For example, say I have a bounding circle for the front of a car, when the car turns, that bounding circle needs to turn too.
So I have two points: position
which is the position of the entity's centre point and offset
which is the offset of the circle from that position. This assumes an angle of 0.
So if my car is facing 0 degrees:
position
(150, 150) and offset
(50, 0) then the bounding circle would be at 200, 150.
Now if I rotated the car 90 degrees, the bounding circle should be at position 150, 200.
This is what I have now:
var differenceX : Number = _centre.x - _offset.x;
var differenceY : Number = _centre.y - _offset.y;
var rotatedX : Number = differenceX * Math.cos(_angle);
var rotatedY : Number = differenceY * Math.sin(_angle);
var currentOffset : Point = new Point(_centre.x + rotatedX, _centre.y + rotatedY);
But it's giving me these long ovals and now a perfect circle.
Ideas?