28 using System.Collections.Generic;
29 using System.Runtime.InteropServices;
30 using System.Security;
34 namespace OpenSim.
Region.PhysicsModule.BulletS {
54 [StructLayout(LayoutKind.Sequential)]
93 [StructLayout(LayoutKind.Sequential)]
114 public const float numericTrue = 1f;
115 public const float numericFalse = 0f;
117 [StructLayout(LayoutKind.Sequential)]
125 [StructLayout(LayoutKind.Sequential)]
132 [StructLayout(LayoutKind.Sequential)]
141 [StructLayout(LayoutKind.Sequential)]
153 StringBuilder buff =
new StringBuilder();
155 buff.Append(ID.ToString());
157 buff.Append(Position.ToString());
159 buff.Append(Rotation.ToString());
161 buff.Append(Velocity.ToString());
163 buff.Append(Acceleration.ToString());
165 buff.Append(RotationalVelocity.ToString());
167 return buff.ToString();
174 [StructLayout(LayoutKind.Sequential)]
196 public const float numericTrue = 1f;
197 public const float numericFalse = 0f;
201 [StructLayout(LayoutKind.Sequential)]
320 public abstract string BulletEngineName {
get; }
321 public abstract string BulletEngineVersion {
get;
protected set;}
329 public abstract int PhysicsStep(
BulletWorld world,
float timeStep,
int maxSubSteps,
float fixedTimeStep,
330 out
int updatedEntityCount, out
int collidersCount);
332 public abstract bool UpdateParameter(
BulletWorld world, UInt32 localID, String parm,
float value);
336 public abstract bool PushUpdate(
BulletBody obj);
341 int indicesCount,
int[] indices,
342 int verticesCount,
float[] vertices );
345 int indicesCount,
int[] indices,
346 int verticesCount,
float[] vertices );
349 int hullCount,
float[] hulls);
356 int indicesCount,
int[] indices,
357 int verticesCount,
float[] vertices );
361 public abstract bool IsNativeShape(
BulletShape shape);
363 public abstract void SetShapeCollisionMargin(
BulletShape shape,
float margin);
365 public abstract BulletShape BuildCapsuleShape(
BulletWorld world,
float radius,
float height, Vector3 scale);
369 public abstract int GetNumberOfCompoundChildren(
BulletShape cShape);
371 public abstract void AddChildShapeToCompoundShape(
BulletShape cShape,
BulletShape addShape, Vector3 pos, Quaternion rot);
379 public abstract void UpdateChildTransform(
BulletShape pShape,
int childIndex, Vector3 pos, Quaternion rot,
bool shouldRecalculateLocalAabb);
381 public abstract void RecalculateCompoundShapeLocalAabb(
BulletShape cShape);
391 public abstract BulletBody CreateBodyWithDefaultMotionState(
BulletShape shape, UInt32
id, Vector3 pos, Quaternion rot);
398 public abstract BulletShape CreateGroundPlaneShape(UInt32
id,
float height,
float collisionMargin);
400 public abstract BulletShape CreateTerrainShape(UInt32
id, Vector3 size,
float minHeight,
float maxHeight,
float[] heightMap,
401 float scaleFactor,
float collisionMargin);
406 Vector3 frame1loc, Quaternion frame1rot,
407 Vector3 frame2loc, Quaternion frame2rot,
408 bool useLinearReferenceFrameA,
bool disableCollisionsBetweenLinkedBodies);
412 bool useLinearReferenceFrameA,
bool disableCollisionsBetweenLinkedBodies);
415 Vector3 frameInBloc, Quaternion frameInBrot,
416 bool useLinearReferenceFrameB,
bool disableCollisionsBetweenLinkedBodies);
419 Vector3 frame1loc, Quaternion frame1rot,
420 Vector3 frame2loc, Quaternion frame2rot,
421 bool useLinearReferenceFrameA,
bool disableCollisionsBetweenLinkedBodies);
424 Vector3 pivotinA, Vector3 pivotinB,
425 Vector3 axisInA, Vector3 axisInB,
426 bool useLinearReferenceFrameA,
bool disableCollisionsBetweenLinkedBodies);
429 Vector3 frameInAloc, Quaternion frameInArot,
430 Vector3 frameInBloc, Quaternion frameInBrot,
431 bool useLinearReferenceFrameA,
bool disableCollisionsBetweenLinkedBodies);
434 Vector3 frameInAloc, Quaternion frameInArot,
435 Vector3 frameInBloc, Quaternion frameInBrot,
436 bool disableCollisionsBetweenLinkedBodies);
439 Vector3 axisInA, Vector3 axisInB,
440 float ratio,
bool disableCollisionsBetweenLinkedBodies);
443 Vector3 pivotInA, Vector3 pivotInB,
444 bool disableCollisionsBetweenLinkedBodies);
446 public abstract void SetConstraintEnable(
BulletConstraint constrain,
float numericTrueFalse);
448 public abstract void SetConstraintNumSolverIterations(
BulletConstraint constrain,
float iterations);
451 Vector3 frameA, Quaternion frameArot, Vector3 frameB, Quaternion frameBrot);
453 public abstract bool SetLinearLimits(
BulletConstraint constrain, Vector3 low, Vector3 hi);
455 public abstract bool SetAngularLimits(
BulletConstraint constrain, Vector3 low, Vector3 hi);
457 public abstract bool UseFrameOffset(
BulletConstraint constrain,
float enable);
459 public abstract bool TranslationalLimitMotor(
BulletConstraint constrain,
float enable,
float targetVel,
float maxMotorForce);
461 public abstract bool SetBreakingImpulseThreshold(
BulletConstraint constrain,
float threshold);
463 public const int HINGE_NOT_SPECIFIED = -1;
464 public abstract bool HingeSetLimits(
BulletConstraint constrain,
float low,
float high,
float softness,
float bias,
float relaxation);
466 public abstract bool SpringEnable(
BulletConstraint constrain,
int index,
float numericTrueFalse);
468 public const int SPRING_NOT_SPECIFIED = -1;
469 public abstract bool SpringSetEquilibriumPoint(
BulletConstraint constrain,
int index,
float equilibriumPoint);
471 public abstract bool SpringSetStiffness(
BulletConstraint constrain,
int index,
float stiffnesss);
473 public abstract bool SpringSetDamping(
BulletConstraint constrain,
int index,
float damping);
475 public const int SLIDER_LOWER_LIMIT = 0;
476 public const int SLIDER_UPPER_LIMIT = 1;
477 public const int SLIDER_LINEAR = 2;
478 public const int SLIDER_ANGULAR = 3;
479 public abstract bool SliderSetLimits(
BulletConstraint constrain,
int lowerUpper,
int linAng,
float val);
481 public const int SLIDER_SET_SOFTNESS = 4;
482 public const int SLIDER_SET_RESTITUTION = 5;
483 public const int SLIDER_SET_DAMPING = 6;
484 public const int SLIDER_SET_DIRECTION = 7;
485 public const int SLIDER_SET_LIMIT = 8;
486 public const int SLIDER_SET_ORTHO = 9;
487 public abstract bool SliderSet(
BulletConstraint constrain,
int softRestDamp,
int dirLimOrtho,
int linAng,
float val);
489 public abstract bool SliderMotorEnable(
BulletConstraint constrain,
int linAng,
float numericTrueFalse);
491 public const int SLIDER_MOTOR_VELOCITY = 10;
492 public const int SLIDER_MAX_MOTOR_FORCE = 11;
493 public abstract bool SliderMotor(
BulletConstraint constrain,
int forceVel,
int linAng,
float val);
505 public abstract void UpdateAabbs(
BulletWorld world);
507 public abstract bool GetForceUpdateAllAabbs(
BulletWorld world);
509 public abstract void SetForceUpdateAllAabbs(
BulletWorld world,
bool force);
520 public abstract bool AddConstraintToWorld(
BulletWorld world,
BulletConstraint constrain,
bool disableCollisionsBetweenLinkedObjects);
527 public abstract Vector3 SetAnisotripicFriction(
BulletConstraint constrain, Vector3 frict);
531 public abstract void SetContactProcessingThreshold(
BulletBody obj,
float val);
533 public abstract float GetContactProcessingThreshold(
BulletBody obj);
535 public abstract bool IsStaticObject(
BulletBody obj);
537 public abstract bool IsKinematicObject(
BulletBody obj);
539 public abstract bool IsStaticOrKinematicObject(
BulletBody obj);
541 public abstract bool HasContactResponse(
BulletBody obj);
547 public abstract int GetActivationState(
BulletBody obj);
549 public abstract void SetActivationState(
BulletBody obj,
int state);
551 public abstract void SetDeactivationTime(
BulletBody obj,
float dtime);
553 public abstract float GetDeactivationTime(
BulletBody obj);
557 public abstract void Activate(
BulletBody obj,
bool forceActivation);
559 public abstract bool IsActive(
BulletBody obj);
561 public abstract void SetRestitution(
BulletBody obj,
float val);
563 public abstract float GetRestitution(
BulletBody obj);
565 public abstract void SetFriction(
BulletBody obj,
float val);
567 public abstract float GetFriction(
BulletBody obj);
569 public abstract Vector3 GetPosition(
BulletBody obj);
571 public abstract Quaternion GetOrientation(
BulletBody obj);
573 public abstract void SetTranslation(
BulletBody obj, Vector3 position, Quaternion
rotation);
579 public abstract void SetInterpolationLinearVelocity(
BulletBody obj, Vector3 vel);
581 public abstract void SetInterpolationAngularVelocity(
BulletBody obj, Vector3 vel);
583 public abstract void SetInterpolationVelocity(
BulletBody obj, Vector3 linearVel, Vector3 angularVel);
585 public abstract float GetHitFraction(
BulletBody obj);
587 public abstract void SetHitFraction(
BulletBody obj,
float val);
597 public abstract float GetCcdMotionThreshold(
BulletBody obj);
599 public abstract void SetCcdMotionThreshold(
BulletBody obj,
float val);
601 public abstract float GetCcdSweptSphereRadius(
BulletBody obj);
603 public abstract void SetCcdSweptSphereRadius(
BulletBody obj,
float val);
605 public abstract IntPtr GetUserPointer(
BulletBody obj);
607 public abstract void SetUserPointer(
BulletBody obj, IntPtr val);
611 public abstract void ApplyGravity(
BulletBody obj);
613 public abstract void SetGravity(
BulletBody obj, Vector3 val);
615 public abstract Vector3 GetGravity(
BulletBody obj);
617 public abstract void SetDamping(
BulletBody obj,
float lin_damping,
float ang_damping);
619 public abstract void SetLinearDamping(
BulletBody obj,
float lin_damping);
621 public abstract void SetAngularDamping(
BulletBody obj,
float ang_damping);
623 public abstract float GetLinearDamping(
BulletBody obj);
625 public abstract float GetAngularDamping(
BulletBody obj);
627 public abstract float GetLinearSleepingThreshold(
BulletBody obj);
629 public abstract void ApplyDamping(
BulletBody obj,
float timeStep);
631 public abstract void SetMassProps(
BulletBody obj,
float mass, Vector3 inertia);
633 public abstract Vector3 GetLinearFactor(
BulletBody obj);
635 public abstract void SetLinearFactor(
BulletBody obj, Vector3 factor);
637 public abstract void SetCenterOfMassByPosRot(
BulletBody obj, Vector3 pos, Quaternion rot);
640 public abstract void ApplyCentralForce(
BulletBody obj, Vector3 force);
643 public abstract void SetObjectForce(
BulletBody obj, Vector3 force);
645 public abstract Vector3 GetTotalForce(
BulletBody obj);
647 public abstract Vector3 GetTotalTorque(
BulletBody obj);
649 public abstract Vector3 GetInvInertiaDiagLocal(
BulletBody obj);
651 public abstract void SetInvInertiaDiagLocal(
BulletBody obj, Vector3 inert);
653 public abstract void SetSleepingThresholds(
BulletBody obj,
float lin_threshold,
float ang_threshold);
655 public abstract void ApplyTorque(
BulletBody obj, Vector3 torque);
658 public abstract void ApplyForce(
BulletBody obj, Vector3 force, Vector3 pos);
661 public abstract void ApplyCentralImpulse(
BulletBody obj, Vector3 imp);
664 public abstract void ApplyTorqueImpulse(
BulletBody obj, Vector3 imp);
667 public abstract void ApplyImpulse(
BulletBody obj, Vector3 imp, Vector3 pos);
669 public abstract void ClearForces(
BulletBody obj);
671 public abstract void ClearAllForces(
BulletBody obj);
673 public abstract void UpdateInertiaTensor(
BulletBody obj);
675 public abstract Vector3 GetLinearVelocity(
BulletBody obj);
677 public abstract Vector3 GetAngularVelocity(
BulletBody obj);
679 public abstract void SetLinearVelocity(
BulletBody obj, Vector3 val);
681 public abstract void SetAngularVelocity(
BulletBody obj, Vector3 angularVelocity);
683 public abstract Vector3 GetVelocityInLocalPoint(
BulletBody obj, Vector3 pos);
685 public abstract void Translate(
BulletBody obj, Vector3 trans);
687 public abstract void UpdateDeactivation(
BulletBody obj,
float timeStep);
689 public abstract bool WantsSleeping(
BulletBody obj);
691 public abstract void SetAngularFactor(
BulletBody obj,
float factor);
693 public abstract void SetAngularFactorV(
BulletBody obj, Vector3 factor);
695 public abstract Vector3 GetAngularFactor(
BulletBody obj);
705 public abstract int GetNumConstraintRefs(
BulletBody obj);
707 public abstract bool SetCollisionGroupMask(
BulletBody body, UInt32 filter, UInt32 mask);
712 public abstract float GetAngularMotionDisc(
BulletShape shape);
714 public abstract float GetContactBreakingThreshold(
BulletShape shape,
float defaultFactor);
716 public abstract bool IsPolyhedral(
BulletShape shape);
718 public abstract bool IsConvex2d(
BulletShape shape);
722 public abstract bool IsNonMoving(
BulletShape shape);
726 public abstract bool IsCompound(
BulletShape shape);
728 public abstract bool IsSoftBody(
BulletShape shape);
730 public abstract bool IsInfinite(
BulletShape shape);
732 public abstract void SetLocalScaling(
BulletShape shape, Vector3 scale);
734 public abstract Vector3 GetLocalScaling(
BulletShape shape);
736 public abstract Vector3 CalculateLocalInertia(
BulletShape shape,
float mass);
738 public abstract int GetShapeType(
BulletShape shape);
740 public abstract void SetMargin(
BulletShape shape,
float val);
742 public abstract float GetMargin(
BulletShape shape);
float vHACDminVolumePerCH
float globalContactBreakingThreshold
virtual void DumpAllInfo(BulletWorld sim)
virtual void DumpCollisionShape(BulletWorld sim, BulletShape collisionShape)
float vHACDconvexHullDownsampling
float shouldRandomizeSolverOrder
float maxPersistantManifoldPoolSize
float shouldSplitSimulationIslands
virtual void DumpConstraint(BulletWorld sim, BulletConstraint constrain)
float maxCollisionAlgorithmPoolSize
float physicsLoggingFrames
float shouldAdjustCollisionMargin
override string ToString()
OpenSim.Region.ScriptEngine.Shared.LSL_Types.Quaternion rotation
virtual void ResetConstraintSolver(BulletWorld sim)
float vHACDmaxNumVerticesPerCH
float shouldDisableContactPoolDynamicAllocation
float shouldForceUpdateAllAabbs
Vector3 RotationalVelocity
virtual void DumpActivationInfo(BulletWorld sim)
virtual void DumpRigidBody(BulletWorld sim, BulletBody collisionObject)
float useSingleSidedMeshes
float addNeighboursDistPoints
float vHACDplaneDownsampling
float shouldEnableFrictionCaching
float numberOfSolverIterations
virtual void DumpPhysicsStatistics(BulletWorld sim)
virtual void ResetBroadphasePool(BulletWorld sim)