playMaker

Author Topic: Variable Storage  (Read 3194 times)

iPetProjectDev

  • Playmaker Newbie
  • *
  • Posts: 23
Variable Storage
« on: May 17, 2012, 04:21:33 AM »
I am trying to store the rotation and position of one object to place another at its position and rotation. I tried some of the Transform stuff and that wasn't it. I tried the StateMachine actions..Get Fsm Vector3. This is on the parent ball launcher.  The object I am trying to set is not in its hierarchy but the object I am constraining it to is a child. So for Specify Game Object I used the BallLauncher. I then referred to the FSM in the next slot by name. Then it has variable name.. I placed Posistion in there but the store valu remained red ih the only choice being none. I know this is not correct, orit would llow me to store the var. So.. What i the deal on getting a transform vector or quaternion, calling it a name and retrieving it. It ha gotta be easy because I am ripping through this and only bought it five hours ago..I did a google search because your docs on the Fsm actions are not comprehensive and I could not find a forum post on it after a search through several pages.

BTW. Jean rocks. ;D I dl-ed every one of those actions.

Thx

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Variable Storage
« Reply #1 on: May 17, 2012, 05:45:14 AM »
Hi,

 Thanks :) I am thinking about making a bundle I would update as more actions are done on the asset store. cause right now, this is not convenient for custom actions addicts :)

as for your problem. You can always, at any time, store the position or rotation of any transform.

simply use "Get Position" or "get rotation", point to either a FsmGameObject you have declared in your fsm or dragged and drop from the scene or hierarchy onto the action interface

IF, you want to access the position of rotation of a gameObject stored in a FsmGameObject variable from another Fsm, you 'll need to first get the gameObject with "GEt Fsm Game Object", store it in a local variable, and then use "get position" or "get rotation"

Does that make sense?

Or could it be that you are having a problem with local and global transforms?

 Bye,

 Jean


iPetProjectDev

  • Playmaker Newbie
  • *
  • Posts: 23
Re: Variable Storage
« Reply #2 on: May 17, 2012, 10:19:26 AM »
Hi Jean. No.. I got the whole second GO for setting angles and such..I am trying to snap the ball to a firingPosition GO position and rotation transform with using iTween which was the only method I sussed so far./; I wanted different because there are way too many controls on the iTween MoveTo than are necessary and I figured i better conquer this and get the var storage and transfer down. . The issue is I want to store variables but all I see for instruction is similar to what you said. "Store some local variables and then do such and such with them". Well.. I tried to find ways to store  local vars last night and came up empty handed or the store value box would remain red no matter what. Basically the instructions are too vague and seem to assume certain things which do not seem to be my cases...or the likely dropdown menu has only one item called "None" populating it.

TIA

iPetProjectDev

  • Playmaker Newbie
  • *
  • Posts: 23
Re: Variable Storage
« Reply #3 on: May 17, 2012, 04:17:56 PM »
OK. I halfway figured it out but some of this is confusing. I can store a var but often not retrieve it from any menus..or I create a var and find no way to store t it.

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Variable Storage
« Reply #4 on: May 18, 2012, 03:20:40 AM »
hi,

 ok, just to make sure, Have you watched the videos and screencasts available? they are key to understanding what you are missing currently. Don't under estimate the power of these videos, even if they do not touch on your topic specifically, watch them with care because they give you the keys how playmaker is working.

Now, several things;

to retrieve a variable is only possible via an existing action, available in the Actions browser. This might sound obvious, but this is the first stop.

now, you have your action, fields can be in several "states", they can let you drag a gameObject onto it, or type a string, an int or a float, pick a color, BUT they can also let you reference a variable for that, simply click on the small icon on the right side of the field, and you will see *ALL* the variable of the field type that you can access.

 SO: if you create a FsmGameObject Variable, and work on a "get position" action, if you want to get the position of a given gameObject, select "specfy GamObject" in the field "Game Object" and then you can either drag and drop one or click on the square icon to the right, the field will switch to "none", click on it, and you'll the GameObject variable you have created on this FSM plus the global gameObject variables too  ( they'll be tagged "global" )

I think this might be where you are struggling right?

When you say "retrieve it from any menu", what do you mean by menu? variables are only settable and gettable within actions, or in the variable tab. not via menus.

Also, very important, when you create a variable, you need to then select it again, to set it up with a value. For example, if you create a gameObject var and want to reference a gameObject already, select it again, after you just created it and you'll be presented with a field where you can drag a gameObject onto it.

 We'll get there!

Bye,

 Jean

iPetProjectDev

  • Playmaker Newbie
  • *
  • Posts: 23
Re: Variable Storage
« Reply #5 on: May 20, 2012, 11:01:28 PM »
Hi Jean. I finally go it figured out. Tutorial videos don't mean much to my brain until I have tried to use stuff and run into a brick wall. I rerolled my own CharacterController using Fsm's and watched several of the videos. Pretty darned easy. Just trying to figure out a good scheme for accelerating and decelerating. Tried to use a keyDown to implement the moveSpeed variable change for acceleration but came up nil so far. Now that I have the variable thing down I am going to have to figure out the input stuff so that while I hold the key down the moveSpeed continually climbs to a clamped value and the same for a deceleration key to fall to zero. Already have the black box animation graphs set to go..

I wish there was more EZGUI stuff. I have an entire control GUI I would like to change to Fsm's.

thx