public void applyImpulse(btVector3 impulse, btVector3 rel_pos) { if (m_inverseMass != 0f) { applyCentralImpulse(impulse); if (m_angularFactor.X != 0 && m_angularFactor.Y != 0 && m_angularFactor.Z != 0) { applyTorqueImpulse(rel_pos.cross(impulse * m_linearFactor)); } } }
public void applyForce(btVector3 force, btVector3 rel_pos) { applyCentralForce(force); applyTorque(rel_pos.cross(force * m_linearFactor)); }
public static void cross(ref btVector3 v1, ref btVector3 v2, out btVector3 result) { v1.cross(ref v2, out result); }
public virtual void drawArc(ref btVector3 center,ref btVector3 normal,ref btVector3 axis, float radiusA, float radiusB, float minAngle, float maxAngle, btVector3 color, bool drawSect, float stepDegrees) { btVector3 vx = axis; btVector3 vy = normal.cross(axis); float step = stepDegrees * BulletGlobal.SIMD_RADS_PER_DEG; int nSteps = (int)((maxAngle - minAngle) / step); if (nSteps == 0) nSteps = 1; btVector3 prev;// = center + radiusA * vx * (float)Math.Cos(minAngle) + radiusB * vy * (float)Math.Sin(minAngle); { btVector3 temp1, temp2, temp3,temp4,temp5; btVector3.Multiply(ref vx, radiusA, out temp1); btVector3.Multiply(ref temp1, (float)Math.Cos(minAngle), out temp2); btVector3.Multiply(ref vy, radiusB, out temp3); btVector3.Multiply(ref temp3, (float)Math.Sin(minAngle), out temp4); btVector3.Add(ref center, ref temp2, out temp5); btVector3.Add(ref temp5, ref temp4, out prev); } if (drawSect) { drawLine(ref center, ref prev, ref color); } for (int i = 1; i <= nSteps; i++) { float angle = minAngle + (maxAngle - minAngle) * (float)(i) / (float)(nSteps); btVector3 next;// = center + radiusA * vx * (float)Math.Cos(angle) + radiusB * vy * (float)Math.Cos(angle); { btVector3 temp1, temp2, temp3, temp4, temp5; btVector3.Multiply(ref vx, radiusA, out temp1); btVector3.Multiply(ref temp1, (float)Math.Cos(angle), out temp2); btVector3.Multiply(ref vy, radiusB, out temp3); btVector3.Multiply(ref temp3, (float)Math.Cos(angle), out temp4); btVector3.Add(ref center, ref temp2, out temp5); btVector3.Add(ref temp5, ref temp4, out next); } drawLine(ref prev, ref next, ref color); prev = next; } if (drawSect) { drawLine(ref center, ref prev, ref color); } }
public static btVector3 cross(btVector3 v1, btVector3 v2) { return v1.cross(v2); }