Skip to content

Conversation

@githubawn
Copy link

Particle Cannon "Short Beam" Fix Walkthrough
Goal
Fix the visual bug where the Particle Uplink Cannon's laser beam appeared cut off or "floating" mid-air when viewed from a distance or on high-elevation maps, rather than striking from orbit.

Changes
We modified ParticleUplinkCannonUpdate.cpp to increase the orbital origin height of the beam.

ParticleUplinkCannonUpdate.cpp
Increased Height: Changed the vertical offset from 500.0f to 5000.0f in three key locations:
update()
createGroundToOrbitLaser()
createOrbitToTargetLaser()

Introduced Named Constant: Defined ORBITAL_BEAM_Z_OFFSET to replace the magic number.
const Real ORBITAL_BEAM_Z_OFFSET = 5000.0f;

These changes ensure the beam's origin point is high enough even when zoomed out or on high maps, maintaining the illusion of an orbital strike.

@greptile-apps
Copy link

greptile-apps bot commented Jan 29, 2026

Greptile Overview

Greptile Summary

Fixed visual bug where the Particle Uplink Cannon's orbital laser beam appeared cut off or floating mid-air when viewed from distance or on high-elevation maps by increasing the orbital origin height from 500.0f to 5000.0f.

Key Changes:

  • Introduced named constant ORBITAL_BEAM_Z_OFFSET = 5000.0f to replace magic numbers
  • Updated three locations where the orbital beam Z position is calculated: update() (line 631), createGroundToOrbitLaser() (line 1009), and createOrbitToTargetLaser() (line 1048)
  • The fix maintains the visual illusion of an orbital strike by ensuring the beam origin is high enough to remain visible at all camera distances and elevations

Confidence Score: 5/5

  • This PR is safe to merge with no identified issues
  • The change is minimal, well-documented, and addresses a specific visual bug. The fix replaces a magic number with a named constant (good practice) and consistently updates all three locations where the orbital beam height is calculated. No logical issues or breaking changes detected.
  • No files require special attention

Important Files Changed

Filename Overview
GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/ParticleUplinkCannonUpdate.cpp Increased orbital beam Z offset from 500.0f to 5000.0f and replaced magic numbers with named constant ORBITAL_BEAM_Z_OFFSET

Sequence Diagram

sequenceDiagram
    participant Update as ParticleUplinkCannonUpdate::update()
    participant CreateGroundToOrbit as createGroundToOrbitLaser()
    participant CreateOrbitToTarget as createOrbitToTargetLaser()
    participant LaserUpdate as LaserUpdate
    
    Note over Update: Particle Cannon fires
    Update->>Update: Calculate m_currentTargetPosition (ground)
    Update->>Update: Set orbitPosition.z = m_currentTargetPosition.z + ORBITAL_BEAM_Z_OFFSET
    Update->>LaserUpdate: initLaser(orbitPosition, m_currentTargetPosition)
    Note over LaserUpdate: Beam drawn from orbit (5000.0f above target) to ground
    
    Note over CreateGroundToOrbit: Ground-to-orbit laser
    CreateGroundToOrbit->>CreateGroundToOrbit: Set orbitPosition.z = m_laserOriginPosition.z + ORBITAL_BEAM_Z_OFFSET
    CreateGroundToOrbit->>LaserUpdate: initLaser(m_laserOriginPosition, orbitPosition)
    Note over LaserUpdate: Beam drawn from building to orbit (5000.0f above)
    
    Note over CreateOrbitToTarget: Orbit-to-target laser
    CreateOrbitToTarget->>CreateOrbitToTarget: Set orbitPosition.z = m_initialTargetPosition.z + ORBITAL_BEAM_Z_OFFSET
    CreateOrbitToTarget->>LaserUpdate: initLaser(orbitPosition, m_initialTargetPosition)
    Note over LaserUpdate: Beam drawn from orbit (5000.0f above) to target
Loading

Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 file reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

#include "GameLogic/Module/ActiveBody.h"


const Real ORBITAL_BEAM_Z_OFFSET = 5000.0f; // TheSuperHackers @fix Mirelle 30/01/2026: Raised from 500.0f
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider moving ORBITAL_BEAM_Z_OFFSET to the header file ParticleUplinkCannonUpdate.h per coding standards for code-level constants.

Context Used: Rule from dashboard - Prefer defining code-level constants (math constants, feature macros, etc.) in header files rather t... (source)

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

Prompt To Fix With AI
This is a comment left during a code review.
Path: GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/ParticleUplinkCannonUpdate.cpp
Line: 62:62

Comment:
Consider moving `ORBITAL_BEAM_Z_OFFSET` to the header file `ParticleUplinkCannonUpdate.h` per coding standards for code-level constants.

**Context Used:** Rule from `dashboard` - Prefer defining code-level constants (math constants, feature macros, etc.) in header files rather t... ([source](https://app.greptile.com/review/custom-context?memory=9aca79ba-17d4-4c71-918f-10816f7fc751))

<sub>Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!</sub>

How can I resolve this? If you propose a fix, please make it concise.

@AlseeAns
Copy link

yes please : D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants