Sandbox.SceneTrace
Reply on sbox.game-
Bot
Sandbox.SceneTrace : api/Sandbox.SceneTrace -
Traces are imaginary lines. When you run a Trace you get a TraceResult - which tells you what the line hit.So for example, if you, as the player, wanted to spawn a box. You'd run a Trace from the player's eyeball to 200 units in the direction that the player is looking. The TraceResult would show that it hit a point and now you know where to place the box.

8dc2c97c380c3f2.png 13.94 KB -
private void ShootRayFromEyesAndInteract(PlayerController playerController,float InteractDistance){var ray = playerController.EyeTransform.ForwardRay;var trace = Scene.Trace.Ray(in ray, InteractDistance).IgnoreGameObjectHierarchy(playerController.GameObject).Run();if (!trace.Hit)return;IIntractable component = trace.GameObject.GetComponent<IIntractable>();if (component == null)return;component.DoAction();}