Esempio n. 1
0
    public PhysicsEntity(float restitutionToSet, float Mass, Vector x, Vector v, Vector a, string filename, Layer layer) : base()
    {
        Layer = layer;
        //game.AddChildAt(this,childLayer);
        //SetOrigin(width / 2, height / 2);
        restitution = restitutionToSet;

        if (Utils.IsNearEqual(Mass, 0f, 0.01f))
        {
            invMass    = 0;
            invInertia = 0;
        }
        else
        {
            invMass = 1 / Mass;
        }
        position     = x;
        velocity     = v;
        acceleration = a;
        UpdatePosition(position);

        MyGame.AddEntity(this);
        COM = position;

        IDP = ID;
        ID++;
    }