Esempio n. 1
0
        public Hand[] GetHandPositions()
        {
            Hand[] returnValue;

            // Lock the hand positions map so we don't get concurrency issues
            lock (_handPositions)
            {
                returnValue = new Hand[_handPositions.Count * 2];
                int i = 0;
                foreach (Hand[] hands in _handPositions.Values)
                {
                    returnValue[i] = hands[0];
                    returnValue[i + 1] = hands[1];
                    i += 2;
                }
            }

            return returnValue;
        }
Esempio n. 2
0
 private void RemoveHandFixture(Hand hand)
 {
     BodyJointPair bodyJoint = handBodies[hand];
     _world.RemoveJoint(bodyJoint.Joint);
     _world.RemoveBody(bodyJoint.Body);
     handBodies.Remove(hand);
 }
Esempio n. 3
0
        private void CreateHandFixture(Hand hand)
        {
            Vector2 handPos = new Vector2(hand.Position.X, hand.Position.Y);
            Body handBody = BodyFactory.CreateRectangle(_world, 1f, 1f, 1f, handPos / MeterInPixels);
            handBody.BodyType = BodyType.Dynamic;
            FixedMouseJoint handJoint = new FixedMouseJoint(handBody, handBody.Position);
            handJoint.MaxForce = 1000f;

            handBodies.Add(hand, new BodyJointPair() { Body = handBody, Joint = handJoint });

            _world.AddJoint(handJoint);
        }