playMaker

Author Topic: GetKey transition? Is there a way to fake it?  (Read 2741 times)

WeeGee9000

  • Playmaker Newbie
  • *
  • Posts: 4
GetKey transition? Is there a way to fake it?
« on: December 22, 2013, 12:25:17 PM »
Here is what i am trying to do:

The cursor is hidden and locked. I can look around in the envorinment as much as i want.
When i press the Q key, the cursor shows and unlocks but i can't look around.

I have been trying to achieve this for half an hour through coding but i couldn't. I've been trying to make it in PlayMaker, but it doesn't seem to be any kind of "GetKey" transition between states. Is there a way to fake it?

WeeGee9000

  • Playmaker Newbie
  • *
  • Posts: 4
Re: GetKey transition? Is there a way to fake it?
« Reply #1 on: December 23, 2013, 03:59:28 PM »
BUMP

Lane

  • Administrator
  • Hero Member
  • *****
  • Posts: 2511
  • Mender of the past
    • Cleverous
Re: GetKey transition? Is there a way to fake it?
« Reply #2 on: December 23, 2013, 04:44:23 PM »
You just have to disable your script that is rotating the camera, use a Get Key action to transition to another state, use Set Mouse Cursor action to unlock the mouse, then use another Get Key action to return to the other state where you lock the cursor and enable the camera look script again.

The Oomph Kit does this when entering/exiting the Hangar Shop, you can also press R to look around the ship so there are a couple of examples in that package for reference.
Products by Cleverous
|| Vault Core : Database
|| Vault Inventory : Multiplayer Inventory
|| Vault Attributes : Character Stats
|| That Hurt! : Dmg Floaties
|| Quinn : 3D

WeeGee9000

  • Playmaker Newbie
  • *
  • Posts: 4
Re: GetKey transition? Is there a way to fake it?
« Reply #3 on: December 24, 2013, 01:08:17 AM »
Ok so I tried to use the GetKey state with the "Q" key but then it said?

' "Q" its not a hotkey registered in the Unity Input Manager '

Or something like that.

EDIT: BTW, why does it ask to store the result in the GetKey action? Why would that be useful? Sorry, i am a huge noob in PlayMaker, i bought it the same day i started this post :D
« Last Edit: December 24, 2013, 01:15:55 AM by WeeGee9000 »

Lane

  • Administrator
  • Hero Member
  • *****
  • Posts: 2511
  • Mender of the past
    • Cleverous
Re: GetKey transition? Is there a way to fake it?
« Reply #4 on: December 24, 2013, 06:42:31 AM »
Thats Get Button, which uses the player input preferences. It's looking for a setting named "Q", not a Key named Q.

Try it with Get Key.

It offers to store the result because if the key is down then it could be identified with a boolean, true/false or on/off.
Products by Cleverous
|| Vault Core : Database
|| Vault Inventory : Multiplayer Inventory
|| Vault Attributes : Character Stats
|| That Hurt! : Dmg Floaties
|| Quinn : 3D

WeeGee9000

  • Playmaker Newbie
  • *
  • Posts: 4
Re: GetKey transition? Is there a way to fake it?
« Reply #5 on: December 24, 2013, 09:28:03 PM »
Ok, here is what i tried to do:

In state 1 (cursor off) -> Set Mouse Cursor with the GetKey underneath. Placed a FINISHED transition to connect state 1 to state 2

In state 2 (cursor on) -> Same as above.

But both of them use the same "Store in" variable.

Also, it does nothing when i press Q, but the cursor is locked and disabled :D

Lane

  • Administrator
  • Hero Member
  • *****
  • Posts: 2511
  • Mender of the past
    • Cleverous
Re: GetKey transition? Is there a way to fake it?
« Reply #6 on: December 24, 2013, 09:56:58 PM »
FINISHED is an internal transition, it will fire if every action in the state is done regardless if you told it to or not. If you want to control when transitions are made then use unique transitions you've put in yourself.

For something like this I typically use Get Key, store the status in a bool, use Bool Test to check for when its true, send an event to another state, then change the status of the mouse lock or whatever I want in there and do the same to switch back.
Products by Cleverous
|| Vault Core : Database
|| Vault Inventory : Multiplayer Inventory
|| Vault Attributes : Character Stats
|| That Hurt! : Dmg Floaties
|| Quinn : 3D