views:

52

answers:

0

I am trying to use Farseer to develop a biliiard game.

In you download Farseer source code and samples, there is test called "Demo 5: Collision categories". I modified this sample and keeped only 1 category of balls, the red balls.

In the circle creation method I modified as shown below

        _circleBody[0] = BodyFactory.Instance.CreateCircleBody(physicsSimulator, _radius, 0.1f);// 0.1f is the ball mass
        _circleBody[0].Position = _startPosition;
        view.AddCircleToCanvas(_circleBody[0], _color, _radius);
        for (int i = 1; i < _count; i++)
        {
            _circleBody[i] = BodyFactory.Instance.CreateBody(physicsSimulator, _circleBody[0]);
            _circleBody[i].Position = Vector2.Lerp(_startPosition, _endPosition, i/(float) (_count - 1));
            _circleBody[i].LinearDragCoefficient = 0.15f;// added by me
            _circleBody[i].RotationalDragCoefficient = 0.15f;// added by me
            view.AddCircleToCanvas(_circleBody[i], _color, _radius);
        }

Wheter I add higher or lower values for LinearDragCoefficient, RotationalDragCoefficient and mass variables, the ball movement does not look realistic.

This may sound strange but I played a lot of billiard games and ball movements looks realistic. With Farseer, if DragCoefficient is to low, the balls keep moving forever, if DragCoefficient is to high, the balls stop moving early and after a very short distance.

Maybe I don't set the right variables to the right values !

related questions