Moving character with joystick (Android)

Hey all!
I´ve used the Joystick.js (from Penelope) script and added it to my test scene successfully, and it works moving
the left and right pads on my Galaxy S2 just great, as intended.

However, I now want them to control the character too, but the script currently on the character is in C#, its basically only
the moving and jumping codes I want to add so they respond to the joystick, the moving using the left pad/joystick and jumping using the right pad/joystick.

Do I understand correctly that you just want to change mainly these three codes below in the C# script to react to the joysticks? More specifically:
Input.GetAxis(“Horizontal”) * this.m_Force;
Input.GetAxis(“Vertical”) * this.m_Force;
Input.GetButtonDown(“Jump”) == true this.Grounded >= 1

The Penelope tutorial uses JS code so I have no clue how to continue at the moment.

Below is the specific part of of the character script that controlls its movements as of now.
Im a bit new to this so haven´t found out how yet, if anyone could help me out or point to
some helpful source I would appreciate it.

public float HorizontalForce
	{
		get
		{
			// Return the calculated horizontal force
			return Input.GetAxis("Horizontal") * this.m_Force;
		}
	}
	
	
	/*
	 * Public vertical force accessor
	 */
	public float VerticalForce
	{
		get
		{
			// Return the caluclated vertical force
			return Input.GetAxis("Vertical") * this.m_Force;
		}
	}
	
	
	/*
	 * Private update class method
	 */
	private void Update()
	{
		// Check if jump button was pressed and ridig body is grounded
		if(Input.GetButtonDown("Jump") == true  this.Grounded >= 1)
		{
			// Set jumping member value;
			this.m_Jumping = true;
		}
	}

Bump!

i cant script in c# so im proboly no help but with those joysticks then are a actual object and dont output a axis so you must put a variable in, in javascript its like this: var joystick : joystick; it is just a varible that can be a object taged as a joystick then instead of getting a axis you must get the position of the joystick wich is done like so(in javascript i think its similar) if you wanto go side ways you can check if the joystick is ferter horizontal then virtical by this: if ( joystick.position.x >=joystick.position.y) then it is clear that you wanto move horizontal but wich way(never fear it can be fixed:)) then you need to check if its bigger then 0 you move right if not its left this is done like so if(joystick.position.x>=0) and if(joystick.position.x<0) its the same if you wanted to go virtical just change from x to y and joystick position x < joystick position y. ea is a script i prepard eralia its in javascript tho ( o dont no how to do the jumping stuff anyway hope i was helpfull)

#pragma strict



@script RequireComponent( CharacterController )



var moveTouchPad : Joystick;





var forwardSpeed : float = 4;





private var thisTransform : Transform;

private var character : CharacterController;



function Start()

{



thisTransform = GetComponent( Transform );

character = GetComponent( CharacterController ); 





var spawn = GameObject.Find( "PlayerSpawn" );

if ( spawn )

thisTransform.position = spawn.transform.position;

}



function OnEndGame()

{



moveTouchPad.Disable();



this.enabled = false;

}



function Update()

{

var movement = thisTransform.TransformDirection( Vector3( moveTouchPad.position.x, 0, moveTouchPad.position.y ) );



movement.y = 0;

movement.Normalize();



var absJoyPos = Vector2( Mathf.Abs( moveTouchPad.position.x ), Mathf.Abs( moveTouchPad.position.y ) ); 

if ( absJoyPos.y >= absJoyPos.x )

{

if ( moveTouchPad.position.y > 0 )

{

movement = Vector3.forward * forwardSpeed * Time.deltaTime;

}

else if ( moveTouchPad.position.y < 0 )

{

movement = -Vector3.forward * forwardSpeed * Time.deltaTime;

}

}

else if ( absJoyPos.x > absJoyPos.y ) 

{

if ( moveTouchPad.position.x > 0 )

{

movement = Vector3.right * forwardSpeed * Time.deltaTime;

}

else if ( moveTouchPad.position.x < 0 )

{

movement = Vector3.left * forwardSpeed * Time.deltaTime;

}

}

charact

i cant script in c# so im proboly no help but with those joysticks then are a actual object and dont output a axis so you must put a variable in, in javascript its like this: var joystick : joystick; it is just a varible that can be a object taged as a joystick then instead of getting a axis you must get the position of the joystick wich is done like so(in javascript i think its similar) if you wanto go side ways you can check if the joystick is ferter horizontal then virtical by this: if ( joystick.position.x >=joystick.position.y) then it is clear that you wanto move horizontal but wich way(never fear it can be fixed:)) then you need to check if its bigger then 0 you move right if not its left this is done like so if(joystick.position.x>=0) and if(joystick.position.x<0) its the same if you wanted to go virtical just change from x to y and joystick position x < joystick position y. ea is a script i prepard eralia its in javascript tho ( o dont no how to do the jumping stuff anyway hope i was helpfull)

#pragma strict



@script RequireComponent( CharacterController )



var moveTouchPad : Joystick;





var forwardSpeed : float = 4;





private var thisTransform : Transform;

private var character : CharacterController;



function Start()

{



thisTransform = GetComponent( Transform );

character = GetComponent( CharacterController ); 





var spawn = GameObject.Find( "PlayerSpawn" );

if ( spawn )

thisTransform.position = spawn.transform.position;

}



function OnEndGame()

{



moveTouchPad.Disable();



this.enabled = false;

}



function Update()

{

var movement = thisTransform.TransformDirection( Vector3( moveTouchPad.position.x, 0, moveTouchPad.position.y ) );



movement.y = 0;

movement.Normalize();



var absJoyPos = Vector2( Mathf.Abs( moveTouchPad.position.x ), Mathf.Abs( moveTouchPad.position.y ) ); 

if ( absJoyPos.y >= absJoyPos.x )

{

if ( moveTouchPad.position.y > 0 )

{

movement = Vector3.forward * forwardSpeed * Time.deltaTime;

}

else if ( moveTouchPad.position.y < 0 )

{

movement = -Vector3.forward * forwardSpeed * Time.deltaTime;

}

}

else if ( absJoyPos.x > absJoyPos.y ) 

{

if ( moveTouchPad.position.x > 0 )

{

movement = Vector3.right * forwardSpeed * Time.deltaTime;

}

else if ( moveTouchPad.position.x < 0 )

{

movement = Vector3.left * forwardSpeed * Time.deltaTime;

}

}

charact