๐Ÿ‘‹
Auto Hand Docs
  • ๐Ÿ™ŒAuto Hand
    • โ€ผ๏ธAuto Hand V4 What's-New
    • โšกSetup
    • ๐Ÿ—’๏ธFAQ
    • โ‰๏ธCommon Issues
    • ๐ŸงคSetup New Hand
    • ๐ŸŽฎController Input
      • โœŠHand Input
      • ๐ŸคŸHand Tracking Input
      • โœŒ๏ธFinger Pose Input
      • ๐ŸƒPlayer Input
      • ๐Ÿ—’๏ธGeneral Input / UI Pointer Input
      • ๐Ÿ‘ˆDistance Grabber Input
      • โšกTeleport Input
      • ๐ŸŽAdditional Input
    • ๐Ÿ–๏ธHand
      • ๐Ÿ”ฆGrabbable Highlighter
      • ๐Ÿ‘‹Hand Follow
      • ๐ŸซณHand Animator
      • โ˜๏ธFinger Component
      • ๐ŸงคHand Projector
    • ๐Ÿ––Hand Tracking
      • ๐Ÿ‘ŒHand Tracking Finger Gesture Tracking
      • ๐Ÿ‘ˆHand Tracking Pose Gesture Tracking
    • โœ๏ธCustom Poses
      • ๐ŸฆพHand Pose Data
      • โœ‚๏ธAnimated Held Poses
    • ๐Ÿ…Grabbable
      • ๐ŸงฒDistance Grabbing
    • ๐ŸงบPlace Point
    • ๐Ÿ“คDispenser Point
    • ๐Ÿ›ธTeleportation
    • ๐Ÿ‘ŸAuto Hand Player
    • ๐ŸงFull Body (VRIK)
    • โš’๏ธExtras
      • ๐Ÿ”ซAuto Gun
        • ๐Ÿ’˜Auto Ammo
        • ๐ŸŽฏAuto Gun Target
      • โš™๏ธGrabbable Held Joint
      • ๐ŸŽ›๏ธPhysics Gadgets
        • ๐Ÿ”˜Physics Gadget Button
        • ๐ŸŽš๏ธPhysics Gadget Slider
        • ๐ŸŽ›๏ธPhysics Gadget Lever
      • ๐Ÿ“UI Interaction
      • ๐Ÿ“ฑHand Touch / Trigger
      • ๐Ÿ”จSmashing
      • ๐Ÿ”ชStabbing
      • ๐ŸŽฏStickies
      • ๐ŸงฒMagnetic Forces
      • ๐Ÿ“ขCollision Sounds
      • โŒšWrist Look Event
Powered by GitBook
On this page
  1. Auto Hand
  2. Extras
  3. Auto Gun

Auto Gun Target

PreviousAuto AmmoNextGrabbable Held Joint

Last updated 1 year ago

Auto Gun Target

This component can be used to trigger extra events when being shot by an Auto Gun including spawning, playing, and pooling, hit particles or use the On Shot unity event to create more custom result on hit. Must be attached to a target's rigidbody to work properly

This component is not required to trigger the gun's On Hit event.

GameObject Hit Decal

  • Use Case: This variable holds a reference to the GameObject that represents the decal (like a mark or a bullet hole) to be instantiated when a shot hits a target. The hitDecal is visually displayed at the point of impact.

ParticleSystem Hit Particle;

  • Use Case: This variable is used to reference a Particle System that should be triggered when a shot hits a target. It's typically used to create visual effects like sparks, smoke, or fragments at the impact location to enhance visual feedback.

float Hit Decal Lifetime;

  • Use Case: This float value determines the lifetime of the hit decals. It specifies how long (in seconds) the decals should remain visible in the scene after being created. Once this time elapses, the decal is either destroyed or recycled (depending on implementation).

UnityGunHitEvent OnShotEvent;

  • Use Case: Invoked when a shot occurs, allowing other components or systems in the game (like score managers, sound effects, or game logic) to respond to the shooting event. The event passes along information about the gun that fired and the RaycastHit details.

Here is an example of a script that uses the AutoGunTarget events

public class AutoGunTargetHandler : MonoBehaviour {
    public AutoGunTarget autoGunTarget;

    private void OnEnable() {
        if (autoGunTarget != null) {
            autoGunTarget.OnShotEvent += HandleOnShotEvent;
        }
    }

    private void OnDisable() {
        if (autoGunTarget != null) {
            autoGunTarget.OnShotEvent -= HandleOnShotEvent;
        }
    }

    private void HandleOnShotEvent(AutoGun gun, RaycastHit hit) {
        // This function will be called when the OnShotEvent is invoked.
        // Currently, it's empty and can be filled with custom behavior.
    }
}

๐Ÿ™Œ
โš’๏ธ
๐Ÿ”ซ
๐ŸŽฏ