Quick Fix for the Firing functions
FireTurrets (after ForEach it’s the same as it was)
Open the created project and migrate BPShip to your desired project. Additionally you can migrate the test BPBox.
Project Settings Axis Mappings
Axis for Linear Movement are MoveForward, MoveRight and MoveUp
Axis for Rotation Movement are RollRight, PitchUp, YawRight
MouseRight and MouseUp are for the MouseLook function
Default Key events
Left Mouse Button – hold to fire turrets
Right Mouse Button – Targets another BPShip (for possession, turret convergence and autofire)
J – Shows debug forces and target reticle
P – Toggles Power
L – Possesses Target Ship
V – Toggles Autofire (needs Target first)
1 – Sets autopilot destination where the mouse is pointing
2 – toggles repair function
Turret types can be changed with the public Rank variable instead of extending child blueprints. The InitWeapon function can change its mesh, material, projectile particle and variables.
The ship has a dynamic material set up with 4 vector parameters: R: StructureColor G: ArmorColor B: ModuleColor A: EmissiveColor and EmissivePower scalar parameter.
When making a child blueprint of BPShip, add as many engines, retro-engines and turrets as desired. Engines have to be particle systems with tag engine and retro-engines are tagged retroengine. They don’t influence the physics model but will light up when their input is fired.
Turrets are Arrow Components with tag turret. The turret actor will be automatically attached with these arrows’ orientation, X forward Z up
The autopilot functions are AutoMove and AutoRotate which generate input between -1 and 1 to the desired location and rotation. The strength of these functions is given by kProjectedVel, kPRot and kDRot. If the ship’s mass changes, these may need tweaking.
kProjectedVel (def 0.7) will tweak the AutoMove function. lower values will keep the thrusters on for longer and will reach the destination faster, although it may oscillate if this value is too low.
kPRot (def 1.0) tweaks the generation of input towards the desired rotation, higher values will turn the ship faster but will generate oscillations
kDRot (def 0.7) tweaks the smoothing of oscillations, higher values will produce a smoother input, but too high and the ship may never reach its intended rotation.