public virtual void updateTransform()
{
if (_isUpdateTransformDirty)
{
//position
Vector2 pInParentAR = _position;
if (_parent != null)
{
if (_parent.ignoreAnchorPointForPosition)
{
if (FloatUtils.NEQ(_parent.scaleX, 0) && FloatUtils.NEQ(_parent.scaleY, 0))
{
pInParentAR += new Vector2(_parent.anchorPointInPixels.x * (1 / _parent.scaleX - 1), _parent.anchorPointInPixels.y * (1 / _parent.scaleY - 1));
}
}
else
{
pInParentAR -= _parent.anchorPointInPixels;
}
}
Vector2 uPInParentAR = ccUtils.PixelsToUnits(pInParentAR);
Vector3 pos = transform.localPosition;
pos.x = uPInParentAR.x;
pos.y = uPInParentAR.y;
pos.z = 0;
transform.localPosition = pos;
//rotation
Vector3 rotation = calculateRotation();
transform.localEulerAngles = Vector3.zero;
transform.Rotate(rotation.x, 0, 0);
transform.Rotate(0, rotation.y, 0);
transform.Rotate(0, 0, rotation.z);
//scale
transform.localScale = new Vector3(Mathf.Abs(_scaleX), Mathf.Abs(_scaleY), transform.localScale.z);
_isUpdateTransformDirty = false;
}
}