public void ApplyKickback(FixedUpdateEvent evt, KickbackNode weapon, [JoinByTank] TankNode tank)
        {
            KickbackComponent   kickback = weapon.kickback;
            MuzzleLogicAccessor accessor = new MuzzleLogicAccessor(weapon.muzzlePoint, weapon.weaponInstance);
            float deltaTime = evt.DeltaTime;

            VulcanPhysicsUtils.ApplyVulcanForce(((-accessor.GetFireDirectionWorld() * kickback.KickbackForce) * WeaponConstants.WEAPON_FORCE_MULTIPLIER) * deltaTime, tank.rigidbody.Rigidbody, accessor.GetWorldMiddlePosition(), tank.tankFalling, tank.track);
        }
Example #2
0
        public void StartKickback(BaseShotEvent evt, KickbackNode weapon, [JoinByTank] TankNode tank)
        {
            KickbackComponent   kickback      = weapon.kickback;
            MuzzleLogicAccessor accessor      = new MuzzleLogicAccessor(weapon.muzzlePoint, weapon.weaponInstance);
            Vector3             vector        = -accessor.GetFireDirectionWorld() * kickback.KickbackForce;
            Vector3             worldPosition = accessor.GetWorldPosition();

            tank.rigidbody.Rigidbody.AddForceAtPositionSafe(vector * WeaponConstants.WEAPON_FORCE_MULTIPLIER, worldPosition);
        }