Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FR: add 'target velocity x lifetime' funtion to +end position options of Type 5 beams. (Slash End Position Leads Target) #6476

Open
DefCynodont opened this issue Dec 19, 2024 · 0 comments

Comments

@DefCynodont
Copy link

The idea is that the slashing beam loosely tracks moving targets by having the end of the slash be where the target will be according to the target's motion at the time it starts firing. Allowing for example: Low damage anti-fighter beams that stay on moving targets but can still be avoided by turning or accelerating/decelerating after the beam starts firing - Beams that follow fast moving and/or small capital ships - Beams that directly fire on gliding ships and stay on as if said ship was not moving - more interesting anti-fighter beam possibilities overall - ect.

This would be done by adding each of the target ship's velocity vectors individually multiplied by the beam's lifetime to the +End Position coordinates.

Here is an example of the math using the fire-beam-at-coordinates SEXP:

     "Attacking Ship" 
     "Beam Turret" 
     ( get-object-x "Target Ship" ) 
     ( get-object-y "Target Ship" ) 
     ( get-object-z "Target Ship" ) 
     ( true ) 
     ( + 
        ( get-object-x "Target Ship" ) 
        ( * 
           3            ;; In this example, the beam has a lifetime of 3 seconds
           ( get-object-speed-x 
              "Target Ship" 
              ( false ) 
           )
        )
        ( * 
           -1  ;; this is to subtract the parent ship's speed this may not be needed
           ( get-object-speed-x 
              "Attacking Ship" 
              ( false ) 
           )
        )
     )
     ( + 
        ( get-object-y "Target Ship" ) 
        ( * 
           3             ;; In this example, the beam has a lifetime of 3 seconds
           ( get-object-speed-y 
              "Target Ship" 
              ( false ) 
           )
        )
        ( * 
           -1  ;; this is to subtract the parent ship's speed
           ( get-object-speed-y 
              "Attacking Ship" 
              ( false ) 
           )
        )
     )
     ( + 
        ( get-object-z "Target Ship" ) 
        ( * 
           3             ;; In this example, the beam has a lifetime of 3 seconds
           ( get-object-speed-z 
              "Target Ship" 
              ( false ) 
           )
        )
        ( * 
           -1  ;; this is to subtract the parent ship's speed
           ( get-object-speed-z 
              "Attacking Ship" 
              ( false ) 
           )
        )
     )
  )
)

As a feature, the table entry would look something like this:

+Move End Position by target velocity: LIFETIME with an option for a float for tracing ahead or behind targets, this would be ideally be determined before any offsets. Note that it's perfectly fine if Lifetime is the only option.
A +Move End Position by target velocity x lifetime: YES would be just as good.
It could also have a better name, such as "Slash End Position Leads Target"
Another nice option would be to allow for whether the parent ship's velocity is added, subtracted, or ignored.

I would greatly appreciate anyone looking into this. Please and Thank You.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant