Exemplo n.º 1
0
        void MigrateCharacterControllerProperties(ShapeComponent physX, ShapeComponent havok)
        {
            havok.SetPropertyValue("Max_Slope", physX.GetPropertyValue("m_fSlopeLimit", false));
            float fRadius = (float)physX.GetPropertyValue("m_fRadius", false);
            float fHeight = (float)physX.GetPropertyValue("m_fHeight", false);

            if (fRadius > 0.0f && fHeight > 0.0f)
            {
                havok.SetPropertyValue("Capsule_Radius", fRadius);
                Vector3F top = new Vector3F(0.0f, 0.0f, fHeight + fRadius);
                havok.SetPropertyValue("Character_Top", top);
                Vector3F bottom = new Vector3F(0.0f, 0.0f, fRadius);
                havok.SetPropertyValue("Character_Bottom", bottom);
            }
            havok.SetPropertyValue("Debug", physX.GetPropertyValue("DebugRendering", false));
        }
Exemplo n.º 2
0
        ShapeComponent CreateScriptComponent(string scriptFileName)
        {
            ShapeComponentType t = (ShapeComponentType)EditorManager.EngineManager.ComponentClassManager.GetCollectionType("VScriptComponent");

            if (t == null)
            {
                return(null);
            }

            ShapeComponent comp = (ShapeComponent)t.CreateInstance(null);

            comp.SetPropertyValue("ScriptFile", scriptFileName);

            return(comp);
        }
Exemplo n.º 3
0
        ShapeComponent CreateLightClippingComponent(CustomVolumeShape volume)
        {
            ShapeComponentType t = (ShapeComponentType)EditorManager.EngineManager.ComponentClassManager.GetCollectionType("VLightClippingVolumeComponent");

            Assert.IsNotNull(t);
            if (t == null)
            {
                return(null);
            }

            ShapeComponent comp = (ShapeComponent)t.CreateInstance(null);

            comp.SetPropertyValue("Volume", volume);

            return(comp);
        }
Exemplo n.º 4
0
        /// <summary>
        /// Map properties from the START_VAR_TABLE(vPhysXRigidBody,... to the counterparts in START_VAR_TABLE(vHavokRigidBody...
        /// </summary>
        /// <param name="physX">Input physX rigid body property</param>
        /// <param name="havok">output havok component</param>
        void MigrateRigidBodyProperties(ShapeComponent physX, ShapeComponent havok)
        {
            {
                // Havok: "Dynamic/Keyframed/Fixed/Sphere Inertia/Box Inertia/Thin Box Inertia/Character"
                // PhysX: "Dynamic/Static/Kinematic"
                string sValue = (string)physX.GetPropertyValue("m_ePhysicsType", false); // since it is an enum, we get it as a string
                if (sValue == "Static")
                {
                    sValue = "Fixed";
                }
                else if (sValue == "Kinematic")
                {
                    sValue = "Keyframed";
                }
                havok.SetPropertyValue("Havok_MotionType", sValue, false);
            }

            {
                // Havok: "Box/Sphere/Convex Hull/File/Capsule/Cylinder/Mesh"
                // PhysX: "Box/Sphere/File/Hull/Mesh"
                string sValue = (string)physX.GetPropertyValue("m_ePhysicsGeom", false); // since it is an enum, we get it as a string
                if (sValue == "Hull" || sValue == "File")
                {
                    sValue = "Convex Hull";                               // since "PhysXFile" + "Havok_FileResourceName" does not match, convert "File" to "Convex Hull"
                }
                havok.SetPropertyValue("Shape_Type", sValue, false);
            }

            // mass of zero is not legal for dynamic rigid bodies in Havok
            float fMass = (float)physX.GetPropertyValue("m_fMass", false);

            if (fMass > 0.0f)
            {
                havok.SetPropertyValue("Havok_Mass", fMass);
            }

            havok.SetPropertyValue("Shape_Height", physX.GetPropertyValue("m_fHeight", false));
            havok.SetPropertyValue("Shape_Radius", physX.GetPropertyValue("m_fRadius", false));
            havok.SetPropertyValue("Shape_PivotOffset", physX.GetPropertyValue("m_vLocalOffset", false));
            havok.SetPropertyValue("Shape_BoxSize", physX.GetPropertyValue("m_bboxSize", false));
            havok.SetPropertyValue("Debug_Render", physX.GetPropertyValue("DebugRendering", false));
        }
