Ejemplo n.º 1
0
        private Node CreateBall(Vector3 pos)
        {
            var cmp = new MyBall ();

            var spr = new Sprite (Resource.GetTexture ("media/Earth-32x32.png"), 32, 32);

            var col = new SphereCollision (16);
            col.SetOffset (col.Radius, col.Radius, 0);

            var body = new PhysicsBody ();
            body.Type = ColliderType.Dynamic;
            body.SetShape (col);
            body.SetMaterial (new PhysicsMaterial ());
            body.ApplyForce (50000, 0, 0);

            var node = new Node ("Ball " + ballIndex++);
            node.Attach (spr);
            node.Attach (cmp);
            node.Attach (col);
            node.Attach (body);

            node.Translation = pos;

            return node;
        }