playMaker

Author Topic: Rotating Game Objects with Mouse pick Event  (Read 6238 times)

gangsta geek

  • Playmaker Newbie
  • *
  • Posts: 6
Rotating Game Objects with Mouse pick Event
« on: June 14, 2012, 03:28:06 PM »
Hello everyone! I am very new to Playmaker and I've watched all the videos so I am ready to get to work ( I am an artist with no prgraming skills:'( ) I am trying to rotate game objects by a mouse over. I am using a Find Game Object action with the same Object Name and Tag.
Here's my simple set up. I can only get one cube to rotate. Any suggestions?







I'll be stalking these fourms now. I look forward to showing everyone my game and hopefully contributing to the community.

Omari

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Rotating Game Objects with Mouse pick Event
« Reply #1 on: June 14, 2012, 03:31:16 PM »
Hi,

 What you need, is making your cube as a prefab. Then all your cubes will rotate as you mouse over them, and you only need to edit the prefab, and all instances in the scene will get updated.

Do you know what a prefab is? you might be new to playmaker but not new to Unity.

Bye,

 Jean

 

gangsta geek

  • Playmaker Newbie
  • *
  • Posts: 6
Re: Rotating Game Objects with Mouse pick Event
« Reply #2 on: June 14, 2012, 04:25:20 PM »
Thanks for the quick response. Yes, I know what a prefab is. I tried that too but it didn't work. Only one cube rotates.
I've also tried parenting it to and Empty Game Object and using Get Child/Get Next Child/Find Child but still only one cube rotates. Seriously thanks for the quick response :D

pustur

  • Guest
Re: Rotating Game Objects with Mouse pick Event
« Reply #3 on: June 14, 2012, 04:39:13 PM »
I think that your playmaker script should be attached to a prefab, then you can duplicate it how many times you want and the copies will have the component too.
hope this helps :)

gangsta geek

  • Playmaker Newbie
  • *
  • Posts: 6
Re: Rotating Game Objects with Mouse pick Event
« Reply #4 on: June 14, 2012, 04:53:51 PM »
Thanks again! I know if I assigned it to a prefab it will work but is that the only way? You see this is a small test for a for a lot of game objects. I am trying to make a polygon grid that will allows this action to happen to each individual plane. I thought by making the grid in a different program (each planes is it's own game object) and assigning this action to it it might work. Or do I have to make a prefab and align them in a grid in Unity? Thanks again guys!

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Rotating Game Objects with Mouse pick Event
« Reply #5 on: June 15, 2012, 01:35:28 AM »
HI,

Yes, prefab will be the way to go if you don't want to have hard copies of the same feature, which means down the road a of of pain to maintain.

Also, not quite sure what you mean by "polygon grid' and plane in your context. do you want to actually rotate some faces of a mesh?

Bye,

 Jean

gangsta geek

  • Playmaker Newbie
  • *
  • Posts: 6
Re: Rotating Game Objects with Mouse pick Event
« Reply #6 on: June 15, 2012, 05:48:44 AM »


This is what I mean by grid. Each square is a separate object. Still no luck with this...even with the prefab. It seems like a simple setup but for some reason it's not working. I can only get one plane to rotate.

gangsta geek

  • Playmaker Newbie
  • *
  • Posts: 6
Re: Rotating Game Objects with Mouse pick Event
« Reply #7 on: June 15, 2012, 05:54:33 AM »
well I got it to work but still is there another way of doing this method?

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Rotating Game Objects with Mouse pick Event
« Reply #8 on: June 15, 2012, 06:37:04 AM »
Hi,

 good. I don't think there is another way, I mean another "efficient" way. Prefab are now very powerful.

What is it with prefab that you don't feel confortable with in your case? If for example it's a case of displaying a different texture on each cube, this is perfectly possible, and meant to be that flexible.

 assign an id for each of your prefabs, for example, expose a "id" int variable in the inspector, and set that up manually, or if you create them prefab at runtime, even easier, you do it within the fsm logic.

then each prefab can call a manager pass its id and get a texture in return, or a pointer as to where to get the texture.

For this kind of work, ArrayMaker will make your life easier and will be a lot more convenient to work with without leaving the Fsm editor.

https://hutonggames.fogbugz.com/default.asp?W715

Bye,

 Jean