Closed PolSpock closed 9 months ago
Hello,
In a FPS context, i'm trying to shoot from my localplayer EyePosition to Forward with SceneTrace.Ray()
However with UseHitboxes(), i always get my localplayer Hitboxes even if i add some Tags conditions like below :
UseHitboxes()
var trace = Scene.Trace.Ray( start, end ) .UseHitboxes( true ) .WithoutTags( "localplayer" );
Where localplayer tags have been added through code only on my localplayer my Player.cs with a beautiful dirty logic :
localplayer
protected override void OnUpdate() { if ( Owner.Network.IsOwner ) { foreach ( var component in Owner.GameObject.Components.GetAll() ) { component.GameObject.Tags.Add( "localplayer" ); } } }
So it looks like any Tags filters like WithoutTags / WithAnyTags etc don't work for Tags that have been added dynamically.
Tags
WithoutTags
WithAnyTags
After investigation, here's reproduce steps:
1) Open hitbox scene
hitbox
2) Edit CameraPhysicsDebug.cs from https://github.com/Facepunch/sbox-scenestaging/blob/main/code/ExampleComponents/CameraPhysicsDebug.cs
CameraPhysicsDebug.cs
Add any tags filters to :
if ( TraceType == TraceTypes.Ray ) { t = Scene.Trace .Ray( start, end ) .UseHitboxes( Hitboxes ) .WithoutTags("localplayer") // Add your favorite tags filter .Run(); }
3) Create a simple Component:
public class SimpleTagToComponent : Component { protected override void OnStart() { GameObject.Tags.Add( "localplayer" ); } }
4) Add the created SimpleTagToComponent Component to one of Terry Body from the scene
SimpleTagToComponent
Body
5) Play: your Terry Body still gets Trace even if the localplayer tag filtering
Trace filtering must work even if Tags are added lately
My reproduce steps in video:
https://github.com/sboxgame/issues/assets/5229571/45e2e69f-9fa0-4b3d-adad-02c822543556
No response
This should work now
looks great, thx
https://github.com/Facepunch/sbox-issues/assets/5229571/c95c2184-ce4e-4c51-abf7-e7b0da40ec3c
Describe the bug
Hello,
In a FPS context, i'm trying to shoot from my localplayer EyePosition to Forward with SceneTrace.Ray()
However with
UseHitboxes()
, i always get my localplayer Hitboxes even if i add some Tags conditions like below :Where
localplayer
tags have been added through code only on my localplayer my Player.cs with a beautiful dirty logic :So it looks like any
Tags
filters likeWithoutTags
/WithAnyTags
etc don't work forTags
that have been added dynamically.After investigation, here's reproduce steps:
To Reproduce
1) Open
hitbox
scene2) Edit
CameraPhysicsDebug.cs
from https://github.com/Facepunch/sbox-scenestaging/blob/main/code/ExampleComponents/CameraPhysicsDebug.csAdd any tags filters to :
3) Create a simple Component:
4) Add the created
SimpleTagToComponent
Component to one of TerryBody
from the scene5) Play: your Terry Body still gets Trace even if the
localplayer
tag filteringExpected behavior
Trace filtering must work even if Tags are added lately
Media/Files
My reproduce steps in video:
https://github.com/sboxgame/issues/assets/5229571/45e2e69f-9fa0-4b3d-adad-02c822543556
Additional context
No response