# how to make something happen if velocity reaches a certain value?

I need to know how to make something happen after a rigidbody reaches a certain velocity,

Adding onto what Kudorado said, say you have a Rigidbody variable (reference to a Rigidbody component) stored in `Rigidbody r`. Then you can use `r.velocity`, which will return a Vector3 back to you.

You can check the velocity (with signage to show direction – positive and negative numbers are both allowed) in each axis individually with `r.velocity.x`, `r.velocity.y`, and `r.velocity.z`.

But if you want to know how fast something is moving (speed, which is always positive), then you want to find the length of the velocity vector (the length of a vector is its size – how big it is in overall). You can get the length of any Vector3 by calling `.magnitude` on the vector – so that’d be `r.velocity.magnitude`.

And of course it’s very open ended – you can do anything you’d like with that value. So you can throw it in an if statement if you want in the Update method as an example:

``````public Rigidbody r;

public void Update() {
float speed = r.velocity.magnitude;
if (speed >= 3) {
//Do something
}
}
``````

I hope this helps!

Depending on which axis do you want to check, velocity will return a `Vector3` on `Rigidbody`, `Vector2` on Rigidbody2D.
you can access velocity via `Rigidbody.velocity`.