Exemplo n.º 1
0
        public void RenderArm(Entity p)
        {
            Vector3 pos = p.Position;

            if (Bobbing)
            {
                pos.Y += p.anim.bobbingModel;
            }
            SetupState(p);

            game.Graphics.SetBatchFormat(VertexFormat.P3fT2fC4b);
            ApplyTexture(p);
            Matrix4 translate;

            if (game.ClassicArmModel)
            {
                // TODO: Position's not quite right.
                // Matrix4.Translate(out m, -armX / 16f + 0.2f, -armY / 16f - 0.20f, 0);
                // is better, but that breaks the dig animation
                Matrix4.Translate(out translate, -armX / 16f, -armY / 16f - 0.10f, 0);
            }
            else
            {
                Matrix4.Translate(out translate, -armX / 16f + 0.10f, -armY / 16f - 0.26f, 0);
            }

            Matrix4 m = p.TransformMatrix(p.ModelScale, pos);

            Matrix4.Mult(out m, ref m, ref game.Graphics.View);
            Matrix4.Mult(out m, ref translate, ref m);

            game.Graphics.LoadMatrix(ref m);
            Rotate = RotateOrder.YZX;
            DrawArm(p);
            Rotate = RotateOrder.ZYX;
            game.Graphics.LoadMatrix(ref game.Graphics.View);
        }
		internal btGeneric6DofSpring2Constraint( btRigidBody rbB, ref btTransform frameInB, RotateOrder rotOrder )
			: base( btObjectTypes.D6_SPRING_2_CONSTRAINT_TYPE, getFixedBody(), rbB )
		{
			m_frameInB = ( frameInB );
			m_rotateOrder = ( rotOrder );
			m_flags = ( 0 );
			///not providing rigidbody A means implicitly using worldspace for body A
			rbB.m_worldTransform.Apply( ref m_frameInB, out m_frameInA );
			calculateTransforms();
		}
		/*
		void setAxis( ref btVector3 axis1, ref btVector3 axis2 );

		void setBounce( int index, double bounce );

		void enableMotor( int index, bool onOff );
		void setServo( int index, bool onOff ); // set the type of the motor (servo or not) (the motor has to be turned on for servo also)
		void setTargetVelocity( int index, double velocity );
		void setServoTarget( int index, double target );
		void setMaxMotorForce( int index, double force );

		void enableSpring( int index, bool onOff );
		void setStiffness( int index, double stiffness, bool limitIfNeeded = true ); // if limitIfNeeded is true the system will automatically limit the stiffness in necessary situations where otherwise the spring would move unrealistically too widely
		void setDamping( int index, double damping, bool limitIfNeeded = true ); // if limitIfNeeded is true the system will automatically limit the damping in necessary situations where otherwise the spring would blow up
		void setEquilibriumPoint(); // set the current constraint position/orientation as an equilibrium point for all DOF
		void setEquilibriumPoint( int index );  // set the current constraint position/orientation as an equilibrium point for given DOF
		void setEquilibriumPoint( int index, double val );
		*/

		//override the default global value of a parameter (such as ERP or CFM), optionally provide the axis (0..5). 
		//If no axis is provided, it uses the default axis for this constraint.


		internal btGeneric6DofSpring2Constraint( btRigidBody rbA, btRigidBody rbB, ref btTransform frameInA, ref btTransform frameInB, RotateOrder rotOrder )
			: base( btObjectTypes.D6_SPRING_2_CONSTRAINT_TYPE, rbA, rbB )
		{
			m_frameInA = ( frameInA );
			m_frameInB = ( frameInB );
			m_rotateOrder = ( rotOrder );
			m_flags = ( 0 );
			calculateTransforms();
		}
		void setRotationOrder( RotateOrder order ) { m_rotateOrder = order; }
 public Generic6DofSpring2Constraint CreateGeneric6DofSpring2Constraint(RigidBody rbA, RigidBody rbB, ref Matrix frameInA, ref Matrix frameInB, RotateOrder rotateOrder)
 {
     Generic6DofSpring2Constraint constraint = new Generic6DofSpring2Constraint(rbA, rbB, frameInA, frameInB, rotateOrder);
     _allocatedConstraints.Add(constraint);
     return constraint;
 }
		static extern IntPtr btGeneric6DofSpring2Constraint_new4(IntPtr rbB, [In] ref Matrix frameInB, RotateOrder rotOrder);
		public Generic6DofSpring2Constraint(RigidBody rigidBodyB, Matrix frameInB,
			RotateOrder rotOrder)
			: base(btGeneric6DofSpring2Constraint_new4(rigidBodyB._native, ref frameInB,
				rotOrder))
		{
            _rigidBodyA = GetFixedBody();
			_rigidBodyB = rigidBodyB;
		}
		public Generic6DofSpring2Constraint(RigidBody rigidBodyA, RigidBody rigidBodyB,
			Matrix frameInA, Matrix frameInB, RotateOrder rotOrder)
			: base(btGeneric6DofSpring2Constraint_new2(rigidBodyA._native, rigidBodyB._native,
				ref frameInA, ref frameInB, rotOrder))
		{
			_rigidBodyA = rigidBodyA;
			_rigidBodyB = rigidBodyB;
		}
		static extern void btGeneric6DofSpring2Constraint_setRotationOrder(IntPtr obj, RotateOrder order);