source_offset for projectiles
Posted: Sun Apr 28, 2019 4:26 pm
Hi,
When you're setting up a new turret, you want the projectiles to look like they're coming out of the barrel of the weapon. You can specify two different source_offset parameters in two different places. One (not in the wiki) is in the top level of the turret's attack_parameters and seems to regulate how "high" the turret barrel is, i.e. how far from the centre of the sprite the barrel's centre of rotation is - vanilla turrets all use a negative y offset for this. The second is in the action_delivery bit of the action in the ammo_type used by the turret and seems to regulate how far on the horizontal plane from the "centre" of the turret the projectile starts. Again, it's specified as a negative y vector, and then it appears to be rotated by the game depending on the turret's direction.
Questions:
1. Is there a system for figuring out these values based on the sprites of your turret? I'm just doing it by eye and tweaking values and it's irritating. I've tried calculating the offset in pixels based on the sprite (as if it were a shift parameter) but it doesn't produce consistent results.
2. The isometric view means that movement in the fake Y axis is foreshortened. Does the rotation of the projectile start position account for this automatically? On one of my turrets (a beam turret) it looks like it does, on another it looks like it doesn't (a projectile turret).
3. There are a few entities in the vanilla game that have a massive long table of offsets under headings like attacking_muzzle_animation_shift and projectile_creation_parameters. The flamethrower turret and artillery cannons are examples. What are these? They look like per-direction offsets, which makes me think that the answer to question 2 is "no". How can they be calculated - working out sin and cos values for every direction then squishing them by 1.414 for the isometric squish factor?
When you're setting up a new turret, you want the projectiles to look like they're coming out of the barrel of the weapon. You can specify two different source_offset parameters in two different places. One (not in the wiki) is in the top level of the turret's attack_parameters and seems to regulate how "high" the turret barrel is, i.e. how far from the centre of the sprite the barrel's centre of rotation is - vanilla turrets all use a negative y offset for this. The second is in the action_delivery bit of the action in the ammo_type used by the turret and seems to regulate how far on the horizontal plane from the "centre" of the turret the projectile starts. Again, it's specified as a negative y vector, and then it appears to be rotated by the game depending on the turret's direction.
Questions:
1. Is there a system for figuring out these values based on the sprites of your turret? I'm just doing it by eye and tweaking values and it's irritating. I've tried calculating the offset in pixels based on the sprite (as if it were a shift parameter) but it doesn't produce consistent results.
2. The isometric view means that movement in the fake Y axis is foreshortened. Does the rotation of the projectile start position account for this automatically? On one of my turrets (a beam turret) it looks like it does, on another it looks like it doesn't (a projectile turret).
3. There are a few entities in the vanilla game that have a massive long table of offsets under headings like attacking_muzzle_animation_shift and projectile_creation_parameters. The flamethrower turret and artillery cannons are examples. What are these? They look like per-direction offsets, which makes me think that the answer to question 2 is "no". How can they be calculated - working out sin and cos values for every direction then squishing them by 1.414 for the isometric squish factor?