Help with your scripting

falling

falling

Postby cassius_b » 10 May 2018, 19:49

I want my main character to die when falling from a heght more than 25 feet high. How can I make this happen?
cassius_b
Skyline Padawan
 
Posts: 94
Joined: 21 Mar 2016, 13:45
Skill: 3D Modeller
Skill: Programmer

Re: falling

Postby SolarPortal » 10 May 2018, 19:57

You could do a raycast when falling through the air and get the height from which you are falling, if its greater than a certain amount, then you can call the KO of the character.
The raycast would not need to be polled every frame as it would since your falling, the height will never go higher. But if there was a cliff or overhang that sloped, then you would need to know the distance.
A poll every 10ms -100ms or more would probably be fine.

Hope this helps :D
Conceive, Quantify & Do!
Skyline Game Engine - Lead Developer.
Please provide as much information as possible when asking for help.


Specs: OS: Win 10 64bit, CPU: Intel i7 3770 3.4ghz x 4 core(8 threads), GPU: Nvidia GTX 1060 6GB, Ram: 16gig DDR3, Windows on 250gb Samsung Evo 860
User avatar
SolarPortal
Skyline Founder
Skyline Founder
 
Posts: 3015
Joined: 29 Jul 2012, 15:56
Location: UK
Skill: 3D Modeller
Skill: 2D Artist
Skill: Programmer
Skill: Level Designer

Re: falling

Postby cassius_b » 10 May 2018, 20:52

Thanks
cassius_b
Skyline Padawan
 
Posts: 94
Joined: 21 Mar 2016, 13:45
Skill: 3D Modeller
Skill: Programmer


Return to Lua Scripting

Who is online

Users browsing this forum: No registered users and 1 guest