Pack Making JSON CollisionGroups - DonBruce64/MinecraftTransportSimulator GitHub Wiki
CollisionGroups is a group of collision boxes, each box with it's own parameters. Useful for grouping a set of boxes, for example, having one group for one door, and another for the other door.
CollisionGroups Parameters
Each collisionGroup contains the following parameters
- health - How much health this collision group has. When the health reaches 0, this collision group will be disabled. Useful for armor that can only take so many hits, or parts of models that you want to break off when hit. If this value is 0, then the collision group will always be present, and damage inflicted will be charged to the entity rather than this collision group.
- armorThickness – How much armor this collision box has. If a bullet hits a box with an armor thickness greater than its penetration, then the bullet will be stopped and register a collision. Note that bullets loose penetration over distance, so this is only valid for point-blank range.
- heatArmorThickness – Like normal armor thickness, but used only if a bullet is a HEAT bullet.
- damageMultiplier - How much to multiply the damage for bullets that hit this hitbox by. Is 1.0 if not specified.
- collisionTypes - The types of collision for this group. The valid types are:
- block - Allows collision with blocks.
- entity - Allows entities to collide with this box.
- vehicle - Allows vehicle wheels to ride on boxes in this group.
- attack - Allows attacking from damage sources. This includes bullets.
- bullet - Allows bullet interaction, but not general attacks.
- click - Allows clicking.
- effector - Allows effector logic.
- collisions - A list of Collision Boxes
- applyAfter - If this is set, then this collision group will first use the animations for this object from the rendering section instead of the animations in this one. If the specified object has applyAfter on it itself, then the animations will be gotten recursively until an applyAfter is not found.
- animations - An optional list of animations to modify the collision boxes. Translations and Rotations work as expected. Visibility completely disables the collisionGroup if the variable is false or 0.
Collisions
The collisions parameter is simply a list of boxes that MTS uses to determine the collision points of models. For most cases you can get away with less than a dozen of these, but for larger planes and vehicles with complex shapes you may need to separate them into different groups for better performance.
- pos – An entry of x, y, and z coordinates that define the center point of where this collision box is relative to the center of the vehicle.
- width – The width of this collision box, in meters. Note that since the pos parameter is the center of the box the box will actually extend ½ the width in the X and Z direction.
- height – Same as width, just for the Y direction.
- collidesWithLiquids – If true, the collision box will behave like a ground device set to float. Note that if you make a boat that uses only these boxes, you'll need one for every corner like you would wheels on a car. Failing to do so will result in your boat doing a Titanic, just without an iceberg.
- action - The action to perform when clicking this hitbox, if any. Note that if the action-variable contains "door" in the name, then special logic will be performed to turn the variable off when the vehicle starts moving. Essentially, an auto-close functionality for the door.