Playmaker Forum
PlayMaker Help & Tips => PlayMaker Tutorials => Topic started by: markIJ on October 16, 2013, 10:46:55 AM
-
Hi, i am looking for a little help with my building placement system using PlayMaker. What i want to do:
*Have one clickable object
*giving me the option to build/place the object
*only on my terrain in 3d space using raycast
It would be great if any1 could help me out.
Kind regards, Mark
-
You can use Mouse Pick to store the intersection point with the terrain, then just create an object there.
The hard part is collision testing. I did some experimenting with Kiriri's A* pathfinding to confirm you can place the building there or not and it worked out okay. There may be a more generic and simple way to go about doing that though.
-
Thanks for the fast reply. The collision testing is indeed what i can't figure out. What i would like to add aswell, is a preview of the object on the mouse position before the object is actually placed (RTS games like AoE style).
-
I have a test project of this but its in no shape to share. Just a bunch of jibberish.
I was creating a 'ghost' object and using its collider to test for clashes with other objects. If there was a collision then it considered it unplaceable. No collisions meant you could build it there on the next click. It seemed to be a matter of managing states and carefully setting up conditions to go through the building process, like clicking the icon, then spawning the ghost object and waiting for a click and on click do the test for collisions, then if it clears then create a real object there and remove the ghost object.
I'll see if I can clean up the project and make something comprehensible for you to look at.
-
appreciated!
-
Hi,
i found out a way to create my system:
when i click my GUI "build" button an invisible object moves to my mouse position and checks:
Did it collide with the map
Dit it NOT collide with other objects
(is it in range)
when the requirements are met and i click my mouse button again, a new building object is created at my mouse position.
Thanks for the response on this topic.
-
Exactly! I'm glad it worked out =)