# Weird Problem

**URL:** <https://forum.kirupa.com/t/weird-problem/193097>\
**Category:** Uncategorized\
**Created:** [July 4, 2006, 10:34am UTC](https://forum.kirupa.com/t/weird-problem/193097 "2006-07-04T10:34:17Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Stilianos](https://avatars.discourse-cdn.com/v4/letter/s/df788c/32.png) [@Stilianos](https://forum.kirupa.com/u/Stilianos)\
**Post date:** [July 4, 2006, 10:34am UTC](https://forum.kirupa.com/t/weird-problem/193097/1 "2006-07-04T10:34:17Z")

</div>

I have a problem…  
When my character is facing left the rotaion detect works fine. But when my character is to the right the code is backwards.

The code…

```auto

onClipEvent(enterFrame)
{
var myPoint:Object = {x:_root.man.head._x, y:_root.man.head._y}
rx = _root.cross._x
ry = _root.cross._y
this.localToGlobal (myPoint)
this._rotation = (Math.atan2((rx-myPoint.x),(ry-myPoint.y))*180/Math.PI)+90
}

```

I have also posted the swf.
