I am only a newbie in unity and it seems that I cannot make my character fall faster.
so what I want to do is the more the character jumps the higher it gets and the faster it falls.
using UnityEngine;
using System.Collections;
public class charMovement : MonoBehaviour
{
public float moveSpeed = 100f;
public float jumpSpeed = 500f;
Rigidbody2D rigidbody2D;
GameObject player;
void Start()
{
player = GameObject.Find("player");
rigidbody2D = GetComponent<Rigidbody2D>();
}
void Update()
{
transform.Translate(Input.GetAxis("Horizontal") * moveSpeed * Time.deltaTime, 0, 0);
if(Input.GetButtonDown("Jump"))
{
jumpSpeed += 500;
player.rigidbody2D.gravityScale += jumpSpeed;
transform.position += transform.up * jumpSpeed * Time.deltaTime;
}
}
}
it seems that increasing the gravity won’t affect the speed of the fall. I’ve also tried increasing the mass but still no effect.