Projectile Range and lifespan

TosanuTosanu Member, PRO Posts: 388

I am attempting to make a weapon for a game where the ammunition will fly a fixed distance before despawning. So far, I've been tweaking velocity and a timer to destroy, but i am unsatisfied with this, as it leaves a lot to be desired for precision and requires a lot of trial and error.

I thought of having a condition in which the projectile tracks its X position compared to the player's position, (an game attribute constrained for multiple purposes) but that means the player could theoretically run after the shot and keep it traveling further than desired. If I can make this work, I can use it to adjust more than one weapon for this game. I want the shot to only travel a specific length from its own point of origin, but I cant just check position against itself. Should i, say, create an attribute that grabs its spawn X position, or would that not work due to it moving from the start? I definitely think I'm close with this, just missing something specific....

Comments

  • jamie_cjamie_c ImagineLabs.rocks Member, PRO Posts: 5,772

    I would record the projectiles starting X position and use that to measure the lifespan from, not the players X position.

  • TosanuTosanu Member, PRO Posts: 388

    So that will grab it when it first spawns with a basic Change Attribute command? It wont be affected by the projectile being spawned in motion?

  • StormyStudioStormyStudio United KingdomMember Posts: 3,989

    that'll work..

  • jamie_cjamie_c ImagineLabs.rocks Member, PRO Posts: 5,772
    edited April 2014

    yep, like @StormyStudio says, should work fine.

  • TosanuTosanu Member, PRO Posts: 388

    Cool, thanks.

Sign In or Register to comment.