//UpdatePosition then to Rendering game
    public void UpdatePosition(float dt)
    {
        mRigidbody2D.UpdatePosition(dt);

        // X.Tools.LogUtils.Debug(X.Tools.LogTag.Test, this.gameObject.name + ":" + mRigidbody2D.GetPosition().ToString());
        cpPos = mRigidbody2D.GetPosition();
        mPostion.Set(cpPos.x, cpPos.y);
        mAngle = cp.cpfangle(mRigidbody2D.GetAngle());
        //this.transform.SetPositionAndRotation(new Vector3(cpPos.x * 0.01f, cpPos.y * 0.01f, 0f), Quaternion.Euler(0f,0f, mAngle));//z-Euler
        this.transform.position = mPostion * XSpaceManager.UnitsPerPixel;
        this.transform.rotation = Quaternion.Euler(0f, 0f, mAngle);
    }
Ejemplo n.º 2
0
        public override void Update(long gametime)
        {
            physic.UpdateVelocity(space.GetGravity(), 1, 0.01f);
            physic.UpdatePosition(1);
            shp.Update(trsf);
            cpVect position = physic.GetPosition();

            InvokeOnMainThread(() => {
                SetPosition(position);
            });

            angle = (physic.GetAngle() % 360) / 57.2958f;
            if (position.y > 500)
            {
                physic.ApplyImpulse(new cpVect(1, -150), new cpVect(0.1f, 0.1f));
            }
        }