|
From: Cobalt <co...@te...> - 2016-08-22 17:57:36
|
Trying to figure out the roll value on an ent that I am basicly sticking to
a wall, in this case its a gib. The code works pretty well,
and sticks the Gib to the wall, and gradually drops it down as a noclip
type. Trouble is I am giving it an avelocity as a cheap solution
based on a calc from trace_plane_normal that I believe is sorta cheesy, but
for the time being the rest eludes me.
I think it would be a matter of determining which value weather X, Y or Z
would need to be applied because trace_plane_normal
will be different on walls that are up in different directions with respect
to the world.
First part of the code is like:
self.solid = 0;
self.movetype = MOVETYPE_STEP; // thought I had it as noclip but I
guess this works better
self.avelocity = (vectoangles (trace_plane_normal) + self.size) *
0.05; // This is the main calc
self.velocity_z = vlen (self.size) * -1.125; // Downward depending on
overall size
...Which gets it moving ok. Then I have it thinking and doing this calc:
self.avelocity = (random()) * (vectoangles (self.size) + vectoangles
(self.velocity));
and that sort of slows down the overall rotation near the point it sort of
looks ok, cept the rotation is not
usually happening horizontaly with respect to the wall its stuck to, thats
the part I need to isolate.
Im only grabbing trace_plane_normal once in the gibs touch field, as
Darkplaces accurately populates that field
in any .touch usually very accurately, but I think perhaps I would need to
do a traceline continually as the gib falls
in its think because its possible the surface of the wall may change as well
as it reaching a corner, in which case we can either
make it fall to the floor or just hang there and bleed for a while.
Yea, I know ....gross right ? Sorry if this ruins anyones lunch....
==
Cobalt
|