- Home /
Android issues, jump force not consistent, touch not consistent
Hi guys, a few issues here I have with my android build of a game prototype. If you don't mind for starters, I got a web build of this game I also have running on android if you want to try it to get a better idea of what i am talking about here.
The jumping on my android device which is a HTC Evo 3D is not consistent with how far it goes up. Its not using rigidbody.addforce or impulse. I can't figure out why on android the character sometimes doesn't jump very high, thus causing him to hit objects.
I also have an issue with tapping on the zombies to kill, sometimes the tap doesn't register. Not sure if it's a speed issue or what. On the phone I eliminated the crosshair btw. (side note, animation doesn't always play either when tapping them)
nobody else has any issues that sound similar on android?
Touching for killing the zombies code: void zombieShoot() { if(Input.Get$$anonymous$$ouseButtonDown(0)) { Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition); RaycastHit hit;
if(Physics.Raycast(ray, out hit))
{
if(hit.transform.tag == "zombieObstacle")
{
//dude.animation.Stop("run");
dude.animation.Play("punch");
gunFlash.Play();
audio.clip = gunShots[Random.Range(0,2)];
audio.Play();
}
}
}
}
This is the function for moving the character: void $$anonymous$$oveCharacter() { pathPosition += Time.deltaTime speed; //add gravity: ySpeed += gravity Time.deltaTime;
//apply gravity:
character.position = new Vector3(floorPosition.x, character.position.y - ySpeed, floorPosition.z);
//floor checking:
if(character.position.y < floorPosition.y)
{
ySpeed = 0;
jumpState = 0;
character.position = new Vector3(floorPosition.x, floorPosition.y, floorPosition.z);
}
}
and when jumping:
if(Input.touchCount > 0 && jumpState == 0)
{
Touch touch = Input.GetTouch(0);
if(touch.position.x < Screen.width/3)
{
dude.animation.Play("jump");
audio.clip = jumpGrunt;
audio.Play();
ySpeed -= jumpForce;
jumpState = 1;
}
}
Your answer
Follow this Question
Related Questions
GUITexture touch play animation 0 Answers
Script plays only once [Android] 0 Answers
Android swipe from the top triggers onClick events 0 Answers
GameObject won't jump with touch 1 Answer
Press GUI Button and make it play animation on Android 1 Answer