Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Messages - cmonroy

Pages: [1] 2 3
PlayMaker Help / Leap Year
« on: May 13, 2015, 11:48:52 PM »
I was looking for a way to detect if a given year is leap or not (along with some other useful date functions) but found none, so I tried to make a custom action:

Code: [Select]
using UnityEngine;

namespace HutongGames.PlayMaker.Actions
[Tooltip("Determines if a given year is leap or not")]

public class LeapYear : FsmStateAction
[Tooltip("Stores the year to test as an int")]
public FsmFloat yearToCheck;
[Tooltip("Shows if the year is leap as TRUE")]
public FsmBool isLeapYear;

public override void Reset()
yearToCheck = null;
isLeapYear = null;

public override void OnEnter()
if ((yearToCheck % 4 == 0) && !(yearToCheck % 100 == 0) || (yearToCheck % 400 == 0))
isLeapYear = true;
isLeapYear = false;
Finish ();

It seems, however, that the mod operator is not supported... Any ideas?

Thank you.

PlayMaker Help / Compound Float Compare Help
« on: May 06, 2015, 02:19:16 AM »

I'm trying to implement a "Season" FSM in which a float value in the range 0, 359 is used to determine the current season (0-89 is Spring, 90-179 is Summer, 180-269 is Autumn and 270-359 is Winter).

Another FSM calculates the float value and send it here via Set FSM Float Value. The value is received correctly but yet it does not get evaluated.

In C#, the code is rather simple:

if(fVal >= 0f && fVal < 90) Debug.Log("It's Spring!");
if(fVal >= 90 && fVal < 180) Debug.Log("It's Summer!");
if(fVal >= 180 && fVal < 270) Debug.Log("It's Autumn!");
if(fVal >= 270 && fVal < 360) Debug.Log("It's Winter!);

Any ideas on how to implement this as an FSM?

Thank you.

PlayMaker Help / Re: 3rd Person shooter bullet direction help needed
« on: November 27, 2014, 05:26:44 AM »
Since you are "shooting" always to the front of your viewport, you could try to use Vector3.forward...

The other thing is: do you really need to use bullets or would it be simpler to use the raycast to simulate a high-speed bullet?

PlayMaker Help / Re: Mecanim Look At
« on: November 24, 2014, 02:42:29 PM »
Besides FinalIK is indeed compatible with Playmaker... The author has provided some basic funcionality to be called within your own FSM's...

It worked for me, at least.

Check the demo here:
As usual, use WASD to move, LeftShift to run and Tab to switch viewports. Done with Playmaker and Final-IK.

I had this problem a while back when I was developing a targeting control for my game. It may be due to a parallelax error since the raycast comes from a limb but the sighting is done trough the camera...

PlayMaker Help / Re: Using playmaker to script input for mechanim animation
« on: November 20, 2014, 01:02:55 PM »
Simple: set the speed variable to 1 when W is pressed and to 0 when is not. Do the same with R, but set the speed to 2 when pressed and to 0 (or 1) when not...

From the action browser, use the GETKEY to check if the desired key is pressed or not. Use the TESTBOOL to test its value. If TRUE, send the flow to another state to assign the corresponding value to animator variable with ANIMATORSETFLOAT and return to the listener state; do the same when FALSE but reset the values to 0 in another state and then return to the listener state (the one which "listens" for the key pressed.

PlayMaker Help / Re: Passing values between FSM in the same object?
« on: November 07, 2014, 02:15:29 AM »
I recreated the local variables as global ones and now each FSM can read and write most of them, even if they belong to different objects. Using this approach to cache the axis inputs and their multipliers and dampening values does not work, as these have to be consumed at their very own FSM.

Thank you Jean.


As a matter of fact, the problem is when you assign a global variable to a local action, if the names of the local and global variables are the same. At Design time, Playmaker allows you to read a global variable, say SpeedDampening, and store it to a local variable with the same name. At Run time, however, the reference to the global variable is lost and replaced with the local instance which, of course, does not contain nothing. :)

PlayMaker Help / [SOLVED] Passing values between FSM in the same object?
« on: November 06, 2014, 08:34:54 PM »
I have an FSM to setup things to be used at a later time, but when I try to GetFSMFloat, the action does not return anything and end with an empty value.

For instance, I have several FSM that do things with the camera but need to know the height, distance and a few vectors and quaternions to perform its duty. If I declare these variables in each FSM and then need to change the height value, for instance, I'll have to do it in each one of them. But if I put the configurable values in one FSM, then all the others could poll these values unaided.

My guess is that the Configuration FSM and the others are running at the same time and therefore could be reading the values before they are updated. Is there a way to poll those values after they have been initializated?

PlayMaker Help / Re: Help with character controller issues...
« on: November 06, 2014, 08:17:12 PM »
Thank you.

I've followed a similar route, but the raycast does not always detects the ground collider, so it provides me with inconsistent results as the IsGrounded does. Hence, I can't use Jumps or Falls animator states as the character keeps falling and landing every two or three steps. I'll check if using layers makes a difference.

PlayMaker Help / Re: Playmaker + Mecanim - 8 Way movement (Video)
« on: November 06, 2014, 08:04:57 PM »
Assuming you have two inputs (direction and speed) mapped to their corresponding keys, you could simplify your Animator FSM by using a 2D Freeform Cartesian Blend Tree: left goes to direction -1 and rear goes to speed -1 (or whatever you choose to call your inputs).

My guess is your input is not producing the desired values. An 8-way movement matrix (plus Idle) should be like this one:


PlayMaker Help / [SOLVED] Re: PlayMakerAnimatorProxy?
« on: November 05, 2014, 10:13:47 PM »
Not really... All I've got is Photon Networking, ArrayMaker, Ecosystem, Unity2D, and two other slots for BlackBerry and Windows Phone add-on, but no AnimatorProxy...

But I found it the old mecanim actions... :)

