[Quake-C] Lay grenades flat on surface
Quake C mods and support - SSQC / CSQC
Brought to you by:
teknoskillz
|
From: Cobalt <co...@te...> - 2016-10-18 18:48:12
|
Already did this in DP using the grenades touch function, as
trace_plane_normal is calculated in any kind of touch function. Sorta made
it easier that way, but today decided to try it in POQ (plain ol Quake)
using a Proquake based engine called Manquake. Finally got it to work as
follows:
// Place Code in GrenadeTouch ();
if (other.movetype == MOVETYPE_PUSH && self.watertype == -1 &&
self.velocity_z < 1)
{
makevectors (self.velocity);
trace_ent = nextent(self.owner); // Just to set trace_ent to
something other than world because we may hit world
traceline (self.origin, self.origin - '0 0 12', 0, self);
if (trace_fraction != 1)
{
self.finalangle = vectoangles(trace_plane_normal);
if (trace_ent.movetype == other.movetype)
self.angles_x = self.finalangle_x - 90;
}
So no more grenades sticking at weird angles once they stop moving. Works on
doors and plats too. This code should work in any engine, but if you throw
it in DP
you can probably discard the traceline here that is done to fill
trace_plane_normal as the engine is populating that field correctly from the
tests I have done so far.
|