playMaker

Author Topic: Tutorial request: Building placement system in PlayMaker[SOLVED]  (Read 3109 times)

markIJ

  • Playmaker Newbie
  • *
  • Posts: 4
    • View Profile
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
« Last Edit: November 03, 2013, 11:45:02 PM by jeanfabre »

Lane

  • Administrator
  • Hero Member
  • *****
  • Posts: 2488
  • Yup.
    • View Profile
    • Cleverous
Re: Tutorial request: Building placement system in PlayMaker
« Reply #1 on: October 16, 2013, 07:51:45 AM »
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.

markIJ

  • Playmaker Newbie
  • *
  • Posts: 4
    • View Profile
Re: Tutorial request: Building placement system in PlayMaker
« Reply #2 on: October 16, 2013, 08:05:27 AM »
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).

Lane

  • Administrator
  • Hero Member
  • *****
  • Posts: 2488
  • Yup.
    • View Profile
    • Cleverous
Re: Tutorial request: Building placement system in PlayMaker
« Reply #3 on: October 16, 2013, 08:21:02 AM »
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.

markIJ

  • Playmaker Newbie
  • *
  • Posts: 4
    • View Profile
Re: Tutorial request: Building placement system in PlayMaker
« Reply #4 on: October 16, 2013, 11:47:01 AM »
appreciated!

markIJ

  • Playmaker Newbie
  • *
  • Posts: 4
    • View Profile
Re: Tutorial request: Building placement system in PlayMaker
« Reply #5 on: November 02, 2013, 07:24:27 AM »
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.

Lane

  • Administrator
  • Hero Member
  • *****
  • Posts: 2488
  • Yup.
    • View Profile
    • Cleverous
Re: Tutorial request: Building placement system in PlayMaker
« Reply #6 on: November 02, 2013, 07:42:03 AM »
Exactly! I'm glad it worked out =)