Updated the
test assets. NB: the texturing / lighting / material is foobar'd on the turret model.
What this does is add some extra info to the ship definition which defines a table of data saying which: tag to attach to '
tag_turret_0', the model to attach '
simple_turret', and the equipment to give it '
PULSECANNON_1MW':
Code: Select all
turrets =
{
{ 'tag_turret_0', 'simple_turret', 'PULSECANNON_1MW' },
{ 'tag_turret_1', 'simple_turret', 'PULSECANNON_1MW' },
{ 'tag_turret_2', 'simple_turret', 'PULSECANNON_1MW' },
{ 'tag_turret_3', 'simple_turret', 'PULSECANNON_1MW' },
},
I can't really think of a simpler way of doing it than that right now.
This version, which I'm currently writing the initial PR for, is only about adding visual turrets.
What I mean by this is that you can create a turret and give it a "
.model" file, then you can add those tag points named "
tag_turret_#", and when the game loads your ship it will also load the turret model and stick them together.
There is no other functionality, they do not fire, spin, aim, anything - which is what I mean by visual turrets.
There is some code in there which gets setup but then the update is disabled, this code was originally written by jaj22 for an older attempt to implement turrets like in Frontier with no actual model to animate. However a lot of the logic seems sound and I reckon it should be adaptable to our needs so I've gone to the effort of setting up most of the data it needs.
Orientation:
Tags have the following orientation
+X is left
+Y is upwards
+Z is forwards
Z & Y are the ones to focus on, they are the direction the barrel should be pointing in when the model loads (+Z), and which way UP it is (+Y).
The turrets themselves come in 3 parts, a base "turret_base", a head "turret_head", and a tag called "tag_weapon_emit".
The base and head are separate meshes: you place the base centred at (0, 0, 0) in your scene in the 3D editor and then you move the whole head mesh - NOT it's geometry but the mesh itself - upwards so that it's pivot point / origin is directly above the base and (0, 0, 0).
Look at the
test assets to make sure you're getting these correct because fixing it up later will be a pain in the arse!