Thank you!

PlayMaker Help / [SOLVED] PlayMakerAnimatorProxy?
« on: November 05, 2014, 04:01:19 PM »

I'm trying to use the SetAnimatorIKGoal but I get a warning saying: This action requires a PlayMakerAnimatorIKProxy. It may not perform properly if not present. A search here does not produce results as to what is a PlayMakerAnimatorIK Proxy or how to create one. Could someone shed some light on this topic?


PlayMaker Help / Re: SET Quaternion?
« on: November 04, 2014, 06:35:00 PM »
Thank you Jean.

I've already downloaded the Quaternion library and found it didn't include a SET QUATERNION action.

I have a fixed-height, fixed-distance camera attached to my character that can be switched between some predetermined values. Height and distance are controlled via the SetVector3XYZ, but their respective rotations have to be entered manually. Right now, I'm using 0, 90, 180 and 270 degrees to rotate the viewport, but adding more angles (like every 45, 30 or 15 degrees) or more axes become complicated. What I was thinking of was making a routine where you can set how many views to generate, 8 for instance, divide 360 / 8 and create the rotations procedurally.

PlayMaker Help / Re: Mixamo/general animating
« on: November 04, 2014, 06:21:47 PM »
Create a gameObject variable in your FSM, then use the FindGameObject with the tag "Player" to set the value of your variable. You can do the same with the camera.

Best practice would be to create an empty game object and attach all your FSM's there. Parent the character mesh procedurally to the game object. That way, you only have to remember to change the tag of your character and add the rigid body and collider (character controller, for instance) to the character. Your game object takes care of the rest.

PlayMaker Help / SET Quaternion?
« on: November 03, 2014, 08:11:44 PM »
I want to store several quaternions in global variables to be used as needed in my game, but there is no equivalent action like SetVector3XYZ. Is there any other way to accomplish this?

Thank you!

Pages: [1] 2 3