Download

Object placement

I’m trying to create a special weapon, based on the FPS demo, that does something like the TF2 engineer: http://www.youtube.com/watch?v=MPRZkX9be14

I select the weapon and then i’m able to choose which item to place. This part is not so important, since it’s not difficult. The difficult part is: how can i pre-render an object with a specific shader (semi-transparent, etc.) and then actually place it, running all it’s logic? Also, how do i restrict where it can and cannot be placed (how do i detect if the model is overlapping another?)? What’s the best way to do it?

bumping! :slight_smile:

No one? :frowning:

What you’re asking isn’t a simple thing, hence the lack of replies. :slight_smile:

Let’s break down, at a high level, what you’re trying to do:

For that, you’d need a system that uses a raycast from the user’s mouse location, into the world, and places a static mesh (with a dynamic material instance likely so you can set some alpha parameter). The system would need to check that the selected location is valid or not (we’ll get to that in a moment) and change the highlight color of the mesh (again, using some material parameter). If the user presses the mouse button, and the location is valid, it spawns the actual actor at the location. If they hit RMB or escape or what not, it cancels.

Ideally using a simple sphere based query or AABB query using the bounds of the mesh. You could also create special “placement” volumes that give you tighter control on where users could place these things. Again, you would do this logic check during the placement.

If I had to bid how long it would take to create such a system, I’d probably bid it somewhere at 2 - 4 weeks. Assuming you knew what you were doing and wanted a polish placement system. :slight_smile: And 2 is probably being a bit TOO optimistic (there’s always edge cases in these things). So yea, not an easy thing to sum up step by step in a post. :slight_smile: