- Home /
How do i get the Y Velocity of my character?
I am very new to scripting and unity, I managed to read and create a few scripts for my experiments, this time, i wanted to check how fast my character is falling, and play certain animation to the character.
This is a third-person shooter experiment.
How do i get the Y Velocity of my character?
I wanted my character to play the "Fall" animation when the Y Velocity reached more than X distance/frame or something.
and i wanted my character to be "Damaged" according to the fall distance. (I created a working health & damage scripts, i just want to know how to get the distance fallen and its velocity * Damage factor.)
Thanks!
It is not a good idea to pack multiple questions into one. That can be confusing, and some questions will be overlooked and remain unansered. It is not the idea of this site.
To answer the first part of your question(s), simply use rigidbody.velocity.y
You are right, i should fix this.
I think the fall distance is related to the main question, so the other question is necessary.
EDIT: Removed Animation Question
Answer by Dave-Carlile · Jan 22, 2013 at 05:38 PM
From the documentation:
You can use rigidbody.velocity to get the velocity vector, and rigidbody.velocity.y to get just the y component.