Skip to content

FireBullet3D #1977

@pokeunite

Description

@pokeunite

Changes

This creates a massive overhaul of the FireBullet3D system to make it production-ready for FPS/TPS games.

Major Bug Fixes & Stability:

  • Fixed Aim Drift: Replaced simple screen-center logic with "Screen-Space to World-Space" coordinate conversion. The extension now calculates Normalized Device Coordinates (NDC) based on the specific UI Layer dimensions, ensuring the gun shoots exactly where the crosshair is, regardless of window resolution or aspect ratio.
  • Fixed Time Scaling: Replaced Date.now() with runtimeScene.getTimeManager().getTimeFromStart(). Weapon cooldowns and reload timers now correctly respect the game's Time Scale and Pause state.
  • Fixed Physics 2.0 Crashes: Implemented "Duck Typing" checks for physics actions. The extension now detects if the target bullet/shell uses Physics 2.0 (Box2D) or Physics 3.0 and avoids calling setLinearVelocityZ on 2D objects, preventing runtime crashes.

How to use the new features

  1. Gravity Scale: In the Behavior Properties, set "Bullet Gravity Scale". Set to 0 for straight-flying rockets/lasers, or 1.0 for standard physics drop.
  2. Crosshair Aiming: When using "Spawn Bullet" or "Shoot Hitscan Ray", drag your UI Crosshair sprite into the "The_Crosshair" parameter. The extension will automatically calculate the 3D depth ray from that 2D icon.
  3. Shell Ejection: Use the "Spawn Shell Casing" action immediately after shooting.
    • Shell Object: Needs a Physics 2.0 or 3.0 behavior.
    • Offset Y: Controls how far to the right/left of the gun the shell appears.
    • Force Side/Up: Controls the ejection power.

Checklist

  • I've followed all of the best practices.
  • I confirm that this extension can be integrated to this GitHub repository, distributed and MIT licensed.
  • I am aware that the extension may be updated by anyone, and do not need my explicit consent to do so.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions