What is the best way to get a random position on the floor that a players character is standing on? This would be used in a loot dropping system (if the player drops an item, or dies, etc) meaning it MUST be on a surface, and must not be floating.
One way I was thinking is cast off several rays from the characters torso position at a 45 degree angle downwards in various different degrees, so make a circle of sorts around the character, if it hits something within X amount of studs, then place the loot there. There are drawbacks to this though:
1) Resource heavy (casting rays so often)
2) What if it doesn't find a position?
3) What if there is more than one drop, there are bound to be missing drop positions
Overall, I dont think that idea would work
The next one is to raycast once downwards, get the floor part, and it's surface normal, and then put the loot within a random radius around that part (taking into account rotation/slant/etc) the downsides to this:
1) If you are on a ledge, it will float (Since how does it check the position is actually on the part?
2) Goes through walls
I'm looking for something that will work nicely, and drop within view of the character at all times. Any ideas?