Exemplo n.º 5
0
        void MigratePhysXEntityProperties(DynamicPropertyCollection entityProps, ShapeComponent havok)
        {
            {
                // Havok: "Dynamic/Keyframed/Fixed/Sphere Inertia/Box Inertia/Thin Box Inertia/Character"
                // PhysX: "Dynamic/Static/Kinematic"
                string sValue = (string)entityProps.GetPropertyValue("m_ePhysicsType", false); // since it is an enum, we get it as a string
                if (sValue == "Static")
                {
                    sValue = "Fixed";
                }
                else if (sValue == "Kinematic")
                {
                    sValue = "Keyframed";
                }
                havok.SetPropertyValue("Havok_MotionType", sValue, false);
            }

            {
                // Havok: "Box/Sphere/Convex Hull/File/Capsule/Cylinder/Mesh"
                // PhysX: "Box/Sphere/File/Hull/Mesh"
                string sValue = (string)entityProps.GetPropertyValue("m_ePhysicsGeom", false); // since it is an enum, we get it as a string
                if (sValue == "Hull" || sValue == "File")
                {
                    sValue = "Convex Hull";                               // since PhysXFile + Havok_FileResourceName does not match, convert "File" to "Convex Hull"
                }
                havok.SetPropertyValue("Shape_Type", sValue, false);
            }

            // mass of zero is not legal for dynamic rigid bodies in Havok. Furthermore, very old versions of the entity class
            // did not have a mass property, so additionally check whether the property is there
            object fValue = entityProps.GetPropertyValue("m_fMass", false);

            if ((fValue is float) && ((float)fValue) > 0.0f)
            {
                havok.SetPropertyValue("Havok_Mass", fValue);
            }

            havok.SetPropertyValue("Shape_Radius", entityProps.GetPropertyValue("m_fRadius", false));
            havok.SetPropertyValue("Shape_BoxSize", entityProps.GetPropertyValue("m_bboxSize", false));
            havok.SetPropertyValue("Shape_PivotOffset", entityProps.GetPropertyValue("m_bLocalOffset", false));
            havok.SetPropertyValue("Debug_Render", entityProps.GetPropertyValue("DebugRendering", false));
        }
Exemplo n.º 6
0
        /// <summary>
        /// Map properties from the START_VAR_TABLE(vPhysXRigidBody,... to the counterparts in START_VAR_TABLE(vHavokRigidBody...
        /// </summary>
        /// <param name="physX">Input physX rigid body property</param>
        /// <param name="havok">output havok component</param>
        void MigrateRigidBodyProperties(ShapeComponent physX, ShapeComponent havok)
        {
            {
            // Havok: "Dynamic/Keyframed/Fixed/Sphere Inertia/Box Inertia/Thin Box Inertia/Character"
            // PhysX: "Dynamic/Static/Kinematic"
            string sValue = (string)physX.GetPropertyValue("m_ePhysicsType", false); // since it is an enum, we get it as a string
            if (sValue == "Static") sValue = "Fixed";
            else if (sValue == "Kinematic") sValue = "Keyframed";
            havok.SetPropertyValue("Havok_MotionType", sValue, false);
              }

              {
            // Havok: "Box/Sphere/Convex Hull/File/Capsule/Cylinder/Mesh"
            // PhysX: "Box/Sphere/File/Hull/Mesh"
            string sValue = (string)physX.GetPropertyValue("m_ePhysicsGeom", false); // since it is an enum, we get it as a string
            if (sValue == "Hull" || sValue == "File") sValue = "Convex Hull"; // since "PhysXFile" + "Havok_FileResourceName" does not match, convert "File" to "Convex Hull"
            havok.SetPropertyValue("Shape_Type", sValue, false);
              }

              // mass of zero is not legal for dynamic rigid bodies in Havok
              float fMass = (float)physX.GetPropertyValue("m_fMass", false);
              if (fMass > 0.0f)
            havok.SetPropertyValue("Havok_Mass", fMass);

              havok.SetPropertyValue("Shape_Height", physX.GetPropertyValue("m_fHeight", false));
              havok.SetPropertyValue("Shape_Radius", physX.GetPropertyValue("m_fRadius", false));
              havok.SetPropertyValue("Shape_PivotOffset", physX.GetPropertyValue("m_vLocalOffset", false));
              havok.SetPropertyValue("Shape_BoxSize", physX.GetPropertyValue("m_bboxSize", false));
              havok.SetPropertyValue("Debug_Render", physX.GetPropertyValue("DebugRendering", false));
        }
Exemplo n.º 7
0
        void MigratePhysXEntityProperties(DynamicPropertyCollection entityProps, ShapeComponent havok)
        {
            {
            // Havok: "Dynamic/Keyframed/Fixed/Sphere Inertia/Box Inertia/Thin Box Inertia/Character"
            // PhysX: "Dynamic/Static/Kinematic"
            string sValue = (string)entityProps.GetPropertyValue("m_ePhysicsType", false); // since it is an enum, we get it as a string
            if (sValue == "Static") sValue = "Fixed";
            else if (sValue == "Kinematic") sValue = "Keyframed";
            havok.SetPropertyValue("Havok_MotionType", sValue, false);
              }

              {
            // Havok: "Box/Sphere/Convex Hull/File/Capsule/Cylinder/Mesh"
            // PhysX: "Box/Sphere/File/Hull/Mesh"
            string sValue = (string)entityProps.GetPropertyValue("m_ePhysicsGeom", false); // since it is an enum, we get it as a string
            if (sValue == "Hull" || sValue == "File") sValue = "Convex Hull"; // since PhysXFile + Havok_FileResourceName does not match, convert "File" to "Convex Hull"
            havok.SetPropertyValue("Shape_Type", sValue, false);
              }

              // mass of zero is not legal for dynamic rigid bodies in Havok. Furthermore, very old versions of the entity class
              // did not have a mass property, so additionally check whether the property is there
              object fValue = entityProps.GetPropertyValue("m_fMass", false);
              if ((fValue is float) && ((float)fValue) > 0.0f)
            havok.SetPropertyValue("Havok_Mass", fValue);

              havok.SetPropertyValue("Shape_Radius", entityProps.GetPropertyValue("m_fRadius", false));
              havok.SetPropertyValue("Shape_BoxSize", entityProps.GetPropertyValue("m_bboxSize", false));
              havok.SetPropertyValue("Shape_PivotOffset", entityProps.GetPropertyValue("m_bLocalOffset", false));
              havok.SetPropertyValue("Debug_Render", entityProps.GetPropertyValue("DebugRendering", false));
        }
