Skip to content

feat: Add raycasting from players perspective.#786

Open
Saskyc wants to merge 3 commits intoExMod-Team:masterfrom
Saskyc:raycast-for-player
Open

feat: Add raycasting from players perspective.#786
Saskyc wants to merge 3 commits intoExMod-Team:masterfrom
Saskyc:raycast-for-player

Conversation

@Saskyc
Copy link

@Saskyc Saskyc commented Mar 26, 2026

… or anything in layer mask.

Description

Describe the changes
Adds new method to raycast from players CameraTransform.
Either for anything with layermask or for player & hitbox with predefined layermasks.

What is the current behavior? (You can also link to an open issue here)

What is the new behavior? (if this is a feature change)

Does this PR introduce a breaking change? (What changes might users need to make in their application due to this PR?)
None.

Other information:


Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentations

Submission checklist

  • I have checked the project can be compiled
  • I have tested my changes and it worked as expected

Patches (if there are any changes related to Harmony patches)

  • I have checked no IL patching errors in the console

Other

  • Still requires more testing

Copy link

@Mr-Baguetter Mr-Baguetter left a comment

Choose a reason for hiding this comment

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

Looks good to me.
I dont see any obvious issues.

Comment on lines +4012 to +4019
/// <summary>
/// Gets the player currently looking at if any.
/// </summary>
/// <param name="maxDistance">The max distance the raycast can reach.</param>
/// <returns><see cref="Player"/> if any.</returns>
public Player GetRaycastedPlayer(float maxDistance) =>
Get(GetRaycast(maxDistance, LayerMasks.Player)?.collider);

Choose a reason for hiding this comment

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

you need to get the Player from HitBox

Copy link
Author

Choose a reason for hiding this comment

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

Will be done thank you for bringing this up.

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants