# playMaker

### Author Topic: Another newbie question. Vector3 change variable[SOLVED]  (Read 3539 times)

#### D12Duke

• Playmaker Newbie
• Posts: 20
##### Another newbie question. Vector3 change variable[SOLVED]
« on: March 14, 2016, 05:58:21 PM »
Good evening / morning fellas!

I gave up on terrain collision and decided to make the terrain flat

With that said, I need an "idle" and "walking" animation played.  What I've done so far is (in my thinking..) created an idle state, bool test = true then play idle, if false then getting vector3 and play walking animation (every frame)... It doesn't seem to work right, he just floats in the idle animation and though the fsm is firing off correctly (i think) and coming back to the idle fsm after he stops moving... it never 'walks'..

Is there an easier way someone else has figured out? Is vector3 a good way to see if an object is moving or is there a better way?
« Last Edit: March 23, 2016, 01:35:57 AM by jeanfabre »

#### Zeldag

• Full Member
• Posts: 198
##### Re: Another newbie question. Vector3 change variable
« Reply #1 on: March 14, 2016, 09:53:08 PM »
Hi!

Can you make playmaker play the walk animation through a simpler way, just to see if it is the animation or your triggering of it?

Also how is the bool flipped in idle and you say you flip the bool, then get the vector3?

Just off the top of my head, if a character is being moved already and you just need to set up an animation FSM, I think one way to do it is using velocity (im sure you could use vector 3 and compare it somehow as well, but i havnt done it like that before):

Animation FSM

Idle state: play animation (idle)
Get velocity (of z axis into a float variable-every frame)
Compare float (if velocity on z axis is higher or equal to 0.01, then send to 'walk state'-every frame)

Walk state: play animation (walk)
Get velocity (of z axis into a float variable-every frame)
Compare float (if velocity on z axis is  or equal to 0, then send to idle state- every frame).

Also i guess youre using legacy animations and all the settings are done (like loop the and generally setup for legacy). Also if so, make sure you add the animation to the animation component in the imspector.

If youre using the mecanim animator then 'play animation' will simply not play as that action is for the legacy animations that you get in the inspector.

For that you need the mecanim action pack, which can be found on the ecosystem or here:

https://hutonggames.fogbugz.com/?W1031

A cool tutorial on making a third person character controller and animating it can be found here (warning you will learn a lot of cool stuff quite easily with this one):

Lol I hope I covered what youre looking for, but if not please explain more about your issue and I will try to be more specific if I can.

Good luck with it, hope you figure out your issue and let us know how it goes!

#### D12Duke

• Playmaker Newbie
• Posts: 20
##### Re: Another newbie question. Vector3 change variable
« Reply #2 on: March 15, 2016, 06:28:03 PM »
Thank you for your reply!  I will try this out now!  (been watching this thread for an answer for days)  I'll give that a shot and let you know.

#### D12Duke

• Playmaker Newbie
• Posts: 20
##### Re: Another newbie question. Vector3 change variable
« Reply #3 on: March 15, 2016, 06:53:53 PM »
I'm clearly not getting this, now when I do a 'get velocity' action then a compare float, chosing my created Z variable.. It just sits on state 1 not trying to go to state two.

I can attach a screenshot, obviously i'm doing something wrong.

#### D12Duke

• Playmaker Newbie
• Posts: 20
##### Re: Another newbie question. Vector3 change variable
« Reply #4 on: March 15, 2016, 07:42:56 PM »
This may be a Playmaker bug, but nothing I do now will complete the current state...

Am I ignorant to this or should this not be moving to the next state (see attached)

Edit: ....Empty states move fine....  I may just have to do everything by hand man and I really truly don't want to learn another frickin language......
« Last Edit: March 15, 2016, 07:48:45 PM by D12Duke »

#### jeanfabre

• Hero Member
• Posts: 14832
• Official Playmaker Support
##### Re: Another newbie question. Vector3 change variable
« Reply #5 on: March 16, 2016, 12:05:53 AM »
Hi,

this action ( Get Axis ) in particular doesn't finish a state, so indeed you 'll need to do something else to move to another state.

re your float compare, turn on "debug" in the state so that you can see the variables values and progress like that in finding out why your comparision isn't doing what it should, it's either a setup problem, or the values that are not what you expects.

Keep at it, don't give up, you are close, some concept needs to sink in and you'll be fine.

Bye,

Jean

#### Zeldag

• Full Member
• Posts: 198
##### Re: Another newbie question. Vector3 change variable
« Reply #6 on: March 16, 2016, 03:51:56 AM »
Hi, as Jean said the getaxis wont send abtransition.

To send a transition from that state add: 'float conpare' and compare the variable with 0. ( float 1= your variable, float 2 = 0) then if higher  or lower than 0 send 'Finnish' event.

Also unless you have setup the name of your axis to be what you name it, the default axis name for the z axis is VErtical. Sonunless you chnged it type that into axis name.

This should send finish event when you press the axis button.

#### D12Duke

• Playmaker Newbie
• Posts: 20
##### Re: Another newbie question. Vector3 change variable
« Reply #7 on: March 16, 2016, 04:53:49 PM »
This is actually a touch to move / click to move design.. So there are no buttons, I have to rely completely on axis information (velocity doesn't apply to the character, I'm using raycast so it never gets a true velocity, just a location change).

