Exemple #1
0
        public void AddChildShape(Matrix localTransform, CollisionShape shape)
        {
            _childTransforms.Add(localTransform);
            _childShapes.Add(shape);

            //extend the local aabbMin/aabbMax
            Vector3 localAabbMin, localAabbMax;

            shape.GetAabb(localTransform, out localAabbMin, out localAabbMax);
            if (_localAabbMin.X > localAabbMin.X)
            {
                _localAabbMin.X = localAabbMin.X;
            }
            if (_localAabbMax.X < localAabbMax.X)
            {
                _localAabbMax.X = localAabbMax.X;
            }
            if (_localAabbMin.Y > localAabbMin.Y)
            {
                _localAabbMin.Y = localAabbMin.Y;
            }
            if (_localAabbMax.Y < localAabbMax.Y)
            {
                _localAabbMax.Y = localAabbMax.Y;
            }
            if (_localAabbMin.Z > localAabbMin.Z)
            {
                _localAabbMin.Z = localAabbMin.Z;
            }
            if (_localAabbMax.Z < localAabbMax.Z)
            {
                _localAabbMax.Z = localAabbMax.Z;
            }
        }
        public void SetTimeStepAndCounters(float collisionMarginTriangle, DispatcherInfo dispatchInfo, ManifoldResult resultOut)
        {
            _dispatchInfo            = dispatchInfo;
            _collisionMarginTriangle = collisionMarginTriangle;
            _resultOut = resultOut;

            //recalc aabbs
            Matrix         convexInTriangleSpace = MathHelper.InvertMatrix(_triBody.WorldTransform) * _convexBody.WorldTransform;
            CollisionShape convexShape           = _convexBody.CollisionShape;

            //CollisionShape* triangleShape = static_cast<btCollisionShape*>(triBody->m_collisionShape);
            convexShape.GetAabb(convexInTriangleSpace, out _aabbMin, out _aabbMax);
            float   extraMargin = collisionMarginTriangle;
            Vector3 extra       = new Vector3(extraMargin, extraMargin, extraMargin);

            _aabbMax += extra;
            _aabbMin -= extra;
        }
Exemple #3
0
		public void AddChildShape(Matrix localTransform, CollisionShape shape)
		{
			_childTransforms.Add(localTransform);
			_childShapes.Add(shape);

			//extend the local aabbMin/aabbMax
			Vector3 localAabbMin, localAabbMax;
			shape.GetAabb(localTransform, out localAabbMin, out localAabbMax);
			if (_localAabbMin.X > localAabbMin.X)
			{
				_localAabbMin.X = localAabbMin.X;
			}
			if (_localAabbMax.X < localAabbMax.X)
			{
				_localAabbMax.X = localAabbMax.X;
			}
			if (_localAabbMin.Y > localAabbMin.Y)
			{
				_localAabbMin.Y = localAabbMin.Y;
			}
			if (_localAabbMax.Y < localAabbMax.Y)
			{
				_localAabbMax.Y = localAabbMax.Y;
			}
			if (_localAabbMin.Z > localAabbMin.Z)
			{
				_localAabbMin.Z = localAabbMin.Z;
			}
			if (_localAabbMax.Z < localAabbMax.Z)
			{
				_localAabbMax.Z = localAabbMax.Z;
			}
		}