- Home /
Vector2 with increasing increment;
I want to have an increasing speed of falling characters but methods like the in game component of force increase to quick I want a slower incline than that. Heres my code and thanks ahead of time
public int speed = 5;
public Vector2 BadSpeed = new Vector2(0, -speed);
void FixedUpdate(){
GetComponent<Rigidbody2D> ().velocity = BadSpeed;
Comment
public float speed = 5;
public float someFloat$$anonymous$$ultiplierToAdjustAcceleration = 1;
public Vector2 BadSpeed;
public Rigidbody2D rb;
void Awake()
{
rb = GetComponent<Rigidbody2D>();
}
void FixedUpdate(){
speed += Time.deltatime * someFloat$$anonymous$$ultiplierToAdjustAcceleration;
BadSpeed = new Vector2(rb.velocity.x, -speed);
rb.velocity = BadSpeed;
This is not working it's saying vector 2 requires 2 float increments
$$anonymous$$aybe it's better now. It wasn't really meant to be fully working code either, but rather just give you the idea that you can increase or decrease speed
in FixedUpdate to get the acceleration you want and use someFloat$$anonymous$$ultiplierToAdjustAcceleration
to fine tune.