public btDefaultMotionState(btTransform startTrans, btTransform centerOfMassOffset) : this(BulletPINVOKE.new_btDefaultMotionState__SWIG_0(btTransform.getCPtr(startTrans), btTransform.getCPtr(centerOfMassOffset)), true) { if (BulletPINVOKE.SWIGPendingException.Pending) { throw BulletPINVOKE.SWIGPendingException.Retrieve(); } }
public btGeneric6DofSpringConstraint(btRigidBody rbB, btTransform frameInB, bool useLinearReferenceFrameB) : this(BulletPINVOKE.new_btGeneric6DofSpringConstraint__SWIG_1(btRigidBody.getCPtr(rbB), btTransform.getCPtr(frameInB), useLinearReferenceFrameB), true) { if (BulletPINVOKE.SWIGPendingException.Pending) { throw BulletPINVOKE.SWIGPendingException.Retrieve(); } }
public static void Multiply(ref btTransform t, ref btVector3 x, out btVector3 result) { result.X = t.Basis.el0.dot(x) + t.Origin.X; result.Y = t.Basis.el1.dot(x) + t.Origin.Y; result.Z = t.Basis.el2.dot(x) + t.Origin.Z; result.W = 0; }
public btConeTwistConstraint(btRigidBody rbA, btTransform rbAFrame) : this(BulletPINVOKE.new_btConeTwistConstraint__SWIG_1(btRigidBody.getCPtr(rbA), btTransform.getCPtr(rbAFrame)), true) { if (BulletPINVOKE.SWIGPendingException.Pending) { throw BulletPINVOKE.SWIGPendingException.Retrieve(); } }
public btDefaultMotionState(btTransform startTrans) : this(BulletPINVOKE.new_btDefaultMotionState__SWIG_1(btTransform.getCPtr(startTrans)), true) { if (BulletPINVOKE.SWIGPendingException.Pending) { throw BulletPINVOKE.SWIGPendingException.Retrieve(); } }
public btFixedConstraint(btRigidBody rbA, btRigidBody rbB, btTransform frameInA, btTransform frameInB) : this(BulletPINVOKE.new_btFixedConstraint(btRigidBody.getCPtr(rbA), btRigidBody.getCPtr(rbB), btTransform.getCPtr(frameInA), btTransform.getCPtr(frameInB)), true) { if (BulletPINVOKE.SWIGPendingException.Pending) { throw BulletPINVOKE.SWIGPendingException.Retrieve(); } }
public btTransform(btTransform other) : this(BulletPINVOKE.new_btTransform__SWIG_5(btTransform.getCPtr(other)), true) { if (BulletPINVOKE.SWIGPendingException.Pending) { throw BulletPINVOKE.SWIGPendingException.Retrieve(); } }
public btSliderConstraint(btRigidBody rbA, btRigidBody rbB, btTransform frameInA, btTransform frameInB, bool useLinearReferenceFrameA) : this(BulletPINVOKE.new_btSliderConstraint__SWIG_0(btRigidBody.getCPtr(rbA), btRigidBody.getCPtr(rbB), btTransform.getCPtr(frameInA), btTransform.getCPtr(frameInB), useLinearReferenceFrameA), true) { if (BulletPINVOKE.SWIGPendingException.Pending) { throw BulletPINVOKE.SWIGPendingException.Retrieve(); } }
public btHingeConstraint(btRigidBody rbA, btTransform rbAFrame, bool useReferenceFrameA) : this(BulletPINVOKE.new_btHingeConstraint__SWIG_6(btRigidBody.getCPtr(rbA), btTransform.getCPtr(rbAFrame), useReferenceFrameA), true) { if (BulletPINVOKE.SWIGPendingException.Pending) { throw BulletPINVOKE.SWIGPendingException.Retrieve(); } }
public override void DeleteTerrain() { if (TerrainBody != null) { m_world.removeRigidBody(TerrainBody); } if (m_terrainShape != null) { //m_terrainShape.Dispose(); m_terrainShape = null; } if (m_terrainMotionState != null) { m_terrainMotionState.Dispose(); m_terrainMotionState = null; } if (m_terrainTransform != null) { m_terrainTransform.Dispose(); m_terrainTransform = null; } if (m_terrainPosition != null) { m_terrainPosition.Dispose(); m_terrainPosition = null; } }
public btDefaultMotionState( ref btTransform startTrans, ref btTransform centerOfMassOffset ) { m_graphicsWorldTrans = ( startTrans ); m_centerOfMassOffset = ( centerOfMassOffset ); m_startWorldTrans = ( startTrans ); m_userPointer = ( 0 ); }
public btDefaultMotionState() { m_graphicsWorldTrans = btTransform.Identity; m_centerOfMassOffset = btTransform.Identity; m_startWorldTrans = btTransform.Identity; m_userPointer = ( 0 ); }
public DefaultMotionState(btTransform startTrans) { m_graphicsWorldTrans = startTrans; m_centerOfMassOffset = btTransform.Identity; m_startWorldTrans = startTrans; UserData = null; }
public void refreshContactPoints(btTransform trA, btTransform trB) { BulletPINVOKE.btPersistentManifold_refreshContactPoints(swigCPtr, btTransform.getCPtr(trA), btTransform.getCPtr(trB)); if (BulletPINVOKE.SWIGPendingException.Pending) { throw BulletPINVOKE.SWIGPendingException.Retrieve(); } }
public void setInterpolationWorldTransform(btTransform trans) { BulletPINVOKE.btCollisionObject_setInterpolationWorldTransform(swigCPtr, btTransform.getCPtr(trans)); if (BulletPINVOKE.SWIGPendingException.Pending) { throw BulletPINVOKE.SWIGPendingException.Retrieve(); } }
public void getAabbNonVirtual(btTransform t, btVector3 aabbMin, btVector3 aabbMax) { BulletPINVOKE.btConvexShape_getAabbNonVirtual(swigCPtr, btTransform.getCPtr(t), btVector3.getCPtr(aabbMin), btVector3.getCPtr(aabbMax)); if (BulletPINVOKE.SWIGPendingException.Pending) { throw BulletPINVOKE.SWIGPendingException.Retrieve(); } }
public virtual void drawTransform(btTransform transform, float orthoLen) { BulletPINVOKE.btIDebugDraw_drawTransform(swigCPtr, btTransform.getCPtr(transform), orthoLen); if (BulletPINVOKE.SWIGPendingException.Pending) { throw BulletPINVOKE.SWIGPendingException.Retrieve(); } }
public virtual void drawPlane(btVector3 planeNormal, float planeConst, btTransform transform, btVector3 color) { BulletPINVOKE.btIDebugDraw_drawPlane(swigCPtr, btVector3.getCPtr(planeNormal), planeConst, btTransform.getCPtr(transform), btVector3.getCPtr(color)); if (BulletPINVOKE.SWIGPendingException.Pending) { throw BulletPINVOKE.SWIGPendingException.Retrieve(); } }
public virtual void drawCone(float radius, float height, int upAxis, btTransform transform, btVector3 color) { BulletPINVOKE.btIDebugDraw_drawCone(swigCPtr, radius, height, upAxis, btTransform.getCPtr(transform), btVector3.getCPtr(color)); if (BulletPINVOKE.SWIGPendingException.Pending) { throw BulletPINVOKE.SWIGPendingException.Retrieve(); } }
public void setCenterOfMassTransform(btTransform xform) { BulletPINVOKE.btRigidBody_setCenterOfMassTransform(swigCPtr, btTransform.getCPtr(xform)); if (BulletPINVOKE.SWIGPendingException.Pending) { throw BulletPINVOKE.SWIGPendingException.Retrieve(); } }
public override void setWorldTransform(btTransform centerOfMassWorldTrans) { BulletPINVOKE.btDefaultMotionState_setWorldTransform(swigCPtr, btTransform.getCPtr(centerOfMassWorldTrans)); if (BulletPINVOKE.SWIGPendingException.Pending) { throw BulletPINVOKE.SWIGPendingException.Retrieve(); } }
public void proceedToTransform(btTransform newTrans) { BulletPINVOKE.btRigidBody_proceedToTransform(swigCPtr, btTransform.getCPtr(newTrans)); if (BulletPINVOKE.SWIGPendingException.Pending) { throw BulletPINVOKE.SWIGPendingException.Retrieve(); } }
public void predictIntegratedTransform(float step, btTransform predictedTransform) { BulletPINVOKE.btRigidBody_predictIntegratedTransform(swigCPtr, step, btTransform.getCPtr(predictedTransform)); if (BulletPINVOKE.SWIGPendingException.Pending) { throw BulletPINVOKE.SWIGPendingException.Retrieve(); } }
public virtual void drawSphere(float radius, btTransform transform, btVector3 color) { BulletPINVOKE.btIDebugDraw_drawSphere__SWIG_0(swigCPtr, radius, btTransform.getCPtr(transform), btVector3.getCPtr(color)); if (BulletPINVOKE.SWIGPendingException.Pending) { throw BulletPINVOKE.SWIGPendingException.Retrieve(); } }
public virtual void project(btTransform trans, btVector3 dir, SWIGTYPE_p_float min, SWIGTYPE_p_float max) { BulletPINVOKE.btConvexShape_project(swigCPtr, btTransform.getCPtr(trans), btVector3.getCPtr(dir), SWIGTYPE_p_float.getCPtr(min), SWIGTYPE_p_float.getCPtr(max)); if (BulletPINVOKE.SWIGPendingException.Pending) { throw BulletPINVOKE.SWIGPendingException.Retrieve(); } }
public static void calculateDiffAxisAngle(btTransform transform0, btTransform transform1, btVector3 axis, SWIGTYPE_p_float angle) { BulletPINVOKE.btTransformUtil_calculateDiffAxisAngle(btTransform.getCPtr(transform0), btTransform.getCPtr(transform1), btVector3.getCPtr(axis), SWIGTYPE_p_float.getCPtr(angle)); if (BulletPINVOKE.SWIGPendingException.Pending) { throw BulletPINVOKE.SWIGPendingException.Retrieve(); } }
public void calculateTemporalAabb(btTransform curTrans, btVector3 linvel, btVector3 angvel, float timeStep, btVector3 temporalAabbMin, btVector3 temporalAabbMax) { BulletPINVOKE.btCollisionShape_calculateTemporalAabb(swigCPtr, btTransform.getCPtr(curTrans), btVector3.getCPtr(linvel), btVector3.getCPtr(angvel), timeStep, btVector3.getCPtr(temporalAabbMin), btVector3.getCPtr(temporalAabbMax)); if (BulletPINVOKE.SWIGPendingException.Pending) { throw BulletPINVOKE.SWIGPendingException.Retrieve(); } }
public static void calculateVelocity(btTransform transform0, btTransform transform1, float timeStep, btVector3 linVel, btVector3 angVel) { BulletPINVOKE.btTransformUtil_calculateVelocity(btTransform.getCPtr(transform0), btTransform.getCPtr(transform1), timeStep, btVector3.getCPtr(linVel), btVector3.getCPtr(angVel)); if (BulletPINVOKE.SWIGPendingException.Pending) { throw BulletPINVOKE.SWIGPendingException.Retrieve(); } }
public virtual void setWorldTransform(btTransform worldTrans) { BulletPINVOKE.btMotionState_setWorldTransform(swigCPtr, btTransform.getCPtr(worldTrans)); if (BulletPINVOKE.SWIGPendingException.Pending) { throw BulletPINVOKE.SWIGPendingException.Retrieve(); } }
public void getInfo2NonVirtual(btTypedConstraint.btConstraintInfo2 info, btTransform body0_trans, btTransform body1_trans) { BulletPINVOKE.btPoint2PointConstraint_getInfo2NonVirtual(swigCPtr, btTypedConstraint.btConstraintInfo2.getCPtr(info), btTransform.getCPtr(body0_trans), btTransform.getCPtr(body1_trans)); if (BulletPINVOKE.SWIGPendingException.Pending) { throw BulletPINVOKE.SWIGPendingException.Retrieve(); } }
public void calculatePrincipalAxisTransform(btTransform principal, btVector3 inertia, SWIGTYPE_p_float volume) { BulletPINVOKE.btConvexTriangleMeshShape_calculatePrincipalAxisTransform(swigCPtr, btTransform.getCPtr(principal), btVector3.getCPtr(inertia), SWIGTYPE_p_float.getCPtr(volume)); if (BulletPINVOKE.SWIGPendingException.Pending) { throw BulletPINVOKE.SWIGPendingException.Retrieve(); } }
public void mult(btTransform t1, btTransform t2) { BulletPINVOKE.btTransform_mult(swigCPtr, btTransform.getCPtr(t1), btTransform.getCPtr(t2)); if (BulletPINVOKE.SWIGPendingException.Pending) { throw BulletPINVOKE.SWIGPendingException.Retrieve(); } }
public virtual void drawBox(btVector3 bbMin, btVector3 bbMax, btTransform trans, btVector3 color) { BulletPINVOKE.btIDebugDraw_drawBox__SWIG_1(swigCPtr, btVector3.getCPtr(bbMin), btVector3.getCPtr(bbMax), btTransform.getCPtr(trans), btVector3.getCPtr(color)); if (BulletPINVOKE.SWIGPendingException.Pending) { throw BulletPINVOKE.SWIGPendingException.Retrieve(); } }
public override void getAabb(btTransform t, btVector3 aabbMin, btVector3 aabbMax) { BulletPINVOKE.btCapsuleShape_getAabb(swigCPtr, btTransform.getCPtr(t), btVector3.getCPtr(aabbMin), btVector3.getCPtr(aabbMax)); if (BulletPINVOKE.SWIGPendingException.Pending) { throw BulletPINVOKE.SWIGPendingException.Retrieve(); } }
public static void integrateTransform( ref btTransform curTrans, ref btVector3 linvel, ref btVector3 angvel , double timeStep, out btTransform predictedTransform ) { btVector3 tmp; btVector3 tmp2; linvel.Mult( timeStep, out tmp ); curTrans.getOrigin( out tmp2 ); tmp2.Add( ref tmp, out predictedTransform.m_origin ); #if QUATERNION_DERIVATIVE btQuaternion predictedOrn = curTrans.getRotation(); predictedOrn += (angvel predictedOrn) * (timeStep 0.5); predictedOrn.normalize(); #else //Exponential map //google for "Practical Parameterization of Rotations Using the Exponential Map", F. Sebastian Grassia btVector3 axis; double fAngle = angvel.length(); //limit the angular motion if( fAngle * timeStep > ANGULAR_MOTION_THRESHOLD ) { fAngle = ANGULAR_MOTION_THRESHOLD / timeStep; } if( fAngle < 0.001 ) { // use Taylor's expansions of sync function angvel.Mult( ( btScalar.BT_HALF * timeStep - ( timeStep * timeStep * timeStep ) * ( 0.020833333333 ) * fAngle * fAngle ), out axis ); } else { // sync(fAngle) = sin(cfAngle)/t angvel.Mult( ( btScalar.btSin( btScalar.BT_HALF * fAngle * timeStep ) / fAngle ), out axis ); } btQuaternion dorn = new btQuaternion( axis.x, axis.y, axis.z, btScalar.btCos( fAngle * timeStep * 0.5 ) ); btQuaternion orn0; curTrans.getRotation( out orn0 ); btQuaternion predictedOrn; dorn.Mult( ref orn0, out predictedOrn ); predictedOrn.normalize(); #endif btMatrix3x3.setRotation( out predictedTransform.m_basis, ref predictedOrn); //predictedTransform.setRotation( ref predictedOrn ); }
public virtual void drawBox( ref btVector3 bbMin, ref btVector3 bbMax, ref btTransform trans, ref btVector3 color ) { putLine( ref trans, bbMin[0], bbMin[1], bbMin[2], bbMax[0], bbMin[1], bbMin[2], ref color ); putLine( ref trans, bbMax[0], bbMin[1], bbMin[2], bbMax[0], bbMax[1], bbMin[2], ref color ); putLine( ref trans, bbMax[0], bbMax[1], bbMin[2], bbMin[0], bbMax[1], bbMin[2], ref color ); putLine( ref trans, bbMin[0], bbMax[1], bbMin[2], bbMin[0], bbMin[1], bbMin[2], ref color ); putLine( ref trans, bbMin[0], bbMin[1], bbMin[2], bbMin[0], bbMin[1], bbMax[2], ref color ); putLine( ref trans, bbMax[0], bbMin[1], bbMin[2], bbMax[0], bbMin[1], bbMax[2], ref color ); putLine( ref trans, bbMax[0], bbMax[1], bbMin[2], bbMax[0], bbMax[1], bbMax[2], ref color ); putLine( ref trans, bbMin[0], bbMax[1], bbMin[2], bbMin[0], bbMax[1], bbMax[2], ref color ); putLine( ref trans, bbMin[0], bbMin[1], bbMax[2], bbMax[0], bbMin[1], bbMax[2], ref color ); putLine( ref trans, bbMax[0], bbMin[1], bbMax[2], bbMax[0], bbMax[1], bbMax[2], ref color ); putLine( ref trans, bbMax[0], bbMax[1], bbMax[2], bbMin[0], bbMax[1], bbMax[2], ref color ); putLine( ref trans, bbMin[0], bbMax[1], bbMax[2], bbMin[0], bbMin[1], bbMax[2], ref color ); }
public virtual void drawCapsule( double radius, double halfHeight, int upAxis, ref btTransform transform, ref btVector3 color ) { int stepDegrees = 30; btVector3 capStart = btVector3.Zero; capStart[upAxis] = -halfHeight; btVector3 capEnd = btVector3.Zero; capEnd[upAxis] = halfHeight; // Draw the ends { btTransform childTransform = transform; transform.Apply( ref capStart, out childTransform.m_origin ); { btVector3 up = childTransform.m_basis.getColumn( ( upAxis + 1 ) % 3 ); btVector3 axis = childTransform.m_basis.getColumn( upAxis ); axis.Invert( out axis ); double minTh = -btScalar.SIMD_HALF_PI; double maxTh = btScalar.SIMD_HALF_PI; double minPs = -btScalar.SIMD_HALF_PI; double maxPs = btScalar.SIMD_HALF_PI; drawSpherePatch( ref childTransform.m_origin, ref up, ref axis, radius, minTh, maxTh, minPs, maxPs, ref color, (double)stepDegrees, false ); } } { btTransform childTransform = transform; transform.Apply( ref capEnd, out childTransform.m_origin ); { btVector3 up = childTransform.m_basis.getColumn( ( upAxis + 1 ) % 3 ); btVector3 axis = childTransform.m_basis.getColumn( upAxis ); double minTh = -btScalar.SIMD_HALF_PI; double maxTh = btScalar.SIMD_HALF_PI; double minPs = -btScalar.SIMD_HALF_PI; double maxPs = btScalar.SIMD_HALF_PI; drawSpherePatch( ref childTransform.m_origin, ref up, ref axis, radius, minTh, maxTh, minPs, maxPs, ref color, (double)stepDegrees, false ); } } // Draw some additional lines //btVector3 start = transform.getOrigin(); for( int i = 0; i < 360; i += stepDegrees ) { capEnd[( upAxis + 1 ) % 3] = capStart[( upAxis + 1 ) % 3] = btScalar.btSin( (double)i * btScalar.SIMD_RADS_PER_DEG ) * radius; capEnd[( upAxis + 2 ) % 3] = capStart[( upAxis + 2 ) % 3] = btScalar.btCos( (double)i * btScalar.SIMD_RADS_PER_DEG ) * radius; btVector3 a, b; transform.m_basis.Apply( ref capStart, out a ); a.Add( ref transform.m_origin, out a ); transform.m_basis.Apply( ref capEnd, out b ); a.Add( ref transform.m_origin, out b ); drawLine( ref a, ref b, ref color ); } }
public virtual void drawTransform( ref btTransform transform, double orthoLen ) { //btIVector3 start = transform.getOrigin(); btVector3 a; btVector3 b; btVector3.setValue( out b, orthoLen, 0, 0 ); transform.Apply( ref b, out a ); b.setValue( 0.7, 0, 0 ); drawLine( ref transform.m_origin, ref a, ref b ); btVector3.setValue( out b, 0, orthoLen, 0 ); transform.Apply( ref b, out a ); b.setValue( 0, 0.7, 0 ); drawLine( ref transform.m_origin, ref a, ref b ); btVector3.setValue( out b, 0, 0, orthoLen ); transform.Apply( ref b, out a ); b.setValue( 0, 0, 0.7 ); drawLine( ref transform.m_origin, ref a, ref b ); }
public void putLine( ref btTransform trans, double a, double b, double c, double d, double e, double f, ref btVector3 color ) { btVector3 av; btVector3 bv; btVector3.setValue( out av, a, b, c ); btVector3.setValue( out bv, d, e, f ); trans.Apply( ref av, out av ); trans.Apply( ref bv, out bv ); drawLine( ref av, ref bv, ref color ); }
internal static void calculateDiffAxisAngle( ref btTransform transform0, ref btTransform transform1, out btVector3 axis, out double angle ) { btMatrix3x3 tmp_m; transform0.m_basis.inverse( out tmp_m ); btMatrix3x3 dmat; transform1.m_basis.Mult( ref tmp_m, out dmat ); btQuaternion dorn; dmat.getRotation( out dorn ); ///floating point inaccuracy can lead to w component > 1..., which breaks dorn.normalize(); angle = dorn.getAngle(); axis.x = dorn.x; axis.y = dorn.y; axis.z = dorn.z; axis.w = 0; //check for axis length double len = axis.length2(); if( len < btScalar.SIMD_EPSILON * btScalar.SIMD_EPSILON ) axis = btVector3.xAxis; else axis.Div( btScalar.btSqrt( len ), out axis ); }
public virtual void drawSphere( ref btVector3 p, double radius, ref btVector3 color ) { btTransform tr = new btTransform( ref p ); drawSphere( radius, ref tr, ref color ); }
///synchronizes world transform from physics to user ///Bullet only calls the update of worldtransform for active objects public virtual void setWorldTransform(btTransform centerOfMassWorldTrans) { m_graphicsWorldTrans = centerOfMassWorldTrans * m_centerOfMassOffset ; }
public virtual void drawPlane( ref btVector3 planeNormal, double planeConst, ref btTransform transform, ref btVector3 color ) { btVector3 planeOrigin; planeNormal.Mult( planeConst, out planeOrigin ); btVector3 vec0, vec1; btVector3.btPlaneSpace1( ref planeNormal, out vec0, out vec1 ); double vecLen = 100; vec0.Mult( vecLen, out vec0 ); vec1.Mult( vecLen, out vec1 ); btVector3 pt0; planeOrigin.Add( ref vec0, out pt0 ); btVector3 pt1; planeOrigin.Sub( ref vec0, out pt1 ); btVector3 pt2; planeOrigin.Add( ref vec1, out pt2 ); btVector3 pt3; planeOrigin.Sub( ref vec1, out pt3 ); transform.Apply( ref pt0, out pt0 ); transform.Apply( ref pt1, out pt1 ); transform.Apply( ref pt2, out pt2 ); transform.Apply( ref pt3, out pt3 ); drawLine( ref pt0, ref pt1, ref color ); drawLine( ref pt2, ref pt3, ref color ); }
internal static void calculateVelocity( ref btTransform transform0, ref btTransform transform1, double timeStep, out btVector3 linVel, out btVector3 angVel ) { transform1.m_origin.Sub( ref transform0.m_origin, out linVel ); linVel.Div( timeStep, out linVel ); btVector3 axis; double angle; calculateDiffAxisAngle( ref transform0, ref transform1, out axis, out angle ); axis.Mult( angle, out angVel ); angVel.Div( timeStep, out angVel ); }
btFixedConstraint(btRigidBody rbA,btRigidBody rbB, ref btTransform frameInA,ref btTransform frameInB);
///those virtuals are called by load and can be overridden by the user //bodies virtual btCollisionObject createCollisionObject( ref btTransform startTransform, btCollisionShape* shape,string bodyName);
public bool Equals( ref btTransform t2 ) { return Equals( this, t2 ); }
///synchronizes world transform from physics to user ///Bullet only calls the update of worldtransform for active objects public virtual void setWorldTransform( ref btTransform centerOfMassWorldTrans ) { centerOfMassWorldTrans.Apply( ref m_centerOfMassOffset, out m_graphicsWorldTrans ); }
public virtual void drawCylinder( double radius, double halfHeight, int upAxis, ref btTransform transform, ref btVector3 color ) { btVector3 start = transform.m_origin; btVector3 offsetHeight = btVector3.Zero; offsetHeight[upAxis] = halfHeight; int stepDegrees = 30; btVector3 capStart = btVector3.Zero; capStart[upAxis] = -halfHeight; btVector3 capEnd = btVector3.Zero; capEnd[upAxis] = halfHeight; btVector3 a, b, c; for( int i = 0; i < 360; i += stepDegrees ) { capEnd[( upAxis + 1 ) % 3] = capStart[( upAxis + 1 ) % 3] = btScalar.btSin( (double)( i ) * btScalar.SIMD_RADS_PER_DEG ) * radius; capEnd[( upAxis + 2 ) % 3] = capStart[( upAxis + 2 ) % 3] = btScalar.btCos( (double)( i ) * btScalar.SIMD_RADS_PER_DEG ) * radius; transform.m_basis.Apply( ref capStart, out a ); a.Add( ref start, out a ); transform.m_basis.Apply( ref capEnd, out b ); b.Add( ref start, out b ); drawLine( ref a, ref b, ref color ); } // Drawing top and bottom caps of the cylinder btVector3 yaxis = btVector3.Zero; yaxis[upAxis] = (double)1.0; btVector3 xaxis = btVector3.Zero; xaxis[( upAxis + 1 ) % 3] = (double)1.0; transform.m_basis.Apply( ref offsetHeight, out a ); start.Sub( ref a, out a ); transform.m_basis.Apply( ref yaxis, out b ); transform.m_basis.Apply( ref xaxis, out c ); drawArc( ref a, ref b, ref c, radius, radius, 0, btScalar.SIMD_2_PI, ref color, false, (double)( 10.0 ) ); transform.m_basis.Apply( ref offsetHeight, out a ); start.Add( ref a, out a ); drawArc( ref a, ref b, ref c, radius, radius, 0, btScalar.SIMD_2_PI, ref color, false, (double)10.0 ); }
///synchronizes world transform from user to physics public virtual void getWorldTransform( out btTransform centerOfMassWorldTrans ) { btTransform tmp; m_centerOfMassOffset.inverse( out tmp ); m_graphicsWorldTrans.Apply( ref tmp, out centerOfMassWorldTrans ); }
public virtual void drawCone( double radius, double height, int upAxis, ref btTransform transform, ref btVector3 color ) { int stepDegrees = 30; btVector3 start = transform.m_origin; btVector3 offsetHeight = btVector3.Zero; double halfHeight = height * (double)0.5; offsetHeight[upAxis] = halfHeight; btVector3 offsetRadius = btVector3.Zero; offsetRadius[( upAxis + 1 ) % 3] = radius; btVector3 offset2Radius = btVector3.Zero; offset2Radius[( upAxis + 2 ) % 3] = radius; btVector3 capEnd = btVector3.Zero; capEnd[upAxis] = -halfHeight; btVector3 a, b, c, tmp; for( int i = 0; i < 360; i += stepDegrees ) { capEnd[( upAxis + 1 ) % 3] = btScalar.btSin( (double)i * btScalar.SIMD_RADS_PER_DEG ) * radius; capEnd[( upAxis + 2 ) % 3] = btScalar.btCos( (double)i * btScalar.SIMD_RADS_PER_DEG ) * radius; transform.m_basis.Apply( ref offsetHeight, out a ); a.Add( ref start, out a ); transform.m_basis.Apply( ref capEnd, out b ); b.Add( ref start, out b ); drawLine( ref a, ref b, ref color ); } transform.m_basis.Apply( ref offsetHeight, out a ); start.Add( ref a, out a ); offsetRadius.Sub( ref offsetHeight, out tmp ); transform.m_basis.Apply( ref tmp, out b ); start.Add( ref b, out b ); drawLine( ref a, ref b, ref color ); offsetRadius.Invert( out tmp ); tmp.Sub( ref offsetHeight, out tmp ); transform.m_basis.Apply( ref tmp, out b ); start.Add( ref b, out b ); drawLine( ref a, ref b, ref color ); offset2Radius.Sub( ref offsetHeight, out tmp ); transform.m_basis.Apply( ref tmp, out b ); start.Add( ref b, out b ); drawLine( ref a, ref b, ref color ); offset2Radius.Invert( out tmp ); tmp.Sub( ref offsetHeight, out tmp ); transform.m_basis.Apply( ref tmp, out b ); start.Add( ref b, out b ); drawLine( ref a, ref b, ref color ); // Drawing the base of the cone btVector3 yaxis = btVector3.Zero; yaxis[upAxis] = (double)1.0; btVector3 xaxis = btVector3.Zero; xaxis[( upAxis + 1 ) % 3] = (double)1.0; transform.m_basis.Apply( ref offsetHeight, out a ); start.Sub( ref a, out a ); transform.m_basis.Apply( ref yaxis, out b ); transform.m_basis.Apply( ref xaxis, out c ); drawArc( ref a, ref b, ref c, radius, radius, 0, btScalar.SIMD_2_PI, ref color, false, 10.0 ); }
///synchronizes world transform from user to physics public virtual void getWorldTransform(out btTransform centerOfMassWorldTrans ) { centerOfMassWorldTrans = m_centerOfMassOffset.inverse() * m_graphicsWorldTrans ; }
public virtual void drawSphere( double radius, ref btTransform transform, ref btVector3 color ) { //btIVector3 center = transform.getOrigin(); btVector3 up = transform.m_basis.getColumn( 1 ); btVector3 axis = transform.m_basis.getColumn( 0 ); double minTh = -btScalar.SIMD_HALF_PI; double maxTh = btScalar.SIMD_HALF_PI; double minPs = -btScalar.SIMD_HALF_PI; double maxPs = btScalar.SIMD_HALF_PI; double stepDegrees = 30; drawSpherePatch( ref transform.m_origin, ref up, ref axis, radius, minTh, maxTh, minPs, maxPs, ref color, stepDegrees, false ); btVector3 tmp; axis.Invert( out tmp ); drawSpherePatch( ref transform.m_origin, ref up, ref tmp, radius, minTh, maxTh, minPs, maxPs, ref color, stepDegrees, false ); }
void gimpact_vs_gimpact_find_pairs( btTransform & trans0, btTransform & trans1, btGImpactShapeInterface * shape0, btGImpactShapeInterface * shape1,btPairSet & pairset);
void gimpact_vs_shape_find_pairs( btTransform & trans0, btTransform & trans1, btGImpactShapeInterface * shape0, btCollisionShape * shape1, btList<int> & collided_primitives);
public void initSeparatingDistance( ref btVector3 separatingVector, double separatingDistance, ref btTransform transA, ref btTransform transB ) { m_separatingDistance = separatingDistance; if( m_separatingDistance > 0 ) { m_separatingNormal = separatingVector; m_posA = transA.m_origin; m_posB = transB.m_origin; transA.getRotation( out m_ornA ); transB.getRotation( out m_ornB ); } }
virtual void getAabb(ref btTransform t,ref btVector3 aabbMin,ref btVector3 aabbMax);
public void updateSeparatingDistance( ref btTransform transA, ref btTransform transB ) { btVector3 toPosA; transA.getOrigin( out toPosA ); btVector3 toPosB; transB.getOrigin( out toPosB ); btQuaternion toOrnA; transA.getRotation( out toOrnA ); btQuaternion toOrnB; transB.getRotation( out toOrnB ); if( m_separatingDistance > 0 ) { btVector3 linVelA, angVelA, linVelB, angVelB; btTransformUtil.calculateVelocityQuaternion( ref m_posA, ref toPosA, ref m_ornA, ref toOrnA, 1, out linVelA, out angVelA ); btTransformUtil.calculateVelocityQuaternion( ref m_posB, ref toPosB, ref m_ornB, ref toOrnB, 1, out linVelB, out angVelB ); double maxAngularProjectedVelocity = angVelA.length() * m_boundingRadiusA + angVelB.length() * m_boundingRadiusB; btVector3 relLinVel; linVelB.Sub( ref linVelA, out relLinVel ); double relLinVelocLength = relLinVel.dot( ref m_separatingNormal ); if( relLinVelocLength < 0 ) { relLinVelocLength = 0; } double projectedMotion = maxAngularProjectedVelocity + relLinVelocLength; m_separatingDistance -= projectedMotion; } m_posA = toPosA; m_posB = toPosB; m_ornA = toOrnA; m_ornB = toOrnB; }
/*@brief Test if two transforms have all elements equal */ public static bool Equals( ref btTransform t1, ref btTransform t2 ) { return ( t1.m_basis.Equals( ref t2.m_basis ) && t1.m_origin.Equals( ref t2.m_origin ) ); }
public btTransform inverseTimes(btTransform t) { btVector3 v = t.Origin - Origin; /*return new btTransform(Basis.transposeTimes(t.Basis), v * Basis);*/ btVector3 temp; btMatrix3x3 temp2; btMatrix3x3.Multiply(ref v, ref Basis, out temp); Basis.transposeTimes(ref t.Basis, out temp2); return new btTransform(temp2, temp); }