playMaker

Author Topic: Changing the run speed of the Unity standard assets FPS Controller  (Read 1503 times)

Fonkles

  • Playmaker Newbie
  • *
  • Posts: 10
    • View Profile
Hello Playmakers,

My question is exactly that of the title, Can I change the run speed of the First Person controller with a Playmaker action?

I cannot access it with a 'Get Component' action. I have tried to use the 'Send Message' action but I am unable to find the correct name that corresponds with the script I think.

Would it be more work but easier to create my own FPS controller instead of trying to get this to work?

I hope you can help me out.

Fonkles

joduffy

  • Full Member
  • ***
  • Posts: 120
  • Here to help
    • View Profile
    • Online Playmaker Courses
Re: Changing the run speed of the Unity standard assets FPS Controller
« Reply #1 on: May 10, 2016, 12:59:08 PM »
Hey dude,

Drag and drop the component from the inspector window into your FSM. So where the actions you are using are displayed for the state. Drag and drop in there and you will get the option to set or get property.

I think that might do the trick.
- Jonathan

Online Playmaker Courses available at:
http://courses.jonathanoduffy.com

“I want the world to be a better place because I was here.”  -  Will Smith

joduffy

  • Full Member
  • ***
  • Posts: 120
  • Here to help
    • View Profile
    • Online Playmaker Courses
Re: Changing the run speed of the Unity standard assets FPS Controller
« Reply #2 on: May 10, 2016, 04:22:19 PM »
Hey dude,

I was going to record a video for you, and still can if you want, but I figured the screenshots would be able to explain it all.

Pretty much the set and get property allows you to work around any actions you need that aren't in playmaker.
- Jonathan

Online Playmaker Courses available at:
http://courses.jonathanoduffy.com

“I want the world to be a better place because I was here.”  -  Will Smith

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 12351
  • Official Playmaker Support
    • View Profile
Re: Changing the run speed of the Unity standard assets FPS Controller
« Reply #3 on: May 10, 2016, 11:27:44 PM »
Hi,

 Uhm, maybe we should do some dedicated custom actions for this?

If no one step up on this before the end of the week, please ping me I'll do them early next week.

Bye,

 Jean

Fonkles

  • Playmaker Newbie
  • *
  • Posts: 10
    • View Profile
Re: Changing the run speed of the Unity standard assets FPS Controller
« Reply #4 on: May 11, 2016, 05:39:06 AM »
Hey Joduffy and Jeanfabre,

Thanks for the reply!

My first instinct was the 'get' and 'set property' as well but the components to choose from within this action are limited. I must be missing a simple thing here but I cannot find it at the moment.

I attached one screenshot to show the limited options within the 'get' and 'set property'. This is the same for both FPS controllers.

« Last Edit: May 11, 2016, 05:43:51 AM by Fonkles »

joduffy

  • Full Member
  • ***
  • Posts: 120
  • Here to help
    • View Profile
    • Online Playmaker Courses
Re: Changing the run speed of the Unity standard assets FPS Controller
« Reply #5 on: May 11, 2016, 06:13:58 AM »
Hi dude,

Have your dragged and dropped the script or the gameobject into the set property action? You get different options for each one depending on what you use?

Jean is probably right in that we should have some standard actions for this. I'll see if I can free up some time to work on a couple.
- Jonathan

Online Playmaker Courses available at:
http://courses.jonathanoduffy.com

“I want the world to be a better place because I was here.”  -  Will Smith

Fonkles

  • Playmaker Newbie
  • *
  • Posts: 10
    • View Profile
Re: Changing the run speed of the Unity standard assets FPS Controller
« Reply #6 on: May 11, 2016, 06:28:13 AM »
Hey Joduffy,

I have done both, with the gameobject and with the script. The options differ between gameobject and script but nothing gives me the option like the one showing in your screenshot, i.e.; Forward running speed property.

I have attached a few screenshots to show what I mean. The first one is with the FPS rigidbody script, the second with the FPS controller game object and the third with the FPS controller script.


joduffy

  • Full Member
  • ***
  • Posts: 120
  • Here to help
    • View Profile
    • Online Playmaker Courses
