Doors
Introduction
This page will teach you how to add functional doors with physics to vehicles.
Warning
Doors may sometimes have synchronization issues, especially in multiplayer, which will be improved in future versions of DynamX ;)
Info
Support for doors on blocks and props is planned and will arrive later.
Prerequisites
You must have configured a vehicle.
Danger
This version of the tutorial only works with DynamX versions 4.0.0 and later.
Model Preparation
In your 3D model, separate each door into a separate object and export the model with the doors at the origin (point 0 0 0) of the model, just like the steering wheel, for example.
Note that only doors with rotation are supported; you cannot create a door that follows a translation (like the door of a van, for example).
Configuration
Here is an example configuration for a door:
leftfrontdoor{
Position: 1.0403 -0.2035 0.8
Scale: 0.102 0.509 0.436
LocalCarAttachPoint: 1.1038 -0.95709 0.93769
LocalDoorAttachPoint: 0 -0.78 0
OpenedDoorAngleLimit: 0 0.78
ClosedDoorAngleLimit: 0 0
DoorOpenForce: 1 200
DoorCloseForce: -1.5 300
}
And here is an explanation of each of the properties:
Required Properties
Name | Type | Description | Example |
---|---|---|---|
LocalCarAttachPoint | Vector in Blender format (X, Z, Y*-1) | Door attachment point relative to the origin of the car object. | - |
LocalDoorAttachPoint | Vector in Blender format (X, Z, Y*-1) | Door attachment point relative to the origin of the door object, corresponding to the previous point. | - |
PartName | String (can be used for naming or describing) | Name of the door object in your model. | - |
Position | Vector in Blender format (X, Z, Y*-1) | Object Position | - |
Optional Properties
Name | Type | Description | Default Value |
---|---|---|---|
AttachStrength | Integer | Door attachment strength (determines the force applied before the door breaks). (Not used for now). | 400 |
AutoMountDelay | Very short integer (range of -128 to +127) | Delay before the player is automatically mounted on the seat linked to the car (right-click directly on the door). | 40 |
Axis | Physical axis (X , Y , Z , X_ROT , Y_ROT , Z_ROT ) |
Door rotation axis. | Y_ROT |
ClosedDoorAngleLimit | Vector with 2 axes (X, Y) | Minimum Limit, Maximum Limit (Door closing angle). | 0 0 |
DependsOn | String (can be used for naming or describing) | Unused | - |
DoorCloseForce | Vector with 2 axes (X, Y) | Velocity (closing action speed), Maximum Force (door closing). | -1.5 300 |
DoorCloseTime | Very short integer (range of -128 to +127) | Currently not used. | 25 |
DoorOpenForce | Vector with 2 axes (X, Y) | Velocity (opening action speed), Maximum Force (door opening). | 1 200 |
Enabled | Value that can either enable (True) or disable (False) a property | Enables the physical door system. If you set it to false, the door will only be drawn but won't open. | true |
OpenedDoorAngleLimit | Vector with 2 axes (X, Y) | Minimum Limit, Maximum Limit (Door opening angle). | 0 0 |
Scale | Vector with inverted Y and Z axes (X, Z, Y) | Object Size | 1 1 1 |
To help you configure them, you can use the 'Door attach points' debug option: { width="90%" }
Conclusion
You can now add doors to DynamX vehicles! If you encounter difficulties or find this tutorial unclear, you can seek help on the DynamX Discord.