I have gun. Gun have two collision shapes for handle and barrel. The gun is using default RigidBody3D physics. No code.
I have level. StaticBody3D level made up of mesh and a very specifically designed collision shape (TBLoader Addon).
I have button that lets me "drop" the gun. It instantiates the gun as shown in the first screenshot with a random orientation and a set impulse + the player's velocity.
#Apply "throw" physics to WorldItem
var dir:Vector3 = -camera.get_global_transform().basis.z;
worlditem.rotation_degrees = Vector3(randi_range(0,359),randi_range(0,359),randi_range(0,359)); #random orientation
worlditem.position = camera.global_position + dir*0.2; #spawn a bit in front of camera (not enough to spawn in wall)
worlditem.throw((dir*6)+velocity); #does apply_central_impulse() somewhere else because i cant do it here for some reason
Sometimes it works as intended. Sometimes it clips through walls and sometimes through the floor.
I believe this is a product of the object moving too fast for it to be able to detect collisions properly, since I can reproduce the issue consistently by running towards a wall and dropping the gun.
What would be the most elegant way to fix the issue?
TL;DR Rigidbody3D moving really fast clips through StaticBody3D. Me no like. How fix?