Open PolSpock opened 2 days ago
Hi,
When you create a GameObject with ModelCollider and try to use ModelCollider.KeyframeBody.GetBounds(), it returns incorrect and overly large bounds instead of the actual bounds of the ModelCollider.
GameObject
ModelCollider
ModelCollider.KeyframeBody.GetBounds()
1) Download https://github.com/Facepunch/sbox-scenestaging 2) Edit Gun.cs in the OnUpdate() method by adding:
Gun.cs
OnUpdate()
if ( Input.Pressed( "Attack2" ) ) { var model = Model.Load( "models/sbox_props/wooden_crate/wooden_crate.vmdl" ); var go = new GameObject(); go.SetParent( Game.ActiveScene, false ); var modelCollider = go.Components.Create<ModelCollider>(); modelCollider.Model = model; var modelRenderer = go.Components.Create<ModelRenderer>(); modelRenderer.Model = model; Log.Info( "before" ); Log.Info( modelCollider.KeyframeBody.GetBounds() ); await Task.DelayRealtimeSeconds( 0.1f ); Log.Info( "after" ); Log.Info( modelCollider.KeyframeBody.GetBounds() ); }
3) Start the networking.scene 4) Press Attack2 and check the console :
networking.scene
KeyframeBody.GetBounds() should return the correct bounds immediately after the ModelCollider is created.
KeyframeBody.GetBounds()
No response
Dirty colliders update next frame, I'll see if we can remove that limitation
Describe the bug
Hi,
When you create a
GameObject
withModelCollider
and try to useModelCollider.KeyframeBody.GetBounds()
, it returns incorrect and overly large bounds instead of the actual bounds of the ModelCollider.To Reproduce
1) Download https://github.com/Facepunch/sbox-scenestaging 2) Edit
Gun.cs
in theOnUpdate()
method by adding:3) Start the
networking.scene
4) Press Attack2 and check the console :Expected behavior
KeyframeBody.GetBounds()
should return the correct bounds immediately after theModelCollider
is created.Media/Files
No response
Additional context
No response