internal void UpdateMassProps(HkRigidBody rb)
 {
     var mp = new HkMassProperties();
     mp.InertiaTensor = rb.InertiaTensor;
     mp.Mass = rb.Mass;
     mp.CenterOfMass = rb.CenterOfMassLocal;
     MassElement = new HkMassElement();
     MassElement.Properties = mp;
     MassElement.Tranform = Transform;
     //MassElement.Tranform.Translation = Vector3.Transform(rb.CenterOfMassLocal, Transform);
 }
 internal void UpdateMassProps(HkRigidBody rb)
 {
     var mp = new HkMassProperties();
     mp.InertiaTensor = rb.InertiaTensor;
     mp.Mass = rb.Mass;
     mp.CenterOfMass = rb.CenterOfMassLocal;
     MassElement = new HkMassElement();
     MassElement.Properties = mp;
     MassElement.Tranform = Transform;
     //MassElement.Tranform.Translation = Vector3.Transform(rb.CenterOfMassLocal, Transform);
 }
Exemplo n.º 3
0
        private void AddMass(MySlimBlock block, IDictionary <Vector3I, HkMassElement> massResults)
        {
            float mass = block.BlockDefinition.Mass;

            if (MyFakes.ENABLE_COMPOUND_BLOCKS && (block.FatBlock is MyCompoundCubeBlock))
            {
                mass = 0f;
                foreach (MySlimBlock block2 in (block.FatBlock as MyCompoundCubeBlock).GetBlocks())
                {
                    mass += block2.GetMass();
                }
            }
            HkMassProperties properties = new HkMassProperties();
            HkMassElement    element    = new HkMassElement {
                Properties = HkInertiaTensorComputer.ComputeBoxVolumeMassProperties((((block.Max - block.Min) + Vector3I.One) * block.CubeGrid.GridSize) / 2f, mass),
                Tranform   = Matrix.CreateTranslation(((block.Min + block.Max) * 0.5f) * block.CubeGrid.GridSize)
            };

            massResults[block.Position] = element;
        }
Exemplo n.º 4
0
 internal void SetMassProps(HkMassProperties mp)
 {
     MassElement            = new HkMassElement();
     MassElement.Properties = mp;
     MassElement.Tranform   = Transform;
 }
 internal void SetMassProps(HkMassProperties mp)
 {
     MassElement = new HkMassElement();
     MassElement.Properties = mp;
     MassElement.Tranform = Transform;
 }