playMaker

Author Topic: Need Help Making One Object Visible While Destroying Another on Mouse Click  (Read 2457 times)

missc

  • Playmaker Newbie
  • *
  • Posts: 4
Hello! I'm a Playmaker newb over here, but have been doing my best to search through the forums and have figured out answers to most of my questions on my own. This one problem has me stuck however, so please help if you can!

I have an object in a scene (a stump) that when the mouse clicks on it, I want it to "change" into a different object (a tree). I currently have the stump visible in the scene and the tree placed in the same space as the stump, but with the mesh renderer off. I have been trying all sorts of FSM scenarios, from Activate Object to Make Visible to Destroy Self, etc etc...I know I am so close (and it seems like it should be so easy!), but at this point am all turned around.

Any ideas? And a huge thank you in advance - I'm sure you will figure out in 2 seconds what has been taking me a week+!

Lane

  • Administrator
  • Hero Member
  • *****
  • Posts: 2511
  • Mender of the past
    • Cleverous
Are you targeting the correct game object with those actions?
Products by Cleverous
|| Vault Core : Database
|| Vault Inventory : Multiplayer Inventory
|| Vault Attributes : Character Stats
|| That Hurt! : Dmg Floaties
|| Quinn : 3D

missc

  • Playmaker Newbie
  • *
  • Posts: 4
I thought I was...but have tried so many combos at this point that I don't know what's correct!

I should also mention that I have both the stump and the tree stored in the hierarchy under separate empty game objects - not sure if that makes any difference.

Lane

  • Administrator
  • Hero Member
  • *****
  • Posts: 2511
  • Mender of the past
    • Cleverous
You have to target the actual gameobject you want to activate/deactivate. Targetting the wrapper/parent gameobject will turn all of the children off as well.
Products by Cleverous
|| Vault Core : Database
|| Vault Inventory : Multiplayer Inventory
|| Vault Attributes : Character Stats
|| That Hurt! : Dmg Floaties
|| Quinn : 3D

Marsh

  • Full Member
  • ***
  • Posts: 227
  • Comfort the disturbed, disturb the comfortable
Dont turn the mesh renderer off. Even if the game object is disabled or enabled it still wont show anything.

Uncheck the actual gameObject. Then setting it to active will make it appear and setting it to inactive will make it dissapear. Leave the mesh renderer on both.


On Click set the first tree active to false then the second tree active to true. Thats all you need to do.

missc

  • Playmaker Newbie
  • *
  • Posts: 4
Thank you to everyone who's answered so far!

I've been playing around a bit more and it looks like what I've come up with should work but, during gameplay the object itself doesn't appear in the game when clicked - I can see the check mark reappear on the actual game object in Inspector (I unchecked that instead of mesh renderer), but not in the game screen...

The actions I've used are: Get Mouse Button Down, Mouse Pick, Bool Test, Set Position and Activate Game Object (I took some screen grabs, but can't seem to upload them into my reply...grr)

missc

  • Playmaker Newbie
  • *
  • Posts: 4
Ok, so I solved my last problem by setting the space to World in the Set Position action - now the tree shows up on click! I also decided to not have the stump Destroy Self, but instead had it "unactivate"...similar to the action setup for the tree.

But now I have a new problem (haha, of course): The game I'm making has various stumps scattered about that I want the player to be able to click on to make new trees appear in their place. But if I copy and paste the FSMs that worked for the first stump/tree set, the new trees appear in the same space as the first tree. How can I tell Playmaker that I want each tree in a specific place?

(I think I should mention that all the Vector 3 variable hitpoints are set to 0,0,0...because when I tried cutting and pasting numbers, I couldn't get the tree to appear where I actually wanted it...)