public ReshapeableRigidBodySection(ReshapeableRigidBody parent, btCollisionShape collisionShape, Vector3 translation, Quaternion rotation) { this.parent = parent; this.collisionShape = collisionShape; parent.CompoundShape.addChildShape(collisionShape, translation, rotation); }
public virtual void Dispose() { if (collisionShape != null) { collisionShape.Dispose(); collisionShape = null; } }
internal override void createProduct(SimObjectBase instance, BulletScene scene) { BulletShapeRepository repository = BulletInterface.Instance.ShapeRepository; if (repository.containsValidCollection(ShapeName)) { btCollisionShape shape = repository.getCollection(ShapeName).CollisionShape; if (constructionInfo.m_mass != 0.0f) { shape.calculateLocalInertia(constructionInfo.m_mass, ref constructionInfo.m_localInertia); } RigidBody rigidBody = new RigidBody(this, scene, shape, instance.Translation, instance.Rotation); instance.addElement(rigidBody); } else { Log.Default.sendMessage("Could not find collision shape named {0}.", LogLevel.Warning, "BulletPlugin", ShapeName); } }
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 BulletShapeCollection(btCollisionShape collisionShape, String name) { this.collisionShape = collisionShape; this.Name = name; }
private void commitShape(String name, Vector3 translation, Quaternion rotation, btCollisionShape collisionShape) { if (currentCompound != null) { currentCompound.addChildShape(collisionShape, translation, rotation); } else { repository.addCollection(new BulletShapeCollection(collisionShape, name)); } }
/// <summary> /// Remove a child shape from the object. Note that removing a child will make it no longer /// owned by this object, which means the caller is taking responsibility for deleting the shape. /// </summary> /// <param name="child"></param> public void removeChildShape(btCollisionShape child) { CompoundShape_removeChildShape(btShape, child.BulletShape); }
/// <summary> /// Add a child to this shape, note that this object will take ownership of the children /// and will delete them itself. /// </summary> public void addChildShape(btCollisionShape child, Vector3 translation, Quaternion rotation) { CompoundShape_addChildShape(btShape, child.BulletShape, ref translation, ref rotation); }