Closed yuberee closed 5 months ago
Some SceneModels seem to not bonemerge properly when parenting, this includes all clothing.
Here's a repro:
@namespace Sauna.UI @attribute [StyleSheet] @inherits ScenePanel <root /> @code { private SceneModel Character { get; set; } private SceneModel Shirt { get; set; } private SceneDirectionalLight Sun { get; set; } private SceneLight Light { get; set; } private bool _update; protected override void OnAfterTreeRender( bool firstTime ) { base.OnAfterTreeRender( firstTime ); // Setup camera. World ??= new(); SetupLighting(); // Add event listener. if ( !firstTime ) return; } private void SetupLighting() { Sun ??= new SceneDirectionalLight( World, Rotation.From( -45, -45, 0 ), Color.White ); Light ??= new SceneLight( World, 0, 500f, Color.White * 2f ); Light.Position = Camera.Position + Camera.Rotation.Forward * 10f; } public void UpdateAppearance() { Character ??= new SceneModel(World, "models/citizen/citizen.vmdl", global::Transform.Zero ); if ( Shirt?.Parent != Character ) { Shirt?.Delete(); Shirt = new SceneModel(Character.World, "models/citizen_clothes/full_outfit/space_suit_outfit/models/space_suit_outfit.vmdl", global::Transform.Zero); Character.AddChild("suit", Shirt); // THIS IS WHERE IT DOESN'T WORK // } // Update tick. Update(); } private void Update() { // Aim towards mouse. var mousePos = MousePosition; var headPos = Camera.ToScreen( (Character.GetAttachment( "eyes", false ) ?? Transform.Zero).Position ); var localPos = mousePos - headPos; Character.SetAnimParameter( "lookat", new Vector3( 1000f, localPos.x, -localPos.y ) * Character.Rotation.Inverse ); Character.SetAnimParameter("move_x", 900f); // Update character parameters. Character.Update(RealTime.Delta); Shirt.Update(RealTime.Delta); } public override void Tick() { if ( Character == null || _update ) { UpdateAppearance(); _update = false; } Update(); // Update the SceneCamera. Camera.FieldOfView = 30; Camera.FitModel( Character ); SetupLighting(); } }
And what it looks like:
.
https://github.com/Facepunch/sbox-issues/assets/59583743/86556adc-ad92-41c9-81ad-fa00124f55a6
The penis model doesn't have this issue but we can't find what's the difference between the penis and clothing. This started happening last week, maybe earlier?
This should be fixed now
Yepp! Thanks for the fast fix!
Describe the bug
Some SceneModels seem to not bonemerge properly when parenting, this includes all clothing.
To Reproduce
Here's a repro:
And what it looks like:
Expected behavior
.
Media/Files
https://github.com/Facepunch/sbox-issues/assets/59583743/86556adc-ad92-41c9-81ad-fa00124f55a6
Additional context
The penis model doesn't have this issue but we can't find what's the difference between the penis and clothing. This started happening last week, maybe earlier?