playMaker

Author Topic: Stealth. Jeans example pulled apart to change it a little.  (Read 2244 times)

Splankton

  • Sr. Member
  • ****
  • Posts: 268
Stealth. Jeans example pulled apart to change it a little.
« on: February 14, 2014, 11:16:57 AM »
Hi,
I'm just messing around with Jeans Stealth example in playmaker,  which I'm trying to change the way it works a little, but can't get the result I want.
Basically I just want Ethan to be controlled by just the vertical axis with just up/down input and make him turn a little but no more than say by 45 degrees. And have this rotation analogue controlled, so the more vertical input, the more rotation. I'm thinking of using the accelerometer on a mobile device for an example.
So just to recap, Ethan faces one direction, until a vertical input, then a rotation is locked, so he only turns slightly.
Any ideas how I can do this?
In the stealth example, quaternion actions are used. But I don't think I'll need to use quaternion as it's just a simple rotation. Plus, quaternion scares me a bit, so I'm hoping I won't need them.
Thanks for any help.
« Last Edit: February 14, 2014, 11:39:48 AM by Splankton »

Splankton

  • Sr. Member
  • ****
  • Posts: 268
Re: Stealth. Jeans example pulled apart to change it a little.
« Reply #1 on: February 16, 2014, 11:14:24 AM »
Ok, I think all I need is to get the input value from Vertical axis and instead of it turning the character 90°, I need it to turn 45°
Can someone help please?

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Stealth. Jeans example pulled apart to change it a little.
« Reply #2 on: February 17, 2014, 10:26:17 AM »
Hi,

 Hang in there and get back to me towards the end of the week if you haven't had any luck with this. Thanks.

Your likely problem is not playmaker but Mecanim, you need to look at a different mecanim setup.


bye,

 Jean

Splankton

  • Sr. Member
  • ****
  • Posts: 268
Re: Stealth. Jeans example pulled apart to change it a little.
« Reply #3 on: February 19, 2014, 02:31:54 PM »
Yes, I have setup a new controller which has a simple blend tree containing a "run up" "run forward" and "run down" I have the threshold from -1 to 1 using a Direction parameter.

In the animator preview window, it blends exactly how I want it, but I think something needs to change in the "player turn" FSM because my player still has a 90° turn when I press up/down. And the turn smoothing doesn't work at all.  For example, Ethan switches from one direction to another.

But as for getting my new controller working with Playmaker, I have no idea. Jean, I'll bump this at the weekend maybe if I'm no closer.
Thanks

Splankton

  • Sr. Member
  • ****
  • Posts: 268
Re: Stealth. Jeans example pulled apart to change it a little.
« Reply #4 on: February 21, 2014, 03:26:04 PM »
Ok, I have it working now, I just need to convert the controls to the accelerometer on the mobile.
I'm sure there is a better way to do this, maybe Jean can let me know, but I just simply copied my run forward twice, made one run_up and set the offset in mecanim to 45° the other run_down offset it to -45° Then made a FSM to check for an input and used Get Vector3XYZ to store the input I get into a Float variable.  Then multiplied this value by 100 and set that to the Animator Float parameter (Direction)

What I'm trying to do now is try and check for an Input from the accelerometer (Y axis) to use the rotation. It's tricky though, because the magnitude value was used in a Float Compare to trigger the turning FSM.

Quick update, I have it working now.  I just have a FSM updating the Y axis and another FSM using that variable for rotation. And one more setting the Direction to 0, so when the player goes up/down, it goes back to 0.

Jean, is the way I'm doing it OK, or is there a better way?

« Last Edit: February 22, 2014, 04:24:26 PM by Splankton »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Stealth. Jeans example pulled apart to change it a little.
« Reply #5 on: February 26, 2014, 01:15:46 PM »
Hi,

 Nothing wrong with what I am picturing the way you explained it, several FSM to do one feature is very common.

bye,

 Jean