[Unity3D] Fall Damage In Unity4 (JavaScript)

preview_player
Показать описание
In this tutorial I show you how to create a fall damage create to take the players position from two places and calculate the distance travelled and damage the players health. This tutorial is written in javascript!

·························································································

🠺🠺🠺Check Out My Assets:

························································································

························································································

·······················································································
Рекомендации по теме
Комментарии
Автор

Omg! It actually worked! This is a rare thing to happen for me. lol

GadeEmbossed
Автор

I personally wouldn't link fall damage to the drop height as that doesn't imitate real life physics.
What I would do is, calculate acceleration and apply fall damage accordingly.

RupluttajaGames
Автор

I am getting a couple of errors saying unknown identifier 'controller'

dragn
Автор

For the people who would like to have this script in C#, I've written this script in C# instead of Java(script).

Comment if you want the script in C#.

zThana
Автор

Do you think for your next tutorial you can do a wall jump (like in Super Mario 64) mechanic, or a speed boost mechanic like in Sonic? 

I'd love to see either one. I'm doing an assignment and i can't figure out how to implement these, but even if i can't figure it out in time i'd love to see how this is done.

protanopia
Автор

Hi! Awesome video but I have a question. How did you make it so that when you make a new function in the editor, it doesn't auto-indent everything for you? I can't seem to get it to stop auto-indenting my curly brackets. Thanks in advance.

MrZombieLover
Автор

Hi SpeedTutor ! I have a problem.How to make take gun ? I watched xenosmash video (switching guns) but he is make only switching guns.How to make take gun and it will be activated.Finally, if you near to gun  a guitext active, (Take gun "Press E")

Thanks to you (Sorry, my english is very bad !)

melihaldemir
Автор

Please reply to this....
This works very well but how do I make it look as I am getting hurt. Can u make a short one of this just adding like red around the screen when you are low. Also a regen..

ChrisxArrons
Автор

when i'm grounded it just keeps counting down, but when i jump above the ground it stops for a while

alegomanYTPs
Автор

could you add a leg animation and a sound when you hit the ground (like minecraft fall damage)
ps why dont you make a game? 

TheDrhackz
Автор

@SpeedTutor, I have already created a health variable on a c# script. How do I access that variable and attach it to this variable? Thank you for your extensive help on c#/javascript!!

johnelias
Автор

Cloud u make a video that allows you to take damages from Enemy Ai please + wich hve fall damage in . Please reply to tell me i nneed it for my serious game.

minecraftgame
Автор

YOU SHOULD MAKE A TUTORIAL ABOUT PARKOUR, SOMETHING LIKE MIRRORS EDGE, WITH ALL THE ANIMATIONS AND STUFF . 

FullShop
Автор

hey i wanna ask something, what if i have a jet pack scripts now don't i still get fall damage?? how do i fix that

thehideandseekchallenge
Автор

This is what we need on our game but when I tried this script using Unity 5 it doesn't work. Any idea why? It doesn't detect errors also. Thanks!

mrkrndl
Автор

is there a way to make it flash red around your screen when you take damage like most fps games.

Raborick
Автор

Speedtutor
This may sound very advanced but can you make a tutorial on how to add custom books and notes and that you can read them.
Thanks!!!

BraveGTM
Автор

Dude does it work for third person control (plz reply) :)

leanthonybrantleys.r
Автор

can you make a video like parkour so the player can climb and other?

jff-tech
Автор

Olá, gostaria apenas de propor uma modificação no seu script, como eu fiz neste exemplo em C#:



using UnityEngine;
using System.Collections;
public class QUEDA : MonoBehaviour {
private CharacterController controlador;
public Transform Player;
public float UltimaPosicaoEmY, DistanciaDeQueda;
public float DistanciaMaximaDeQueda = 5;
void Start (){
controlador = ();
}
void Update (){
if (UltimaPosicaoEmY > Player.transform.position.y && controlador.velocity.y < 0) {
DistanciaDeQueda += UltimaPosicaoEmY - Player.transform.position.y;
}
UltimaPosicaoEmY = Player.transform.position.y;
if (DistanciaDeQueda >= DistanciaMaximaDeQueda && controlador.isGrounded) {
PLAYER.VIDA = PLAYER.VIDA - 50;
ZerarVariaveis();
}
if (DistanciaDeQueda < DistanciaMaximaDeQueda && controlador.isGrounded) {
ZerarVariaveis();
}
}
void ZerarVariaveis (){
UltimaPosicaoEmY = 0;
DistanciaDeQueda = 0;
}
}



Neste exemplo eu adicionei isto:

&& controlador.velocity.y < 0

isto permite que a contagem começe apenas quando ele está caindo, e não quando ele está pulando por exemplo... :D

A propósito, gostei dos seus tutoriais, são ótimos.

marcosschultzunity
welcome to shbcf.ru