Re: Changing the run speed of the Unity standard assets FPS Controller
« Reply #7 on: May 11, 2016, 06:47:26 AM »
Thats strange.

What version of playmaker and unity are you using?

I can make a video for you in the morning (about to head to bed now) to show you how it is working from my end.

Have you tried dragging and dropping the RigidBodyFirstPersonController component directly into the action tab? It should offer you the option of the set or get property and that might include the proper list. But the other way should have worked.
- Jonathan

Online Playmaker Courses available at:
http://courses.jonathanoduffy.com

“I want the world to be a better place because I was here.”  -  Will Smith

Fonkles

  • Playmaker Newbie
  • *
  • Posts: 10
    • View Profile
Re: Changing the run speed of the Unity standard assets FPS Controller
« Reply #8 on: May 11, 2016, 07:06:13 AM »
I am using Unity Version 5.3.4f1 Personal and Playmaker version 1.7.8.4. And that was my mistake.

I have been creating a few prototype projects for my graduation these last weeks so I must have made a mistake when I was importing the correct version of playmaker. When you asked which version I was using I quickly checked and tried it out.

Now I am on Unity version 5.3.4f1 with playmaker version 1.8.0.f43 and I can acces the forward speed on the FPS rigidbody controller with the 'set & get properties'. So my problem should be fixed now.

A question out of interest though, It seems I cannot acces the speed settings on the Normal FPS controller but only on the rigidbody FPS controller. Do you know why that is?

Much thanks for the time and help!

joduffy

  • Full Member
  • ***
  • Posts: 120
  • Here to help
    • View Profile
    • Online Playmaker Courses
Re: Changing the run speed of the Unity standard assets FPS Controller
« Reply #9 on: May 11, 2016, 09:00:48 PM »
Im glad you got it sorted out dude. I hope your graduation projects go well.

That is interesting about the two different controllers. I looked into it and turns out to be the style of programming being used.

RigidbodyFirstPersonController.cs uses public variables which provides you access in playmaker through the get and set property actions:

Code: [Select]
public float ForwardSpeed = 8.0f;   // Speed when walking forward
public float BackwardSpeed = 4.0f;  // Speed when walking backwards
public float StrafeSpeed = 4.0f;    // Speed when walking sideways
public float RunMultiplier = 2.0f;   // Speed when sprinting

Whereas the FirstPersonController.cs uses private variables to stop other scripts adjusting them. So thats why playmakers get and set property actions don't work but why you can adjust the values in the inspector window.

Code: [Select]
[SerializeField] private bool m_IsWalking;
[SerializeField] private float m_WalkSpeed;
[SerializeField] private float m_RunSpeed;
[SerializeField] [Range(0f, 1f)] private float m_RunstepLenghten;
[SerializeField] private float m_JumpSpeed;

If you wanted to use any of the variables in the FirstPersonController.cs you can probably edit the script and change the private variables in public and it should work.
- Jonathan

Online Playmaker Courses available at:
http://courses.jonathanoduffy.com

“I want the world to be a better place because I was here.”  -  Will Smith

Fonkles

  • Playmaker Newbie
  • *
  • Posts: 10
    • View Profile
Re: Changing the run speed of the Unity standard assets FPS Controller
« Reply #10 on: May 12, 2016, 02:31:59 AM »
Hey Joduffy,

First thanks for the advice, got some miles to go for my projects but this is at least one hurdle less.

Thanks also for the clarification, I sort of guessed it was the private variables but was not sure.


drown

  • Playmaker Newbie
  • *
  • Posts: 20
    • View Profile
BUMP: Changing the run speed of the Unity standard assets FPS Controller
« Reply #11 on: January 26, 2017, 10:49:37 AM »
Hey just letting you guys know that I have the very same issue on Unity 5.5.0f2 with Playmaker 1.8.3 .

I want to change the footstep sounds of my First Person Controller when he enters certain areas but I cannot control anything after dragging the script into the FSM.

https://s29.postimg.org/4zomj8etz/Playmaker_issue_FPS.png

« Last Edit: January 26, 2017, 10:51:49 AM by drown »