Exemple #1
0
        public CCPhysicsBody(float mass, float moment, CCPoint offset)
        {
            var offsetcp = new cpVect(offset.X, offset.Y);;

            _positionOffset     = offsetcp != null ? offsetcp : cpVect.Zero;
            _node               = null;
            _world              = null;
            _info               = null;
            _dynamic            = true;
            _enabled            = true;
            _rotationEnabled    = true;
            _gravityEnabled     = true;
            _massDefault        = mass == MASS_DEFAULT;
            _momentDefault      = moment == MOMENT_DEFAULT;
            _mass               = mass;
            _area               = 0.0f;
            _density            = 0.0f;
            _moment             = moment;
            _isDamping          = false;
            _linearDamping      = 0.0f;
            _angularDamping     = 0.0f;
            _tag                = 0;
            _categoryBitmask    = int.MaxValue;         //(UINT_MAX)
            _collisionBitmask   = 0;
            _contactTestBitmask = int.MaxValue;
            _group              = 0;
            _positionResetTag   = false;
            _rotationResetTag   = false;
            _rotationOffset     = 0;

            _info      = new CCPhysicsBodyInfo();
            _info.Body = new cpBody(_mass, _moment);
        }
		public void removeBody(CCPhysicsBodyInfo bodyInf)
		{
			var body = bodyInf.GetBody();
			if (_space.ContainsBody(body))
			{
				_space.RemoveBody(body);
			}
		}
		public void addBody(CCPhysicsBodyInfo bodyInf)
		{
			cpBody body = bodyInf.GetBody();

			if (!_space.ContainsBody(body))
			{
				_space.AddBody(body);
			}
		}
        public void RemoveBody(CCPhysicsBodyInfo bodyInf)
        {
            var body = bodyInf.GetBody();

            if (_space.ContainsBody(body))
            {
                _space.RemoveBody(body);
            }
        }
        public void AddBody(CCPhysicsBodyInfo bodyInf)
        {
            cpBody body = bodyInf.GetBody();

            if (!_space.ContainsBody(body))
            {
                _space.AddBody(body);
            }
        }
Exemple #6
0
		public CCPhysicsBody(float mass, float moment, CCPoint offset)
		{
            var offsetcp = new cpVect(offset.X, offset.Y); ;
			_positionOffset = offsetcp != null ? offsetcp : cpVect.Zero;
			_node = null;
			_world = null;
			_info = null;
			_dynamic = true;
			_enabled = true;
			_rotationEnabled = true;
			_gravityEnabled = true;
			_massDefault = mass == MASS_DEFAULT;
			_momentDefault = moment == MOMENT_DEFAULT;
			_mass = mass;
			_area = 0.0f;
			_density = 0.0f;
			_moment = moment;
			_isDamping = false;
			_linearDamping = 0.0f;
			_angularDamping = 0.0f;
			_tag = 0;
			_categoryBitmask = int.MaxValue;//(UINT_MAX)
			_collisionBitmask = 0;
			_contactTestBitmask = int.MaxValue;
			_group = 0;
			_positionResetTag = false;
			_rotationResetTag = false;
			_rotationOffset = 0;

			_info = new CCPhysicsBodyInfo();
			_info.Body = new cpBody(_mass, _moment);

		}