playMaker

Author Topic: Click to Move  (Read 2351 times)

johnflesh

  • Playmaker Newbie
  • *
  • Posts: 10
Click to Move
« on: October 11, 2013, 11:20:46 PM »
Hello everyone,

I was looking to get some help with click-to-move, top-down Diablo/Torchlight style gaming. I come from a modeling/artistic background, so a lot of the code is jibberish to me. But I'm trying, and I'm learning a lot.

I currently have a great setup going so far, but it lacks quite a bit of the finishing touches - and I've tried a lot of the tutorials and thread reading here and have found very little. Either I don't know what to look for, or I'm not sure what I'm reading.

So far my setup is a character controller FSM and camera FSM setup similar to the ClickToMove demo provided by Playmaker. I have walk, run, and idle animations, all working perfectly. I'm also using the Construction worker 3rd person model as my character for the time being.

1. Keeping my character on the ground:
Currently my character walks great on a flat plane but when I had height whatsoever to the terrain, he tends to walk directly to the click point, even if that means walking "through the air."

I do not have gravity set up and I'm not using a RigidBody, mainly because I'm not sure how to proceed getting this fixed.

How do I remedy this issue? It's seem rather common on these forums by doing a simple search but the answers are either not working, or are untenable for my purposes.

2. ClicktoMove continuously while holding mouse key:
The character moves great when I click, but when I hold the mouse key, it only tracks to the last actual click. As noted in Diablo games, if I hold the key it should follow the cursor if I hold the key down.

How do I add that?

3. Moving around and/or colliding with objects:
When moving my character behind an object, the character tends to walk directly
through the object even though there is a Character Controller and a Collider on the object (in this case a simple cube).

I've read a bit about this, in that it's pretty difficult to achieve, but I want to.

   a. How do I get the character to collide with objects?
   b. How do I get the character to see the path around an object?


I hate to be a bother to the Playmaker community, but I'll eventually get better at this.

I of course appreciate any help on these issues. Thank you for your time.
« Last Edit: October 11, 2013, 11:22:26 PM by johnflesh »

Lane

  • Administrator
  • Hero Member
  • *****
  • Posts: 2511
  • Mender of the past
    • Cleverous
Re: Click to Move
« Reply #1 on: October 13, 2013, 10:17:32 AM »
1. and 3. are solved by implementing Pathfinding, Unity 4.2+ allows Navmesh usage in Free and there are some A* solutions for free floating around.

2. would also be resolved when you implement pathfinding, you'll just send a new command to build a path every few frames and update the character's current path constantly as long as the mouse button is down.
Products by Cleverous
|| Vault Core : Database
|| Vault Inventory : Multiplayer Inventory
|| Vault Attributes : Character Stats
|| That Hurt! : Dmg Floaties
|| Quinn : 3D

johnflesh

  • Playmaker Newbie
  • *
  • Posts: 10
Re: Click to Move
« Reply #2 on: October 18, 2013, 06:05:51 PM »
Thank you Lane,

I'm going to look into Pathfinding a bit more. Currently I've found a way but its an external script (outside of Playmaker) that deals with NavMeshes and A*Pathfinding. I'll see if I can duplicate that within Playmaker.

Thanks again.