playMaker

Author Topic: Switching Controller [SOLVED]  (Read 2796 times)

kinetiknz

  • Junior Playmaker
  • **
  • Posts: 85
Switching Controller [SOLVED]
« on: November 10, 2011, 12:27:42 AM »
Hi I have a simple scene with a house, a first person controller and another camera that looks 'down' on the scene. I am trying to figure out how I can switch between the controlling systems easily? I have previously built the system using 2 scenes and just moving between them, but I now need to stay within 1 scene.

The down looking camera is a simple setup using WASD to pan around and the scroll wheel to zoom in/out.

Am I looking at re-binding all the relevant keys back and forth whenever I change camera/controller?

Any advice is really appreciated. Thanks
« Last Edit: November 23, 2011, 12:23:56 AM by kinetiknz »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Switching Controller
« Reply #1 on: November 10, 2011, 04:57:19 AM »
Hi,

What you need to is a wrapper of the inputs so that you can redirect the input from the user to the right "controller". I do that for my excavator simulation ( www.fabrejean.net/projects/excavator/) when you switch from the outside view and the cabin view ( as well as multi way binding of inputs so that you can also control the cranes with sliders and when you pres keys the sliders moves accordingly). None of my "controller" in the game actually reference an user input axis, they all reference this wrapper instead.

 So : have a fsm responsible to receive your user input, only this fsm must receive it. He will also be responsible for sending events to fsm willing to play with this input. It will also be responsible  for storing your custom inputs values ( ranging from -1 to 1 like normal user inputs). you could store them in global vars, then from other fsm, use them global vars as inputs.

If you are using actions that explicitly reference user inputs, then you'll need to create similar custom actions that use a var instead of a reference to an axis ( I am thinking of getAxisEvent, or getAxis for example). If you need for that, let me know, and I'll build the custom action that you need.

Does that make sense?

 Bye,

 Jean

kinetiknz

  • Junior Playmaker
  • **
  • Posts: 85
Re: Switching Controller
« Reply #2 on: November 21, 2011, 01:25:40 AM »
Hi Jean, thanks alot for the reply. I am attempting what you said now. After using PM for about a week I 'get it' now! I am loving it, and have made FSM's for a gui and a bunch of functions for my app.

Thanks again, I really appreciate the thorough replies.
Matt.S

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Switching Controller [SOLVED]
« Reply #3 on: November 23, 2011, 09:58:50 AM »
Hi,

 Anytime! this is very positive to share your doubts and ask for directions because design patterns in Playmaker is something that has yet to take a "formal" shape or be standards because of its visual nature and event driven system, it is very different from most of the thing you can learn with scripting, so the more we discuss them the better.


 Bye,

 Jean