News: Enjoy our Christmas offer 30% off on our latest package Tower Defense Level Kit http://u3d.as/m7h

  • October 18, 2018, 05:32:49 PM

Login with username, password and session length

Author Topic: Third person controller with Easy Touch  (Read 5213 times)

Offline Relja

  • Newbie
  • *
  • Posts: 5
Third person controller with Easy Touch
« on: November 18, 2013, 01:07:02 PM »
Hi all.

I'm a 3D artist with next to no knowledge in coding, and I'm working on a maze game in unity using third person controller and third person camera. Got everything to work on desktop with WASD keys but the game is ment for mobile, so I couldn't make it work on touchscreens on my own. I purchased Easy Touch hoping that there will be some easy prefab solution with no scripting that I can just implement as a replacement for keyboard controls but that doesn't seem to be the case. I now managed to connect the joystick to translate game character but now it's not using third person controller and therefore there are no idle and run animations displayed.

Am I missing something plainly obvious or is there no way to connect this to third person controller without scripting.

Offline Nicolas

  • Administrator
  • Hero Member
  • *****
  • Posts: 792
Re: Third person controller with Easy Touch
« Reply #1 on: November 18, 2013, 01:36:52 PM »
Hi Relja,

On the latest release, you can control the joystick with key. To do that you must :

1 - Control your game with joystick

2 Add & new script
  Test the platform
   If MAC or pc hide the joystick
        use  On_Manual(Vector2 movement)

Simple script
Code: [Select]
public class ManualControl : MonoBehaviour {

public EasyJoystick Joystick;


// Update is called once per frame
void Update () {

if (Application.platform == RuntimePlatform.WindowsPlayer){
if (Joystick != null ){
Joystick.visible = false;
Joystick.On_Manual(new Vector2(Input.GetAxis ("Horizontal"), Input.GetAxis("Vertical")));
}
}
}
}

Nicolas

Offline Nicolas

  • Administrator
  • Hero Member
  • *****
  • Posts: 792
Re: Third person controller with Easy Touch
« Reply #2 on: November 18, 2013, 01:41:10 PM »
If you want to launch animation look at joystick example. You have just to subscribe to event and launch animation

Nicolas

Offline Relja

  • Newbie
  • *
  • Posts: 5
Re: Third person controller with Easy Touch
« Reply #3 on: November 18, 2013, 01:55:30 PM »
Thanks for the reply. None of this helps me unfortinately since as I said I don't code so I don't know how to subscribe an event or use On_Manual(Vector2 movement)  :)

I tried replicating everything from Joystick and button example (since that's the movement that I need) but character still doesn't have it's animation and moves through walls. Just to see if I'm getting something wrong in my scene, I just replaced your character with mine in example scene, and it doesn't animate Run cycle (just idle animation and that's automatic). It gives me this message:

NullReferenceException: Object reference not set to an instance of an object
ETPlayer.Start () (at Assets/EasyTouch/Example/C# Example/Example for EasyButton/ETPlayer.cs:41)

NullReferenceException
ETPlayer.On_JoystickMove (.MovingJoystick move) (at Assets/EasyTouch/Example/C# Example/Example for EasyButton/ETPlayer.cs:51)
EasyJoystick.CreateEvent (MessageName message) (at Assets/Plugins/EasyJoystick.cs:1076)
EasyJoystick.UpdateJoystick () (at Assets/Plugins/EasyJoystick.cs:928)
EasyJoystick.Update () (at Assets/Plugins/EasyJoystick.cs:838)


NullReferenceException
ETPlayer.On_JoystickMoveEnd (.MovingJoystick move) (at Assets/EasyTouch/Example/C# Example/Example for EasyButton/ETPlayer.cs:57)
EasyJoystick.CreateEvent (MessageName message) (at Assets/Plugins/EasyJoystick.cs:1081)
EasyJoystick.UpdateJoystick () (at Assets/Plugins/EasyJoystick.cs:938)
EasyJoystick.Update () (at Assets/Plugins/EasyJoystick.cs:838)
« Last Edit: November 18, 2013, 02:41:33 PM by Relja »

Offline Relja

  • Newbie
  • *
  • Posts: 5
Re: Third person controller with Easy Touch
« Reply #4 on: November 18, 2013, 02:46:41 PM »
Ok I found what was wrong when I replaced my character with yours in example scene. It needed to be renamed "Model" to match the description in your ETPlayer script. Now it displays animation. So that's a progress :) But it still walks through walls. How can I fix that?

Offline Nicolas

  • Administrator
  • Hero Member
  • *****
  • Posts: 792
Re: Third person controller with Easy Touch
« Reply #5 on: November 20, 2013, 11:26:02 AM »
You must some colliders on your walls

Nicolas