Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DLL Talk / Using NGC to see whether the object is in mid-air or not -- for accelerated falling

Author
Message
qwe
21
Years of Service
User Offline
Joined: 3rd Sep 2003
Location: place
Posted: 30th May 2005 14:16 Edited at: 30th May 2005 14:42
if the object is in mid-air, i'll make the person fall faster and faster (until the average speed where wind friction would stop a person).. and once on the ground, the velocity downward will go back to normal

so, i need to know when the player object is in midair. i'm using NGC. i'm pretty sure the best way is to use this command



(that is straight from help file, with unneeded lines deleted)

so normy#, when in midair, is zero, when on flat ground its 1, when on a slope its in between. so i can say, if normy# is less than 1, increase velocity downward, so you slide down ramps faster and faster, and fall faster and faster, like real gravity.

however... there is often more than one ynormal collision. for each wall you are touching, there is a ynorm# at 0. how can i get the ynorm# just for the ground?

ok i think i got the answer. go through the ynorm#s, and if any one of them is > 0.999, set gravity back to normal... else, accelerate person downward

i'm still going to post this incase it doesnt work, or incase someone else has a simpler/faster method of accelerated falling that they can share

edit: yes it does work. here is your function, if anyone wants it



Lost in Thought
20
Years of Service
User Offline
Joined: 4th Feb 2004
Location: U.S.A. : Douglas, Georgia
Posted: 30th May 2005 15:05
If collcount = 0 then object is in mid air. When in mid air you are not colliding with anything. Your ynorm will also be 0 when hitting a perfectly verticle wall.

qwe
21
Years of Service
User Offline
Joined: 3rd Sep 2003
Location: place
Posted: 30th May 2005 15:57 Edited at: 30th May 2005 15:58
when in midair, you can be touching a wall or hte ceiling. but let me try what you say and see if it still works anyway

nope. if you are running into something while falling, and i used your idea, you would be able to stop yourself in midair by pressing against a wall

ps we might be using different meanings for "midair." when i say midair i mean, not touching the ground (as i said, i need hte code to see whether you fall or not)
Lost in Thought
20
Years of Service
User Offline
Joined: 4th Feb 2004
Location: U.S.A. : Douglas, Georgia
Posted: 30th May 2005 17:35 Edited at: 30th May 2005 17:51
I was just saying you may want to add that condition as well, but I see you took a different route and only told it that it was not falling when on the ground instead of when it was falling like my code. With your code what happens if you fall on a 45deg ramp? The ynorm will be 0.5, you will be on the ground but your code will not say so. The ynorm will be 0 for perfectly verticle walls, >0 for below collisions, and <0 for above collisions. So with your code you just need to determine what acceptable angle the slope can be to be considered ground. You may want to lower than .999 to like .3 to accomodate ramps. Or even lower if you have steeper ramps. It all depends on your level and prefference.

[edit] I just remembered though. NGC gives you the norm of the ellip collision instead of the poly normal so depending on your ellipsize and shape (not perfect sphere) your ynorm values will be different than mine. You may have alot higher values if your ellip is taller than it is around like 40,80,40 will give you a norm of about .970 on a 45deg ramp etc. You will just have to play around with your levels and ellip size to see what the .999 value should be.

qwe
21
Years of Service
User Offline
Joined: 3rd Sep 2003
Location: place
Posted: 31st May 2005 11:14 Edited at: 31st May 2005 11:15
Quote: "With your code what happens if you fall on a 45deg ramp? The ynorm will be 0.5, you will be on the ground but your code will not say so"


the gravity doesnt accelerate if the ynorm is greater than 0.999. hence, at a 45 degree angle, you DO accelerate and slide off. that is what should happen no? if you stand on a 45 degree angled surface, it's not going to be as easy to stay on as if you're on normal ground

but now that i think about it, if it keeps accelerating, you may not be able to stay on when in real life you could. so yes perhaps i should lower that value.
Lost in Thought
20
Years of Service
User Offline
Joined: 4th Feb 2004
Location: U.S.A. : Douglas, Georgia
Posted: 31st May 2005 15:09
It is all up to you and the way you want it to work.

ThomasFN
20
Years of Service
User Offline
Joined: 26th Aug 2004
Location:
Posted: 7th Jun 2005 21:29
Try to check if you've collided with the wall or the floor. If the wall, carry on falling.

This only works if the walls and floor are seperate objects, though.

Thomas Smith

Login to post a reply

Server time is: 2024-11-21 14:15:14
Your offset time is: 2024-11-21 14:15:14