Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: divertoso on November 06, 2012, 08:20:48 AM

Title: make a simple mobile controller
Post by: divertoso on November 06, 2012, 08:20:48 AM
hi guys

i want to make a simple mobile controller,
(something like this:
)

i have a 'controller simple move' work's fine with keyboard, my dubt is:

how can i associate my GUItexture with a "controller simple move" of my capsule ?
(using a GUITexture like a button...)



tkz

lokk the image:
Title: Re: make a simple mobile controller
Post by: jeanfabre on November 06, 2012, 10:52:30 AM
Hi,

 Here we go, please find attached a simple controller working with gui texture together with the playmaker simple move controller. I hope this is what you want, else I have a joystick controller ( but from the screenshot I can see you have it in your project, so I assume you have played with it already)

 It's also a very good example to illustre this meta data fsm I keep mentioning in many threads.

basically, here we still want an input to range from -1 to 1, but since we have two distinct elements for the same input axis, meta data fits perfectly. We have a Controller Fsm with the only purpose of hosting the horizontal and vertical input that complies with input axis standard range. attached this this Controller, we have each guitexture that actually set the input variable in that Controller. So each input Fsm do not host the input value, instead it's a higher level of abstraction that other fsm component can talk and query from without worrying about how actually this is executed visually.

 This also gives a lot of room for things like incremental input values, here we can only have -1 0 or 1, but we could lerp the value to have smoother inputs if wanted.

 This meta data technic also hilite making Fsm and powerfull features without necessarly using global variables. I am not against global variables, but I think they are many times mis used because the developer is missing some key concepts to create Fsm and complex features without it ( and no necessarly more complex as a result of not using globals). The direct benefit is the ability to create prefabs, self contained features that can be reused efficiently.



If you have any questions, let me know.


bye,

 Jean
Title: Re: make a simple mobile controller
Post by: divertoso on November 06, 2012, 06:55:33 PM
Hi,

 Here we go, please find attached a simple controller working with gui texture together with the playmaker simple move controller. I hope this is what you want, else I have a joystick controller ( but from the screenshot I can see you have it in your project, so I assume you have played with it already)

 It's also a very good example to illustre this meta data fsm I keep mentioning in many threads.

basically, here we still want an input to range from -1 to 1, but since we have two distinct elements for the same input axis, meta data fits perfectly. We have a Controller Fsm with the only purpose of hosting the horizontal and vertical input that complies with input axis standard range. attached this this Controller, we have each guitexture that actually set the input variable in that Controller. So each input Fsm do not host the input value, instead it's a higher level of abstraction that other fsm component can talk and query from without worrying about how actually this is executed visually.

 This also gives a lot of room for things like incremental input values, here we can only have -1 0 or 1, but we could lerp the value to have smoother inputs if wanted.

 This meta data technic also hilite making Fsm and powerfull features without necessarly using global variables. I am not against global variables, but I think they are many times mis used because the developer is missing some key concepts to create Fsm and complex features without it ( and no necessarly more complex as a result of not using globals). The direct benefit is the ability to create prefabs, self contained features that can be reused efficiently.



If you have any questions, let me know.


bye,

 Jean

Thank you Jean, this .unitypackage example have a nice sample, i'll study this...