Hack Request: Explosion Frame of Reference
-
This is something that’s been annoying me for a long, long time.
When a projectile-based weapon has an explosion attached to it, this explosion will always, once spawned, continue along the same vector with the same speed as the weapon had when it collided with its target. This is nonsensical, since obviously it’d be stopped by whatever it hit, so the explosion should instead stay still in space or (even better) follow the target’s trajectory instead.
What I’m asking is for something around this. I’d be quite content with just having explosions from missiles and torpedoes be spawned at a standstill. Having them follow the movement of whatever the missile collided with might not be possible, but would definitely be ideal.
On a similar note, I have also encountered an issue with the entry called “separation_explosion” in Gun blocks. For some reason, those appear to be (feel free to correct me if I’m wrong) always spawned in the middle of the ship or station that has the weapon mounted, instead of more logically spawning in the middle of the actual weapon’s archetype (everything I’ve tried always caused the explosion to be hidden inside the model). If this indeed is not something that can be fixed through INIs, then a hack for this would be most appreciated.
-
Sounds like you need to find a way to attach the effect to the target somehow as opposed to the projectile. You know me, I’m clueless about how most things work, but that’s the thought that comes into my head. Can you find a way to have different hull hit effects based on the weapon that hits it?
-
That would quickly become inefficient, I think. Currently, hull hits are only dependent on damage dealt.
-
You would know, I’m just thinking out loud. How many different ways can you effect an explosion. Can you scatter debris and attach the explosion effect to a piece or pieces of it? If somethings moving in multiple directions it might distract from the fact that it’s continuing along it’s original path. Again inefficient though pretty no doubt.
Alternatively generate a single piece of debris during impact and use some kind of negative impulse if necessary to stop the debris moving forwards? I’m guessing you’re going to have to attach it to something other than the original projectile to pull it off that’s all.
-
FriendlyFire wrote:
This is something that’s been annoying me for a long, long time.When a projectile-based weapon has an explosion attached to it, this explosion will always, once spawned, continue along the same vector with the same speed as the weapon had when it collided with its target. This is nonsensical, since obviously it’d be stopped by whatever it hit, so the explosion should instead stay still in space or (even better) follow the target’s trajectory instead.
What I’m asking is for something around this. I’d be quite content with just having explosions from missiles and torpedoes be spawned at a standstill. Having them follow the movement of whatever the missile collided with might not be possible, but would definitely be ideal.
Well I don’t know how you Freeworlds folks do it, but back in my day what you’re asking for was accomplished by parenting/unparenting the emitters to the effect object. Considering what I’ve seen you do with effects this seems like something that you would have already tried or be aware of. In case you aren’t, and for anyone else interested, I’ll elaborate.
One of my biggest beefs with the vanilla missile hit effects is that they maintain the momentum of the projectile that spawned them. By their very nature, effects objects maintain the momentum of whatever emitted them. This is why when the vanilla missile effect hits something, the explosion sails through the target. You can get around this by unparenting the emitters from the effects object. (Setting their parent to NULL.) I’ve done this with many of my effects so that when an explosion happens it doesn’t sail through the target.
What doing that does, is make the emitter’s location work in absolute space coordinates rather than relative to the emitter object.
On a related note, the same applies to parenting or unparenting particles from their emitters. When parented to their emitters, a particle will use coordinates that are relative to the emitter. The particles don’t care what the emitter is doing in space, they’ll stay locked to the local coordinates relative to the emitter. Conversely, unparenting the particles from their emitter will create particles that act in absolute coordinates, meaning that they don’t care what the emitter does after it has emitted the particles, only the very initial location the emitter was when that particle was created.
-
Is there a way to add the emitters speed while emitting the particle to a unparented particle, so that burning effects for example do only leave trails while accelerating or turning the ship which would be more logical?