示例#1
0
    //LinksetRoot.PhysShape.ptr, newShape.ptr, displacementPos, displacementRot
    public override void AddChildShapeToCompoundShape(BulletShape pCShape, BulletShape paddShape, Vector3 displacementPos, Quaternion displacementRot)
    {
        IndexedMatrix relativeTransform = new IndexedMatrix();
        CompoundShape compoundshape = (pCShape as BulletShapeXNA).shape as CompoundShape;
        CollisionShape addshape = (paddShape as BulletShapeXNA).shape;

        relativeTransform._origin = new IndexedVector3(displacementPos.X, displacementPos.Y, displacementPos.Z);
        relativeTransform.SetRotation(new IndexedQuaternion(displacementRot.X,displacementRot.Y,displacementRot.Z,displacementRot.W));
        compoundshape.AddChildShape(ref relativeTransform, addshape);

    }
示例#2
0
    //LinksetRoot.PhysShape.ptr, newShape.ptr, displacementPos, displacementRot
    internal static void AddChildShapeToCompoundShape2(object pCShape, object paddShape, Vector3 displacementPos, Quaternion displacementRot)
    {
        IndexedMatrix relativeTransform = new IndexedMatrix();
        var compoundshape = pCShape as CompoundShape;
        var addshape = paddShape as CollisionShape;

        relativeTransform._origin = new IndexedVector3(displacementPos.X, displacementPos.Y, displacementPos.Z);
        relativeTransform.SetRotation(new IndexedQuaternion(displacementRot.X,displacementRot.Y,displacementRot.Z,displacementRot.W));
        compoundshape.AddChildShape(ref relativeTransform, addshape);

    }
示例#3
0
    //sim.ptr, shape.ptr,prim.LocalID, prim.RawPosition, prim.RawOrientation
    public override BulletBody CreateGhostFromShape(BulletWorld pWorld, BulletShape pShape, uint pLocalID, Vector3 pRawPosition, Quaternion pRawOrientation)
    {
        DiscreteDynamicsWorld world = (pWorld as BulletWorldXNA).world;
        IndexedMatrix bodyTransform = new IndexedMatrix();
        bodyTransform._origin = new IndexedVector3(pRawPosition.X, pRawPosition.Y, pRawPosition.Z);
        bodyTransform.SetRotation(new IndexedQuaternion(pRawOrientation.X,pRawOrientation.Y,pRawOrientation.Z,pRawOrientation.W));
        GhostObject gObj = new PairCachingGhostObject();
        gObj.SetWorldTransform(bodyTransform);
        CollisionShape shape = (pShape as BulletShapeXNA).shape;
        gObj.SetCollisionShape(shape);
        gObj.SetUserPointer(pLocalID);

        if (specialCollisionObjects.ContainsKey(pLocalID))
            specialCollisionObjects[pLocalID] = gObj;
        else
            specialCollisionObjects.Add(pLocalID, gObj);

        // TODO: Add to Special CollisionObjects!
        return new BulletBodyXNA(pLocalID, gObj);
    }
示例#4
0
 //sim.ptr, shape.ptr,prim.LocalID, prim.RawPosition, prim.RawOrientation
 internal static object CreateGhostFromShape2(object pWorld, object pShape, uint pLocalID, Vector3 pRawPosition, Quaternion pRawOrientation)
 {
     IndexedMatrix bodyTransform = new IndexedMatrix();
     bodyTransform._origin = new IndexedVector3(pRawPosition.X, pRawPosition.Y, pRawPosition.Z);
     bodyTransform.SetRotation(new IndexedQuaternion(pRawOrientation.X,pRawOrientation.Y,pRawOrientation.Z,pRawOrientation.W));
     GhostObject gObj = new PairCachingGhostObject();
     gObj.SetWorldTransform(bodyTransform);
     CollisionShape shape = pShape as CollisionShape;
     gObj.SetCollisionShape(shape);
     gObj.SetUserPointer(pLocalID);
     // TODO: Add to Special CollisionObjects!
     return gObj;
 }