playMaker

Author Topic: Mouse pick tutorial trouble  (Read 5625 times)

Xerilon

  • Playmaker Newbie
  • *
  • Posts: 11
Mouse pick tutorial trouble
« on: October 22, 2014, 06:17:29 PM »
I am trying the simplest mouse pick tutorial for a mouse pick setup that uses the Bool Test action, but the the bool test is always False! The environment has colliders so the mouse pick should be there, but it doesn't work for some reason.

I have tried setting the bool as initially True, and that changes things a little, but makes the Target object only jump to a given position once and locks in place, and that is not the position where I clicked.

I have tried a pure setup in a blank project and it works fine there, but not in my game project which is now bigger. The game project has only one camera as well, so  I can't see what could be the problem...

Any tips to a noob?

jess84

  • Hero Member
  • *****
  • Posts: 515
Re: Mouse pick tutorial trouble
« Reply #1 on: October 22, 2014, 07:29:24 PM »
Screengrab of your FSM/action?

Xerilon

  • Playmaker Newbie
  • *
  • Posts: 11
Re: Mouse pick tutorial trouble
« Reply #2 on: October 23, 2014, 04:14:21 AM »
Here :) Whenever I click on the ground it always loops the Cancel and never goes to SetTarget

jess84

  • Hero Member
  • *****
  • Posts: 515
Re: Mouse pick tutorial trouble
« Reply #3 on: October 23, 2014, 10:51:48 AM »
I'm guessing it's because they're running at the same time, so when it gets to that state, it's checking the bool straight away - and will always be false.

What happens if you set that state as an Action Sequence state?

Xerilon

  • Playmaker Newbie
  • *
  • Posts: 11
Re: Mouse pick tutorial trouble
« Reply #4 on: October 23, 2014, 11:46:03 AM »
Hmm I guess I'll have to ask how to do just that...

I tried putting a "Sequence Event" between the MousePick and the BoolTest actions.
This gave funny results:

At delay 0
The FSM checks True at the first click.
The Target object jumps to the middle of the screen (I guess that is where the camera is pointing).
Then the FSM checks True and False at every other click after that, on and off, and the Target objects is stuck in the center position and does not move to where I click.

At delay 1 and up
The FSM checks False as usual at every click.

It all behaves so weird! As said it works perfect in a clean project/scene as seen in the tutorial video, and I could maybe export it as a package and then import it into my game project?

jess84

  • Hero Member
  • *****
  • Posts: 515
Re: Mouse pick tutorial trouble
« Reply #5 on: October 23, 2014, 01:14:47 PM »
Click that, and choose Action Sequence on the dropdown.

If you select that, your actions in a state are run in order, rather than at the same time.

Xerilon

  • Playmaker Newbie
  • *
  • Posts: 11
Re: Mouse pick tutorial trouble
« Reply #6 on: October 23, 2014, 01:19:25 PM »
Ah, thank you for that tip,

but, alas, it didn't make any difference...

jess84

  • Hero Member
  • *****
  • Posts: 515
Re: Mouse pick tutorial trouble
« Reply #7 on: October 23, 2014, 01:23:27 PM »
What about if you add a Global Transition 'Mouse Down' directly to state with the Mouse Pick event?  Right click on your state > choose Add Global Transition > choose System Events > Mouse Down. 

Disable your action in the start state.

If you test that and it works, that should help isolate the problem.

Lane

  • Administrator
  • Hero Member
  • *****
  • Posts: 2511
  • Mender of the past
    • Cleverous
Re: Mouse pick tutorial trouble
« Reply #8 on: October 23, 2014, 01:44:58 PM »
There's probably nothing wrong with your FSM, its more likely that something in the scene is interfering with the pick.

You're not using a Layer Mask. Is anything directly in front of your camera?
Products by Cleverous
|| Vault Core : Database
|| Vault Inventory : Multiplayer Inventory
|| Vault Attributes : Character Stats
|| That Hurt! : Dmg Floaties
|| Quinn : 3D

Xerilon

  • Playmaker Newbie
  • *
  • Posts: 11
Re: Mouse pick tutorial trouble
« Reply #9 on: October 23, 2014, 02:19:41 PM »
Yeah I think so too... Nothing in front of the camera, but it has a "smooth follow" to the character that I can walk around with. No other objects relate to it either, and  everything is on the same layer as I don't use layers at the moment.

Lane

  • Administrator
  • Hero Member
  • *****
  • Posts: 2511
  • Mender of the past
    • Cleverous
Re: Mouse pick tutorial trouble
« Reply #10 on: October 23, 2014, 02:35:46 PM »
Have you tried this in a blank scene (in your project) with just a simple cube and nothing in the background? You can test it pretty easily there and then migrate it to a more complex scene once you confirm its working.

Other than infinite loop possibilities, what you have should cycle fine.
Products by Cleverous
|| Vault Core : Database
|| Vault Inventory : Multiplayer Inventory
|| Vault Attributes : Character Stats
|| That Hurt! : Dmg Floaties
|| Quinn : 3D

Xerilon

  • Playmaker Newbie
  • *
  • Posts: 11
Re: Mouse pick tutorial trouble
« Reply #11 on: October 23, 2014, 03:22:08 PM »
Good idea :) I tried setting up a new basic scene in a few seconds and it worked perfectly there. I took the Empty with the mousepickFSM and threw it into a prefab and simply took the prefab into the complex scene. That stopped it from working and it gave the same result as the old one. And yes, I edited the prefab to fit the big scene.
Then, just to try, I started deleting groups of objects trying to run it inbetween until I reduced the complex scene to the same size as the basic scene with only one difference: Terrain. Still not working.

Could it be the existence of the terrain that is causing all this, or is perhaps the scene broken in some way?

Current objects:
MousePicker (empty with FSM)
Directional Light
Main Camera
Target (cube for the mouse picker)
Terrain (with a heightmap and a few textures and details painted on)

Everything is untagged and on default layer
Bool Test still checks False on every click...Bah!

jess84

  • Hero Member
  • *****
  • Posts: 515
Re: Mouse pick tutorial trouble
« Reply #12 on: October 23, 2014, 03:50:03 PM »
What about if you put the terrain object on a layer? (and then use the layer mask to specify)

Also, does the terrain have a collider?

Xerilon

  • Playmaker Newbie
  • *
  • Posts: 11
Re: Mouse pick tutorial trouble
« Reply #13 on: October 23, 2014, 06:35:10 PM »
Good tip as well, but it didn't work either..
The terrain has a collider, of course, as my character walked on it before I deleted him ;)

I think I will try the other way around tomorrow, by putting the terrain in a prefab and bringing it over to the scene that worked