playMaker

Author Topic: Making a First Person Controller  (Read 28053 times)

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 12351
  • Official Playmaker Support
    • View Profile
Re: Making a First Person Controller
« Reply #15 on: November 18, 2013, 12:18:19 AM »
Hi,

 You may encounter some gimbal lock here.

Are you clamping absolute values? if so, I would suggest doing it otherwise:

maintain a float that represents the angle since the default position. As you tilt you add the delta rotation to this angle, and you check that this angle is between 60 and -60 and if not you don't rotate, else you rotate.

 this way you can rotate safely your camera withotu gimbal lock and you use a safe way to detect limits, withotu relying on angles passing the 360 range and falling back to 0 etc etc.

bye,

 Jean

gheeDough

  • Playmaker Newbie
  • *
  • Posts: 34
    • View Profile
    • indie game school
Re: Making a First Person Controller
« Reply #16 on: December 01, 2013, 03:59:45 PM »
Any chance of doing the same for a 2D character controller?? I'm struggling...  ::)

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 12351
  • Official Playmaker Support
    • View Profile
Re: Making a First Person Controller
« Reply #17 on: December 02, 2013, 12:39:04 AM »
Hi,

 yes, this is coming soon with the Unity 2d platform port to PlayMaker.

bye,

 Jean

gheeDough

  • Playmaker Newbie
  • *
  • Posts: 34
    • View Profile
    • indie game school
Re: Making a First Person Controller
« Reply #18 on: December 13, 2013, 03:28:35 AM »
Awesome, thanks!  ;D

JonathanBurroughs

  • Junior Playmaker
  • **
  • Posts: 73
  • Some kind of independent game developer
    • View Profile
    • @HiFiHair
Re: Making a First Person Controller
« Reply #19 on: March 26, 2014, 05:46:24 AM »
Indirectly this has proved super useful in finding a way to trigger turn animations on my player character. Just using Get Axis on the X Mouse input to drive an Animator Controller Float. Boom! Thank you guys so much.

coffeeANDsoda

  • Hero Member
  • *****
  • Posts: 609
    • View Profile
Re: Making a First Person Controller
« Reply #20 on: September 07, 2014, 08:12:42 PM »
Somebody asked about making a first person controller in Playmaker on the Unity forums, so I thought I'd reproduce the answer here:

Note, if the standard first person controller in Unity works for you there's no need to reinvent the wheel! But this might still be interesting as an example of how to use Get Axis and Transform actions...

A simple first person controller made with actions (thrown together in 5 minutes):



Put this on a capsule with a Character Controller component and an attached camera (similar to the setup for the built-in Unity first person controller).

In practice I'd probably split the movement and mouselook into 2 FSMs so they can have their own states. (e.g. Lock movement, but still look around; or take control over the camera to lock onto a target etc.).

Also you should limit the tilt, and use variables for move/pan/tilt speeds so you can expose them in the FSM Inspector and have a nice front end for your controller (Move Speed, Pan Speed, Tilt Speed, Max Tilt...).

When I have a moment I'll try to wrap this up into a nice sample and template.

Old thread but I've wondered how a person would make one without using the standard premade FPconrtoller script.

C.J.Geringer

  • Playmaker Newbie
  • *
  • Posts: 43
    • View Profile
Re: Making a First Person Controller
« Reply #21 on: December 09, 2014, 04:01:36 PM »
I can´t see the example in the first post for some reason, anyone else have the same problem?

coffeeANDsoda

  • Hero Member
  • *****
  • Posts: 609
    • View Profile
Re: Making a First Person Controller
« Reply #22 on: January 08, 2015, 04:00:57 PM »
I can´t see the example in the first post for some reason, anyone else have the same problem?

Me to, I'd just like to see a video tutorial or pics for reference.

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 12351
  • Official Playmaker Support
    • View Profile
Re: Making a First Person Controller
« Reply #23 on: January 13, 2015, 12:54:05 AM »
Hi,

 uhm, yes odd, I have contacted Alex on this, he will be able to track this.

 Bye,

 Jean

coffeeANDsoda

  • Hero Member
  • *****
  • Posts: 609
    • View Profile
Re: Making a First Person Controller
« Reply #24 on: January 13, 2015, 01:04:06 AM »
Hi,

 uhm, yes odd, I have contacted Alex on this, he will be able to track this.

 Bye,

 Jean

Good to know. Currently right now I have to use the first person controller pre fab with C# scripts, and I'd like to reduce the amount of pre made scripts for practice.

coffeeANDsoda

  • Hero Member
  • *****
  • Posts: 609
    • View Profile
Re: Making a First Person Controller
« Reply #25 on: February 17, 2015, 03:30:03 PM »
What's the update on this Jean?