{"name":"How to create destroyable wheels","title":"How to create destroyable wheels","type":"topic","url":"https://community.bistudio.com/wiki/How_to_create_destroyable_wheels","revid":293910,"updated":"2021-10-30T01:10:49Z","aliases":[],"markdown":"#### The Principle\n\nThe model already contains the destroyed wheels, but they are hidden with animations. These animations uses the damage value of hitpoints to switch the wheels when needed.\n\n#### Prepare the model\n\nIn the case of wheels it makes sense to create an extra model for a destroyed wheel. This way you are able to implement the destroyed wheels in the original model via proxies which reference to the destroyed wheel model. It doesn't need to be done via proxies though. Now, you just need to create named selections for every wheel and for every destroyed wheel. The normal wheels are called \"wheel_x_x_hide\" and the destroyed ones \"wheel_x_x_unhide\" in this tutorial.\n\n#### The Animations\n\nYou should have some basic knowledge about animations and model.cfg as this is not covered here.\n\nThe following class is an example animation that makes the destroyed wheel visible:\n\n```cpp\nclass wheel_1_1_destruct_unhide\n{\n    type = \"hide\";\n    source = \"HitLFWheel\";\n    sourceAddress = \"mirror\";\n    selection = \"wheel_1_1_unhide\";\n    minValue = -1;\n    maxValue = 0;\n    minPhase = -1;\n    maxPhase = 0;\n    hideValue = 0.010000;\n};\n```\n\nThe animation that hides the undestroyed wheel looks like this:\n\n```cpp\nclass wheel_1_1_destruct\n{\n    type = \"hide\";\n    source = \"HitLFWheel\";\n    selection = \"wheel_1_1_hide\";\n    minValue = 0;\n    maxValue = 1;\n    minPhase = 0;\n    maxPhase = 1;\n    hideValue = 0.990000;\n};\n```\n\nMake sure that the sum of the hideValues of two corresponding anims is 1, so the switch happens at the same time.\n\n#### Animation sources\n\nThe animationsource used in the previous section is a custom one which needs to be defined in the config of the vehicle:\n\n```cpp\nclass AnimationSources\n{\n    class HitLFWheel\n    {\n        source = \"Hit\";\n        hitpoint = \"HitLFWheel\";\n        raw = 1;\n    };\n};\n```\n\nThe hitpoint entry refers to the hitpoints defined in the vehicle config, e.g.\n\n```cpp\nclass HitLFWheel\n{\n    armor = 0.15;\n    material = -1;\n    name = \"wheel_1_1_steering\";\n    visual = \"\";\n    passThrough = 0.3;\n};\n```","sections":[{"heading":"The Principle","level":4,"markdown":"The model already contains the destroyed wheels, but they are hidden with animations. These animations uses the damage value of hitpoints to switch the wheels when needed."},{"heading":"Prepare the model","level":4,"markdown":"In the case of wheels it makes sense to create an extra model for a destroyed wheel. This way you are able to implement the destroyed wheels in the original model via proxies which reference to the destroyed wheel model. It doesn't need to be done via proxies though. Now, you just need to create named selections for every wheel and for every destroyed wheel. The normal wheels are called \"wheel_x_x_hide\" and the destroyed ones \"wheel_x_x_unhide\" in this tutorial."},{"heading":"The Animations","level":4,"markdown":"You should have some basic knowledge about animations and model.cfg as this is not covered here.\n\nThe following class is an example animation that makes the destroyed wheel visible:\n\n```cpp\nclass wheel_1_1_destruct_unhide\n{\n    type = \"hide\";\n    source = \"HitLFWheel\";\n    sourceAddress = \"mirror\";\n    selection = \"wheel_1_1_unhide\";\n    minValue = -1;\n    maxValue = 0;\n    minPhase = -1;\n    maxPhase = 0;\n    hideValue = 0.010000;\n};\n```\n\nThe animation that hides the undestroyed wheel looks like this:\n\n```cpp\nclass wheel_1_1_destruct\n{\n    type = \"hide\";\n    source = \"HitLFWheel\";\n    selection = \"wheel_1_1_hide\";\n    minValue = 0;\n    maxValue = 1;\n    minPhase = 0;\n    maxPhase = 1;\n    hideValue = 0.990000;\n};\n```\n\nMake sure that the sum of the hideValues of two corresponding anims is 1, so the switch happens at the same time."},{"heading":"Animation sources","level":4,"markdown":"The animationsource used in the previous section is a custom one which needs to be defined in the config of the vehicle:\n\n```cpp\nclass AnimationSources\n{\n    class HitLFWheel\n    {\n        source = \"Hit\";\n        hitpoint = \"HitLFWheel\";\n        raw = 1;\n    };\n};\n```\n\nThe hitpoint entry refers to the hitpoints defined in the vehicle config, e.g.\n\n```cpp\nclass HitLFWheel\n{\n    armor = 0.15;\n    material = -1;\n    name = \"wheel_1_1_steering\";\n    visual = \"\";\n    passThrough = 0.3;\n};\n```"}],"categories":["ArmA: Armed Assault: Addon Editing","Arma 2: Editing","Arma 3: Editing"],"groups":["Modding"]}