playMaker

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

markIJ

  • Playmaker Newbie
  • *
  • Posts: 4
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 04, 2013, 01:45:02 AM by jeanfabre »

Lane

  • Administrator
  • Hero Member
  • *****
  • Posts: 2511
  • Mender of the past
    • Cleverous
Re: Tutorial request: Building placement system in PlayMaker
« Reply #1 on: October 16, 2013, 10: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.
Products by Cleverous
|| Vault Core : Database
|| Vault Inventory : Multiplayer Inventory
|| Vault Attributes : Character Stats
|| That Hurt! : Dmg Floaties
|| Quinn : 3D

markIJ

  • Playmaker Newbie
  • *
  • Posts: 4
Re: Tutorial request: Building placement system in PlayMaker
« Reply #2 on: October 16, 2013, 11: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: 2511
  • Mender of the past
    • Cleverous
Re: Tutorial request: Building placement system in PlayMaker
« Reply #3 on: October 16, 2013, 11: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.
Products by Cleverous
|| Vault Core : Database
|| Vault Inventory : Multiplayer Inventory
|| Vault Attributes : Character Stats
|| That Hurt! : Dmg Floaties
|| Quinn : 3D

markIJ

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

markIJ

  • Playmaker Newbie
  • *
  • Posts: 4
Re: Tutorial request: Building placement system in PlayMaker
« Reply #5 on: November 02, 2013, 10: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: 2511
  • Mender of the past
    • Cleverous
Re: Tutorial request: Building placement system in PlayMaker
« Reply #6 on: November 02, 2013, 10:42:03 AM »
Exactly! I'm glad it worked out =)
Products by Cleverous
|| Vault Core : Database
|| Vault Inventory : Multiplayer Inventory
|| Vault Attributes : Character Stats
|| That Hurt! : Dmg Floaties
|| Quinn : 3D