Exemplo n.º 8
0
 void MigrateLineFollowerEntityProperties(DynamicPropertyCollection entityProps, ShapeComponent component)
 {
     component.SetPropertyValue("Model_AnimationName", entityProps.GetPropertyValue("AnimationName", false), false);
       component.SetPropertyValue("Path_Key", entityProps.GetPropertyValue("PathKey", false), false);
       component.SetPropertyValue("Path_NumberSteps", entityProps.GetPropertyValue("PathSteps", false), false);
       component.SetPropertyValue("Path_TriggerDistance", entityProps.GetPropertyValue("TriggerDistance", false), false);
       component.SetPropertyValue("Path_InitialOffset", entityProps.GetPropertyValue("InitialOffset", false), false);
       component.SetPropertyValue("Model_DeltaRotation", entityProps.GetPropertyValue("DeltaRotation", false), false);
       component.SetPropertyValue("Model_GroundOffset", entityProps.GetPropertyValue("ModelOffset", false), false);
       component.SetPropertyValue("Model_CapsuleHeight", entityProps.GetPropertyValue("CapsuleHeight", false), false);
       component.SetPropertyValue("Model_CapsuleRadius", entityProps.GetPropertyValue("CapsuleRadius", false), false);
       component.SetPropertyValue("Debug_DisplayBoxes", entityProps.GetPropertyValue("DisplayBoxes", false), false);
       component.SetPropertyValue("Debug_RenderMesh", entityProps.GetPropertyValue("DebugRendering", false), false);
 }
Exemplo n.º 9
0
 void MigrateCharacterControllerProperties(ShapeComponent physX, ShapeComponent havok)
 {
     havok.SetPropertyValue("Max_Slope", physX.GetPropertyValue("m_fSlopeLimit", false));
       float fRadius = (float)physX.GetPropertyValue("m_fRadius", false);
       float fHeight = (float)physX.GetPropertyValue("m_fHeight", false);
       if (fRadius > 0.0f && fHeight > 0.0f)
       {
     havok.SetPropertyValue("Capsule_Radius", fRadius);
     Vector3F top = new Vector3F(0.0f, 0.0f, fHeight + fRadius);
     havok.SetPropertyValue("Character_Top", top);
     Vector3F bottom = new Vector3F(0.0f, 0.0f, fRadius);
     havok.SetPropertyValue("Character_Bottom", bottom);
       }
       havok.SetPropertyValue("Debug", physX.GetPropertyValue("DebugRendering", false));
 }
Exemplo n.º 10
0
 void MigrateLineFollowerEntityProperties(DynamicPropertyCollection entityProps, ShapeComponent component)
 {
     component.SetPropertyValue("Model_AnimationName", entityProps.GetPropertyValue("AnimationName", false), false);
     component.SetPropertyValue("Path_Key", entityProps.GetPropertyValue("PathKey", false), false);
     component.SetPropertyValue("Path_NumberSteps", entityProps.GetPropertyValue("PathSteps", false), false);
     component.SetPropertyValue("Path_TriggerDistance", entityProps.GetPropertyValue("TriggerDistance", false), false);
     component.SetPropertyValue("Path_InitialOffset", entityProps.GetPropertyValue("InitialOffset", false), false);
     component.SetPropertyValue("Model_DeltaRotation", entityProps.GetPropertyValue("DeltaRotation", false), false);
     component.SetPropertyValue("Model_GroundOffset", entityProps.GetPropertyValue("ModelOffset", false), false);
     component.SetPropertyValue("Model_CapsuleHeight", entityProps.GetPropertyValue("CapsuleHeight", false), false);
     component.SetPropertyValue("Model_CapsuleRadius", entityProps.GetPropertyValue("CapsuleRadius", false), false);
     component.SetPropertyValue("Debug_DisplayBoxes", entityProps.GetPropertyValue("DisplayBoxes", false), false);
     component.SetPropertyValue("Debug_RenderMesh", entityProps.GetPropertyValue("DebugRendering", false), false);
 }