mirror of
https://github.com/space-wizards/RobustToolbox.git
synced 2026-09-04 02:57:08 +02:00
* Don't generate physics contacts for non-predicted bodies These are all just handled on the server anyway so it's a significant waste of performance on the client for busy scenes. * Significantly optimise broadphase updates Cache all of the broadphase data properly now and also save the cache for physics step to boot. * Fix cross-map broadphases * Remove unnecessary clear * fix * Fixes * Numerous ray fixes
39 lines
1.1 KiB
C#
39 lines
1.1 KiB
C#
using JetBrains.Annotations;
|
|
using Robust.Shared.GameObjects;
|
|
using Robust.Shared.IoC;
|
|
using Robust.Shared.Network.Messages;
|
|
using Robust.Shared.Physics;
|
|
|
|
namespace Robust.Server.Debugging
|
|
{
|
|
[UsedImplicitly]
|
|
internal class DebugDrawingManager : IDebugDrawingManager, IEntityEventSubscriber
|
|
{
|
|
[Dependency] private readonly IEntityManager _entManager = default!;
|
|
|
|
public void Initialize()
|
|
{
|
|
#if DEBUG
|
|
_entManager.EventBus.SubscribeEvent<DebugDrawRayMessage>(EventSource.Local, this, PhysicsOnDebugDrawRay);
|
|
#endif
|
|
}
|
|
|
|
private void PhysicsOnDebugDrawRay(DebugDrawRayMessage @event)
|
|
{
|
|
var data = @event.Data;
|
|
var msg = new MsgRay {RayOrigin = data.Ray.Position};
|
|
if (data.Results != null)
|
|
{
|
|
msg.DidHit = true;
|
|
msg.RayHit = data.Results.Value.HitPos;
|
|
}
|
|
else
|
|
{
|
|
msg.RayHit = data.Ray.Position + data.Ray.Direction * data.MaxLength;
|
|
}
|
|
|
|
_entManager.EventBus.RaiseEvent(EventSource.Network, msg);
|
|
}
|
|
}
|
|
}
|