Question by
Veerababu.g · Feb 18, 2016 at 07:05 AM ·
rigidbody2djumpphysics2djumping
how can i make my player jump to fixed position contenously
hello..... my player has to jump from one tail to another tail and to another and so on...... can any one tell me how can i do it.........
up to now am using a code that gives not much attention........
here is my code plz check it any suggestions how can i modify this one......
void Jump () {
if (assignOnce == false) {
startPoint = transform.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 += 1.5f*velocityY * Time.deltaTime;
velocityY += Time.deltaTime * Physics.gravity.y;
time += Time.deltaTime;
transform.position = currentPos;
}
am calling this function whenever player collide with the tail.
Comment