Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: darrkbeast on January 31, 2014, 10:06:17 PM

Title: In Game Building
Post by: darrkbeast on January 31, 2014, 10:06:17 PM
So Im at the point in my game where I need to tackle building things ingame by the player. Its a first person game, so you build chairs, desk, small houses and other objects. Im looking for good direction, some ideas how I do this. I have decent sized terrain that has mountains and slopes so I want the object to only be buildable on relatively flat spots, so when you can place I would like the objects to maybe glow red.

So what I think I need is maybe a tab at the bottom that I click on for item, then item spawns at mouse location, and is red until I place it on level terrain, then it turns green I left mouse click and boom its there.

Any ideas, thanks. 
Title: Re: In Game Building
Post by: hipoh on January 31, 2014, 10:10:49 PM
As a guess,

Id have a large collider covering areas you can build. Do a mouse pick and if its in the container colour it's green.  Set the position of the object to the mouse pick + offset for object.
Title: Re: In Game Building
Post by: darrkbeast on January 31, 2014, 10:14:01 PM
I didn't think off that, that might work well, I could establish specific spots to build on. I will looking into that.
Title: Re: In Game Building
Post by: Breadman on January 31, 2014, 11:49:24 PM
I second the idea of using large colliders as buildable areas. You can even stack the colliders inside eachother and tag them, if you had different slope/area requirements for different items (a house would require a larger area of flat land than a hut for example).

You could also try raycasting to sample the angle of the land, and if it's less than X angle, it's buildable. Personally, I'd go with invisible colliders to separate buildable areas though!