mirror of
https://github.com/creazy231/cs2-css-flashlight.git
synced 2026-09-27 20:17:04 +02:00
🔦 Fix flashlight beam not tracking view pitch
The light was positioned once at toggle time and then handed to the engine via SetParent + SetParentAttachmentMaintainOffset on the pawn's `axis_of_intent` attachment. That attachment carries the body's yaw but not the view pitch, so once parented the beam could only ever rotate horizontally — looking up or down did nothing. Drop the parenting and drive the light's transform ourselves every tick from the pawn's live AbsOrigin and V_angle, which is how the plugin behaved before 0.1.1 replaced the per-tick teleport with a parented entity. Also: - OnTick no longer short-circuits on !AllowUseKey, which otherwise stopped the light updating for servers that only expose css_fl_toggle. - ForwardDistance now offsets the light horizontally only. Applying it along the pitched forward vector put the light below ground when looking straight down (crouched eye height 46 minus 54). - Sweep up the light when the pawn is dead; an un-parented entity no longer dies with its pawn. - Remove the now-unused AttachmentName config key. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
b3bbc2dc9a
commit
b43f9fdea3
5 changed files with 217 additions and 48 deletions
|
|
@ -71,9 +71,6 @@ public class FlashlightConfig : BasePluginConfig
|
|||
[JsonPropertyName("CrouchEyeOffsetZ")]
|
||||
public float CrouchEyeOffsetZ { get; set; } = 46f;
|
||||
|
||||
[JsonPropertyName("AttachmentName")]
|
||||
public string AttachmentName { get; set; } = "axis_of_intent";
|
||||
|
||||
[JsonPropertyName("LightCookie")]
|
||||
public string LightCookie { get; set; } = "materials/effects/lightcookies/flashlight.vtex";
|
||||
|
||||
|
|
@ -94,11 +91,6 @@ public class FlashlightConfig : BasePluginConfig
|
|||
StandEyeOffsetZ = Math.Max(0f, StandEyeOffsetZ);
|
||||
CrouchEyeOffsetZ = Math.Max(0f, CrouchEyeOffsetZ);
|
||||
|
||||
if (string.IsNullOrWhiteSpace(AttachmentName))
|
||||
{
|
||||
AttachmentName = "axis_of_intent";
|
||||
}
|
||||
|
||||
if (string.IsNullOrWhiteSpace(LightCookie))
|
||||
{
|
||||
LightCookie = "materials/effects/lightcookies/flashlight.vtex";
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue