///<summary>
 /// Constructs a new compound shape entry using the volume of the shape as a weight.
 ///</summary>
 ///<param name="shape">Shape to use.</param>
 ///<param name="localTransform">Local transform of the shape.</param>
 public CompoundShapeEntry(EntityShape shape, RigidTransform localTransform)
 {
     localTransform.Validate();
     LocalTransform = localTransform;
     Shape          = shape;
     Weight         = shape.Volume;
 }
 ///<summary>
 /// Constructs a new compound shape entry using the volume of the shape as a weight.
 ///</summary>
 ///<param name="shape">Shape to use.</param>
 ///<param name="localTransform">Local transform of the shape.</param>
 ///<param name="weight">Weight of the entry.  This defines how much the entry contributes to its owner
 /// for the purposes of center of rotation computation.</param>
 public CompoundShapeEntry(EntityShape shape, RigidTransform localTransform, float weight)
 {
     localTransform.Validate();
     LocalTransform = localTransform;
     Shape          = shape;
     Weight         = weight;
 }
Exemple #3
0
        ///<summary>
        /// Updates the world transform of the shape using the given position and orientation.
        /// The world transform of the shape is offset from the given position and orientation by the collidable's LocalPosition.
        ///</summary>
        ///<param name="position">Position to use for the calculation.</param>
        ///<param name="orientation">Orientation to use for the calculation.</param>
        public virtual void UpdateWorldTransform(ref Vector3 position, ref Quaternion orientation)
        {
            Quaternion.Transform(ref localPosition, ref orientation, out worldTransform.Position);
            Vector3.Add(ref worldTransform.Position, ref position, out worldTransform.Position);
            worldTransform.Orientation = orientation;

            worldTransform.Validate();
        }