Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var maxV : float = 10.0;
- var cSpeed : float =0;
- function FixedUpdate()
- {
- var rg = rigidbody;
- if (rg.velocity.x > maxV)
- {
- print("baaaaaaaaaa");
- rg.velocity = new Vector3(maxV, // X
- rg.velocity.y, // Y
- rg.velocity.z // Z
- );
- // OR - to avoid having to set the others you should be able to
- // set individual components of a Vector3 like this;
- rg.velocity.x = maxV;
- }
- cSpeed = Vector3.Magnitude(rg.velocity);
- }
Add Comment
Please, Sign In to add comment