- Home /
Question by
$$anonymous$$ · May 03, 2015 at 07:49 PM ·
jumptranslatesame
Jump and Translate on the same time
I want to make the Object jump(animationClip) and transform.Translate on the same time. But After Translate, Playing jumpping animation.
void Update () { transform.Translate (0, 0, runSpeed * Time.deltaTime); //anim.CrossFade ("run");
if(Input.GetMouseButtonDown(0))
{
downPos = Input.mousePosition;
}
if (Input.GetMouseButtonUp (0))
{
upPos = Input.mousePosition;
upDownDis = downPos.x - upPos.x;
startPos = transform.position;
if (upDownDis > 5)
{
anim.Play ("jump");
transform.Translate (-1, 0, 0);
}
else if (upDownDis < -5)
{
anim.Play ("jump");
transform.Translate (1, 0, 0);
}
}
}
}
Comment
I don't understand the question. What's going wrong exactly?
AS dave said you need to explain more. Why are you calculating distances on the X axis for a jump for example?
Your answer
Follow this Question
Related Questions
transform.Translate and transform.eulerAngles bug 0 Answers
Diagonal Wall Jump 0 Answers
Simple Jump script 1 Answer
Strange Behaviour during jump and double jump in 3D 0 Answers