Dropping weapons outside the map

EVG

Member
How to properly protect against unwanted throwing of weapons outside the map? If you come close to the wall and drop the weapon, it will fall out of the map.
An example from the demo scene:
 
I will need to think about this one. In a first person view the weapon is halfway through the scene so that's why the item was dropped there. I'm not sure the correct way to handle this - maybe prevent the drop ability if the item is colliding with another object? Or move it in so it's not instantiated at the same location as the actual object?
 
I remember in UFPS 1 when you approach the wall, the weapon was pressed closer to the body. Could it be possible to implement something similar here as well? :)
 
Maybe just a raycast check between the player's look source and the item's current position to check for walls, and moving the drop position to be behind any wall found if so
 
Maybe just a raycast check between the player's look source and the item's current position to check for walls, and moving the drop position to be behind any wall found if so
How do I change the drop position? I have not found this
 
Sorry I was suggesting this as an addition/change to the DropItem method of Inventory/InventoryBase. You would need to modify 'dropPosition' before the ObjectPool.Instantiate gets called, after doing the raycast to check for a wall etc.
 
Top