示例#1
0
        //public override void Visit()
        //{
        //    base.AdditionalTransform = NodeToBodyTransform();
        //    base.Visit();
        //}

        // returns the transform matrix according the Chipmunk Body values
        public CCAffineTransform NodeToBodyTransform()
        {
            var angle = CCPoint.ForAngle(-CCMathHelper.ToRadians(RotationX));

            cpVect rot = (IgnoreBodyRotation ? new cpVect(angle.X, angle.Y) : _body.GetRotation()); //TODO: CHECK ROT
            double x   = _body.GetPosition().x + (double)rot.x * -AnchorPointInPoints.X - (double)rot.y * (-AnchorPointInPoints.Y);
            double y   = _body.GetPosition().y + (double)rot.y * -AnchorPointInPoints.X + (double)rot.x * (-AnchorPointInPoints.Y);

            return(new CCAffineTransform((float)rot.x, (float)rot.y, (float)-rot.y, (float)rot.x, (float)x, (float)y));
        }