class ShootOnInteract

Exported Variables

NameTypeDescription
rootObjectNodeNodeThe root object node of this grabbable object
bulletSpeedfloatHow fast the bullet travels. Only used in calculating how much force is applied to objects that are shot
bulletMassfloatThe mass of the bullet. Only used in calculating how much force is applied to objects that are shot
rangefloatThe range of the gun
bulletImpactParticlesPackedSceneThe GpuParticles3D node that is spawned when an object (static or dynamic) is shot
showCrosshairboolWhether or not to show a crosshair on the screen for this gun
crosshairScenePackedSceneThe scene of the crosshair that is shown on the screen for this gun (provided showCrosshair is true)

Public Functions

void SetScreenSightVisibility(bool isVisible)

Subscribed to the IsGrabbedTracker “IsGrabbedTrackerUpdated” signal. If the provided bool is true (and showCrosshair is true), the crosshair for this gun is shown on screen, if false, the crosshair is hidden

void SubscribeOrUnsubscribeToPlayerRequestInteractOnIsGrabbedTrackerUpdate(bool grabState)

When the IsGrabbedTrackerUpdated signal fires, if the provided bool is true, subscribe OnPlayerRequestInteract to the custom PlayerRequestedToInteractWithGrabbedObjectEvent event bus, and unsubscribe if it is false.

void OnPlayerRequestInteract(PlayerRequestedToInteractWithGrabbedObjectEvent eventData)

Apply force to the object that gets shot, and tell ParticleManager to spawn the provided impact particles