I will continue to mess with it in about an hour...

Is it sad that I have a working trigger / collider to pick up 'food'.. a completely functional (within playmaker only!) health / stamina system... and.. a complete attribute system with playmaker only?  Yet I can't get this!!?? lol...

On a totally separate note, is there a place I can upload my fsm templates for my more.. herbally influenced.. deeper fsm creations? I have some pretty cool stuff folks could use that's completely independent from other third-party software minus Playmaker.

#### D12Duke

• Playmaker Newbie
• Posts: 20
##### Re: Another newbie question. Vector3 change variable
« Reply #8 on: March 16, 2016, 06:26:46 PM »
RAWR, I don't get it!

I understand what I WANT to do but this isn't bloody working...

I get that I want to store the Xaxis, (named it Vertical), then I did a Float Compare, then transitioned it's (not moving..0) event into another state that then recompares it, then if value = 0, play the walking animation.... (not idle, just went fast)...

Edit: ....  Not giving up on this...

So is there a position compare / vector compare?
« Last Edit: March 16, 2016, 06:44:29 PM by D12Duke »

#### D12Duke

• Playmaker Newbie
• Posts: 20
##### Re: Another newbie question. Vector3 change variable
« Reply #9 on: March 16, 2016, 07:04:04 PM »

The event Now fires off.... God I must be missing something.. I'll write it out and attach a screenshot...

State 1 : GET POSITION >
POSITION CHANGE> DO THIS (FINISH)

State 2:  PLAY ANIMATION>
WAIT> 5 SECONDS

Transitions fire, animation doesn't play.

GETRAGEAXIS
BOOL = ALL TRUE

#### jeanfabre

• Hero Member
• Posts: 14832
• Official Playmaker Support
##### Re: Another newbie question. Vector3 change variable
« Reply #10 on: March 16, 2016, 10:59:27 PM »
Hi,

your screenshots are missing some of the actions, so it's difficult to say what could be wrong.

Bye,

Jean

#### D12Duke

• Playmaker Newbie
• Posts: 20
##### Re: Another newbie question. Vector3 change variable
« Reply #11 on: March 17, 2016, 07:21:24 PM »
As I have done in the past, I will make a youtube video showcasing all that I am trying to do and have put in.  The problem I think lies with the animation matrix itself.  I have the animations attached to the character and they are selectable but when I attempt to 'call' them in any state (not juts playmaker) they fail to play.

#### jeanfabre

• Hero Member
• Posts: 14832
• Official Playmaker Support
##### Re: Another newbie question. Vector3 change variable
« Reply #12 on: March 17, 2016, 11:13:05 PM »
Hi,

ok, we'll see with your video, maybe it will be clear what the problem is.

Bye,

Jean

#### Zeldag

• Full Member
• Posts: 198
##### Re: Another newbie question. Vector3 change variable
« Reply #13 on: March 18, 2016, 05:58:33 AM »
I apolagize in advance if this is not your issue, but:

Are you using the animator (state based window) or the animations (in the inspector)?

Only saying as if youre using the Animator then play animation is not the right action. You should download the mecanim action pack: https://hutonggames.fogbugz.com/?W1031 ,if youre using the animator that is.

I was confused with all that when I started out, so hopefully it may be the same issue... (also some options in the import settings of each animation may prevent them from working (such as having the animation set as legacy and then using it in the animator).

Good luck with it and hopefully the youtube vid will help diagnose it otherwise...

#### D12Duke

• Playmaker Newbie
• Posts: 20
##### Re: Another newbie question. Vector3 change variable
« Reply #14 on: March 19, 2016, 11:15:21 AM »
Thank both of you VERY much for your support and assistance with this.

To all others having the issue.  It's not a Playmaker issue, but more so a Unity issue.  (maybe 5.3?)

You have to set up your animations using Legacy, not Mecanim.  Playmaker will support Mecanim if they're set up properly but for a mobile game, legacy animations are far less unit intensive.  (hence my headache).

So refusing to write code and deciding that this little damn bear was GOING to walk, I started researching.  Adventure Creator ALONG with Playmaker is an absolute MUST-Have!!!

From someone who picked up Unity 32 days ago and only have jscript experience (Staying with C# due to popularity, support and performance on Android).. I was lost in the dark for 20 of those days, then seen the light at the end of the tunnel with PlayMaker creating a GOB of neat stuff.  Now I have found Adventure creator as well, I'm a one man development wrecking crew..

AC lets you place Legacy animations on a character, gives you predefined fields to drag and drop your animations and quite instantly (7 minutes from tutorial to game) with full idle, walk, jump etc etc ... etc... (etc?) all built in and completely fluid.

Paired with Playmaker's FSM's for triggering and 'on the fly' variable calculations, I'll have my project ready to ship before the end of this month....

These two software packages combined have literally made Unity completely code free for my project and I will be donating a substantial amount to hutong and the creators of AC.

Kudos to both companies.  I'm sure I'll be around with more collider / trigger questions in the near future (though most of mine in PM are perfect!)

Thanks again both of you!!