ShipController
is a SceneComponent
that manages other (child) ship SceneComponents
such as ShipEngine
and ShipRudder
.
Ship Controller requires following binding to be set up under Project Settings ⇒ Input:
ShipController
is intended to be used together with WaterObject
, but this is not required.
Typical hierarchy would be:
AShipController
] - ship controller pawn class.UStaticMeshComponent
] - a ship hull.UWaterObject
] - for simulating the ship hull/water interaction.UShipRudder
] - hadles rotation of the rudder with input.UWaterObject
] - for simulating the rudder/water interaction. UShipEngine
] - manages thrust, sound and propeller animation.UStaticMeshComponent
][optional] - visual propeller rotation only, not used for simulation. It would be possible to use a WaterObject
as a propeller, but not as flexible as a simple AddForce approach.UAudioComponent
][optional] - engine audio that gets modified through volume and pitch.UStaticMeshComponent
][optional]UWaterObject
][optional]WaterObject
s …A few notes:
AShipController
should be placed as a root as it is a pawn class.UShipRudder
and UShipEngine
is optional. UShipEngine
to UShipRudder
as the direction and position of the thrust of the UShipEngine
is equal to its transform position and forward direction.A simple ship controller script containing no optional fields.
Rotates the child objects around its transform position.
Handles engine thrust, sound, and propeller rotation. The latter two are optional.
UPrimitiveComponent
.Is On
field.UAudioComponent
as a child of UShipEngine
and assign a looping audio file. Sound settings can be adjusted through the Sound section in the Details panel.UStaticMeshComponent
representing the propeller as a child of UShipEngine
. Propeller RPM Ratio
.