Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions Code/Game/Weapon/BaseCarryable/BaseCarryable.cs
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,14 @@ protected override void OnUpdate()
aimPos = Scene.Camera.PointToScreenPixels( tr.EndPosition );
}

var host = Game.ActiveScene.Get<SpawnMenuHost>();
var mode = SpawnMenuHost.GetActiveMode()?.GetType().Name;
if ( ( host?.Panel?.HasClass("open") ?? false ) &&
( mode is "ContextMenuHost" or "SaveMenu" or "EffectsHost" ) )
{
aimPos = Sandbox.Mouse.Position;
}

if ( !Scene.Camera.RenderExcludeTags.Has( "ui" ) )
{
DrawHud( hud, aimPos );
Expand Down
13 changes: 13 additions & 0 deletions Code/Game/Weapon/WeaponModel/ViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,19 @@ void UpdateAnimation()
Renderer.Set( "move_y", sideward );
Renderer.Set( "move_x", forward );
Renderer.Set( "move_z", velocity.z );

var host = Game.ActiveScene.Get<SpawnMenuHost>();
var mode = SpawnMenuHost.GetActiveMode()?.GetType().Name;
if ( ( host?.Panel?.HasClass("open") ?? false ) &&
( mode is "ContextMenuHost" or "SaveMenu" or "EffectsHost" ) )
{
var cursor = Sandbox.Mouse.Position;
var screenRay = Scene.Camera.ScreenPixelToRay( cursor );
var lookRot = Rotation.LookAt( screenRay.Forward );
Renderer.WorldRotation = Rotation.Lerp( Renderer.WorldRotation, lookRot, Time.Delta * 5.0f );
}
else
Renderer.LocalRotation = Rotation.Lerp( Renderer.LocalRotation, Angles.Zero, Time.Delta * 5.0f );
}

public void OnAttack()
Expand Down