how to jump in parabola.
hi ,,,
i have path like this.
i need the jump like a parabola from one tail to other. if there is one tail(i mean no need to climb) he jumps exactly what i need .but whenever the there is two tails he can jump but shape was missing(parabola),and for down also .
how can i do it
this is my code check it and give any suggestions.
void Jump () {
Vector2 forwardAndLeftAndStright=new Vector2(1f,0);
if (assignOnce == false) {
startPoint = transform.position;
//here am giving the next tail position. targetPoint = collider_transform + forwardAndLeftAndStright;
time = 0;
jumpProgress = 0;
velocityY = jumpStartVelocityY;
height = startPoint.y;
assignOnce = true;
}
jumpProgress = time / jumpDuration;
currentPos = Vector2.Lerp (startPoint, targetPoint, jumpProgress);
currentPos.y = height;
height += velocityY* Time.deltaTime;
velocityY += Time.deltaTime * Physics.gravity.y;
time += Time.deltaTime;
transform.position = currentPos;
//here am checking how many tails are placed before the player.if it is one then am doing this.
if (foundHight != null) {
if (foundHight.Length == 1) {
forwardAndLeftAndStright = new Vector2 (2.5f, 2f);
}
}
//here am checking to jump down.if some thig hits then no need to jump down .if hit is none then he has to jump down.
if (!foundHit) {
forwardAndLeftAndStright=new Vector2(2.5f,-1f);
}
}
Your answer
Follow this Question
Related Questions
How to make a jump directional 1 Answer
control jump height and jump number by touch 0 Answers
How to add a jump key 2 Answers
Jump Force/Velocity is Wrong and Strange. Help 1 Answer
Player Is infinite jumping 1 Answer