when my player falls in a certain hight then i want to apply some damage but i don't know how to calculate hight & then how to apply damage e.g. if the player falls some height then apply some damage to the player like that
for the damage i using FPS damage script just decrease the GUI width
i make two game object one is my character mesh & attach box collider & Health script to this game object & for the movement i make one more gameobject & i attach movement script to this game object (movement script is my own script)
thats what i don't where attach below script & hw to work this script
It's near the bottom. That's where you can put what happens if you fall, such as subtracting health, shaking, blurring, or otherwise discoloring the GUI, etc. Good luck!
Oh, and don't forget to fix the settings, like checking the falling damage option and such. You really should just use the standerd FPS prefab for this, as it makes things a lot simpler. You shouldn't need much else, unless you want to replace the 'Graphics' component with your own personal mesh. All it is an object that can be affected by physics, so it's not a big deal if you replace it. For clarity, though, keep the name to 'Graphics' no matter what mesh you have, in case a unknown script references it from somewhere and can't find it. Although that's very unlikely, it's also nice to keep your game streamlined and as simple as possible.
I believe this is what you're looking for. Check it out!
The easiest thing would probably be if you instead of using the height the player has fallen, used the velocity of the player when he collides with the ground. You can get the relative velocity of a collision in the
answered Mar 26 '10 at 10:00 PM