public unsafe RigidBody(RigidBodyDefinition description, BulletScene scene, btCollisionShape collisionShape, Vector3 initialTrans, Quaternion initialRot) : base(description.Name) { this.scene = scene; shapeName = description.ShapeName; collisionFilterMask = description.CollisionFilterMask; collisionFilterGroup = description.CollisionFilterGroup; StayLocalTransform = description.StayLocalTransform; motionState = scene.createMotionState(this, description.MaxContactDistance, ref initialTrans, ref initialRot); rigidBody = btRigidBody_Create(ref description.constructionInfo, motionState.motionState, collisionShape.BulletShape); setLinearVelocity(description.LinearVelocity); setAngularVelocity(description.AngularVelocity); forceActivationState(description.CurrentActivationState); setAnisotropicFriction(description.AnisotropicFriction); setDeactivationTime(description.DeactivationTime); setCollisionFlags(description.Flags); setHitFraction(description.HitFraction); LinearFactor = description.LinearFactor; AngularFactor = description.AngularFactor; RigidBodyManager.add(rigidBody, this); }
public IntPtr create(MotionState obj, float maxContactDistance, ref Vector3 initialTrans, ref Quaternion initialRot) { handle = GCHandle.Alloc(obj); return(MotionState_Create(xformCallback, contactStartedCallback, contactEndedCallback, contactContinuesCallback, maxContactDistance, ref initialTrans, ref initialRot, GCHandle.ToIntPtr(handle))); }