Download

Dropping Items and Snapping to Floor

Hey Everyone,

I have and inventory system for my player where player can drop items from Inventory. Instead of using physics, which my items ( all derived from master item) don’t use, I basically spawn the actor, do a line trace infront of my player straight down to try and hit the ground and then set the spawned actors location to that location.

Now all this works fine, but what I am trying to do, is that when I do the line trace to find the ground, I want it to ignore any items/actors along the way (those that come from my master item/actor) so basically items don’t keep stacking on top of each other upwards and instead will just be placed on the floor and overlap any other items already there.

Is there an easy way of doing this?

Thanks.

Set up a custom object channel for your inventory items. Have the line trace ignore the player and the inventory item channel.

Project settings -> Engine -> Collision

Thanks for the advice. Have never messed too much with this stuff. So I ended up creating a new Object Channel and a New Preset for my Pickups. I then created a new Trace Channel which my Pickups is set to ignore and use this trace channel when doing to line trace to the ground, ignoring any of my items that might be in the way. Works Perfectly now.

Since I use a line trace also to pickup my items, having a separate channel for when I drop them worked best so my pickup line trace doesn’t ignore the items. Whether this was the best way about it, i don’t know, but works great and does exactly what I need.

Thanks again.

For item pickup I use Actor Component (Inventory) w/interaction using BP Interface. The items have a collision sphere in which the inventory checks for overlapping actors of class when I press E to pickup an item.