Beispiel #1
0
        public Player(Engine _engine, Tracker _tracker, Vector3 position, Model _model)
            : base(_engine, _tracker, false)
        {
            model = _model;
            //Create body and add to physics engine
            Shape capsuleShape = new CapsuleShape(1, 0.5f);
            body = new RigidBody(capsuleShape);
            body.Mass = 2f;
            body.Position = position.ToJitterVector();
            body.AllowDeactivation = false;
            body.Tag = this;
            EnableInterfaceCalls = true;

            //TODO: Fix so that players can rotate around Y-axis.
            //Players can't tip over
            Constraint upright = new Jitter.Dynamics.Constraints.SingleBody.FixedAngle(body);
            Engine.Physics.AddConstraint(upright);

            //TEMPORARY FOR VIDYAJUEGOS
            currentWeapon = new Pistol1(_engine, Tracker, this, "", 1, 1000);
        }