You need to initialize local variables, grav could have any random value, maybe that is the cause for your problems.
Btw. I would not use the c_trace return value for ground detection but trace_hit or the hit struct (or the HIT_TARGET macro or whatever it is called). Calling c_trace two times in a row with the same parameters is pretty wasteful, too. Just use an else case instead.


"Falls das Resultat nicht einfach nur dermassen gut aussieht, sollten Sie nochmal von vorn anfangen..." - Manual

Check out my new game: Pogostuck: Rage With Your Friends