本文整理汇总了C#中BulletSharp.CollisionObjectWrapper类的典型用法代码示例。如果您正苦于以下问题:C# CollisionObjectWrapper类的具体用法?C# CollisionObjectWrapper怎么用?C# CollisionObjectWrapper使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CollisionObjectWrapper类属于BulletSharp命名空间,在下文中一共展示了CollisionObjectWrapper类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CustomMaterialCombinerCallback
static void CustomMaterialCombinerCallback(ManifoldPoint cp,
CollisionObjectWrapper colObj0Wrap, int partId0, int index0,
CollisionObjectWrapper colObj1Wrap, int partId1, int index1)
{
// Apply material properties
if (colObj0Wrap.CollisionShape.ShapeType == BroadphaseNativeType.TriangleShape)
{
CollisionShape parent0 = colObj0Wrap.CollisionObject.CollisionShape;
if (parent0 != null && parent0.ShapeType == BroadphaseNativeType.MultiMaterialTriangleMesh)
{
MultimaterialTriangleMeshShape shape = parent0 as MultimaterialTriangleMeshShape;
BulletMaterial props = shape.GetMaterialProperties(partId0, index0);
cp.CombinedFriction = CalculateCombinedFriction(props.Friction, colObj1Wrap.CollisionObject.Friction);
cp.CombinedRestitution = props.Restitution * colObj1Wrap.CollisionObject.Restitution;
}
}
else if (colObj1Wrap.CollisionShape.ShapeType == BroadphaseNativeType.TriangleShape)
{
CollisionShape parent1 = colObj1Wrap.CollisionObject.CollisionShape;
if (parent1 != null && parent1.ShapeType == BroadphaseNativeType.MultiMaterialTriangleMesh)
{
MultimaterialTriangleMeshShape shape = parent1 as MultimaterialTriangleMeshShape;
BulletMaterial props = shape.GetMaterialProperties(partId1, index1);
cp.CombinedFriction = CalculateCombinedFriction(props.Friction, colObj0Wrap.CollisionObject.Friction);
cp.CombinedRestitution = props.Restitution * colObj0Wrap.CollisionObject.Restitution;
}
}
}
示例2: ConvexPlaneCollisionAlgorithm
public ConvexPlaneCollisionAlgorithm(PersistentManifold mf, CollisionAlgorithmConstructionInfo ci,
CollisionObjectWrapper body0Wrap, CollisionObjectWrapper body1Wrap, bool isSwapped,
int numPerturbationIterations, int minimumPointsPerturbationThreshold)
: base(btConvexPlaneCollisionAlgorithm_new(mf._native, ci._native, body0Wrap._native,
body1Wrap._native, isSwapped, numPerturbationIterations, minimumPointsPerturbationThreshold))
{
}
示例3: GetSphereDistance
public bool GetSphereDistance(CollisionObjectWrapper boxObjWrap, out Vector3 v3PointOnBox,
out Vector3 normal, out float penetrationDepth, Vector3 v3SphereCenter,
float fRadius, float maxContactDistance)
{
return btSphereBoxCollisionAlgorithm_getSphereDistance(_native, boxObjWrap._native,
out v3PointOnBox, out normal, out penetrationDepth, ref v3SphereCenter,
fRadius, maxContactDistance);
}
示例4: AddSingleResult
public override float AddSingleResult(ManifoldPoint cp,
CollisionObjectWrapper colObj0Wrap, int partId0, int index0,
CollisionObjectWrapper colObj1Wrap, int partId1, int index1)
{
Vector3 ptA = cp.PositionWorldOnA;
Vector3 ptB = cp.PositionWorldOnB;
world.DebugDrawer.DrawLine(ref ptA, ref ptB, System.Drawing.Color.Blue);
return 0;
}
示例5: GetSphereDistance
public unsafe static bool GetSphereDistance(this SphereBoxCollisionAlgorithm obj, CollisionObjectWrapper boxObjWrap, ref OpenTK.Vector3 v3PointOnBox, ref OpenTK.Vector3 normal, out float penetrationDepth, ref OpenTK.Vector3 v3SphereCenter, float fRadius, float maxContactDistance)
{
fixed (OpenTK.Vector3* v3PointOnBoxPtr = &v3PointOnBox)
{
fixed (OpenTK.Vector3* normalPtr = &normal)
{
fixed (OpenTK.Vector3* v3SphereCenterPtr = &v3SphereCenter)
{
return obj.GetSphereDistance(boxObjWrap, ref *(BulletSharp.Math.Vector3*)v3PointOnBoxPtr, ref *(BulletSharp.Math.Vector3*)normalPtr, out penetrationDepth, ref *(BulletSharp.Math.Vector3*)v3SphereCenterPtr, fRadius, maxContactDistance);
}
}
}
}
示例6: MyContactCallback
// MyContactCallback is just an example to show how to get access to the child shape that collided
void MyContactCallback(ManifoldPoint cp, CollisionObjectWrapper colObj0Wrap, int partId0, int index0, CollisionObjectWrapper colObj1Wrap, int partId1, int index1)
{
if (colObj0Wrap.CollisionObject.CollisionShape.ShapeType == BroadphaseNativeType.CompoundShape)
{
CompoundShape compound = colObj0Wrap.CollisionObject.CollisionShape as CompoundShape;
CollisionShape childShape = compound.GetChildShape(index0);
}
if (colObj1Wrap.CollisionObject.CollisionShape.ShapeType == BroadphaseNativeType.CompoundShape)
{
CompoundShape compound = colObj1Wrap.CollisionObject.CollisionShape as CompoundShape;
CollisionShape childShape = compound.GetChildShape(index1);
}
}
示例7: AddSingleResult
//! Called with each contact for your own processing (e.g. test if contacts fall in within sensor parameters)
public override float AddSingleResult(ManifoldPoint cp,
CollisionObjectWrapper colObj0, int partId0, int index0,
CollisionObjectWrapper colObj1, int partId1, int index1)
{
Vector3 pt; // will be set to point of collision relative to body
if (colObj0.CollisionObject == body)
{
pt = cp.LocalPointA;
//Console.WriteLine("ContactSensorCallback");
}
else
{
System.Diagnostics.Debug.Assert(colObj1.CollisionObject == body);
pt = cp.LocalPointB;
}
// do stuff with the collision point
return 0; // not actually sure if return value is used for anything...?
}
示例8: AddSingleResult
public override float AddSingleResult(ManifoldPoint cp,
CollisionObjectWrapper colObj0Wrap, int partId0, int index0,
CollisionObjectWrapper colObj1Wrap, int partId1, int index1)
{
Vector3 ptA = cp.PositionWorldOnA;
Vector3 ptB = cp.PositionWorldOnB;
UnityEngine.Debug.Log("Contact!");
world.DebugDrawer.DrawLine(ref ptA, ref ptB, ref ptA);
return 0;
}
示例9: RayTestSingleInternal
public static void RayTestSingleInternal(Matrix rayFromTrans, Matrix rayToTrans,
CollisionObjectWrapper collisionObjectWrap, RayResultCallback resultCallback)
{
btCollisionWorld_rayTestSingleInternal(ref rayFromTrans, ref rayToTrans,
collisionObjectWrap._native, resultCallback._native);
}
示例10: CreateCollisionAlgorithm
public virtual CollisionAlgorithm CreateCollisionAlgorithm(CollisionAlgorithmConstructionInfo __unnamed0,
CollisionObjectWrapper body0Wrap, CollisionObjectWrapper body1Wrap)
{
return null;
}
示例11: CreateCollisionAlgorithm
public CollisionAlgorithm CreateCollisionAlgorithm(CollisionAlgorithmConstructionInfo __unnamed0, CollisionObjectWrapper body0Wrap, CollisionObjectWrapper body1Wrap)
{
return new CollisionAlgorithm(btCollisionAlgorithmCreateFunc_CreateCollisionAlgorithm(_native, __unnamed0._native, body0Wrap._native, body1Wrap._native));
}
示例12: FindAlgorithm
public CollisionAlgorithm FindAlgorithm(CollisionObjectWrapper body0Wrap, CollisionObjectWrapper body1Wrap)
{
return new CollisionAlgorithm(btDispatcher_findAlgorithm(_native, body0Wrap._native, body1Wrap._native));
}
示例13: GImpactVsShape
public void GImpactVsShape(CollisionObjectWrapper body0Wrap, CollisionObjectWrapper body1Wrap,
GImpactShapeInterface shape0, CollisionShape shape1, bool swapped)
{
btGImpactCollisionAlgorithm_gimpact_vs_shape(_native, body0Wrap._native,
body1Wrap._native, shape0._native, shape1._native, swapped);
}
示例14: GImpactVsGImpact
public void GImpactVsGImpact(CollisionObjectWrapper body0Wrap, CollisionObjectWrapper body1Wrap,
GImpactShapeInterface shape0, GImpactShapeInterface shape1)
{
btGImpactCollisionAlgorithm_gimpact_vs_gimpact(_native, body0Wrap._native,
body1Wrap._native, shape0._native, shape1._native);
}
示例15: GImpactCollisionAlgorithm
public GImpactCollisionAlgorithm(CollisionAlgorithmConstructionInfo ci, CollisionObjectWrapper body0Wrap,
CollisionObjectWrapper body1Wrap)
: base(btGImpactCollisionAlgorithm_new(ci._native, body0Wrap._native,
body1Wrap._native))
{
}