Author Topic: Knockback on a weapon?  (Read 909 times)

How do i make it so a weapon will knockback a player?

There are impactImpulse and verticalImpulse fields on the projectile datablock, I think it should apply those automatically without manually telling projectile::onCollision to do so

Or you could use addVelocity and have an ::onFire function

Or you could use addVelocity and have an ::onFire function
I didn't think of this until you said this:
OP, do you want the weapon to knock back the player who shoots it, or to knock back the player hit by the projectile?

Don't do it the way sgt walter did it because that SUCKS ASS.
You dont randomly look somewhere else for no reason after shooting a pistol do you?!

Don't do it the way sgt walter did it because that SUCKS ASS.
You dont randomly look somewhere else for no reason after shooting a pistol do you?!
But the point you aim at does, and that's always where you're looking in blockland.

use addVelocity and have an ::onFire function

Knockback the player who was hit by the projectile.

Knockback the player who was hit by the projectile.
Parent yourProjectile::onCollision, then get the velocity of the projectile, scale the vector down appropriately, and add the new velocity to the player that got hit