|
From: <qu...@ca...> - 2016-02-25 08:37:12
|
On 2016-02-25 00:22, Cobalt wrote:
>
> I have since revised that code alot to account for hits to the ceiling,
> where it will just permanently stick, and from time to time using
> TE_BLOODSHOWER in Darkplaces, throw some blood down. For non sloping
> ceilings, this is fine, however I will have to figure out some way to
> get
> the angle of the ceiling and somehow hack in a gravity that will make
> it
> slide...I dont think Quake physics are capable fo this, so ought to be
> interesting.
>
If you want to use gravity, set MOVETYPE_BOUNCE and velocity_z will
control the speed of its slide to the ground.
velocity_x and velocity_y will make it go other directions.
It is easily possible with vector math to make it hit the wall and
continue moving in an inferred direction
(from the impact vector) and slowly slide to the "floor" surface, or
even go up for a bit, then start down.
To stick, just set velocity to '0 0 0'. You would also want to '0 0 0'
avelocity - that causes rotation.
Angle of the ceiling - or any surface:
makevectors(self.angles);
traceline (self.origin, self.origin + v_forward*4096, TRUE, self);
v1__ = trace_plane_normal;
v1___x = 0 - v1___x;
v1___y = 0 - v1___y;
e0__.angles = vectoangles( v1__ );
setorigin( e0__, self.origin - ( v_forward * 0.2 ) );
Given that self.angles is the dir of travel and the traceline hits a
solid (map walls or SOLID_BSP)
then trace_plane_normal is the normal to that surface.
This code snipped was used to place a sprite [ e0__ ] (like a bullet
hole) on a wall.
self was the missile ent hitting the wall after it traveled along a
path.
I dont recall now the significance of flipping x and y in the normal
vector. I had a good reason.
vectoangles is what properly aligns the entity with the wall plane as
calculated from the normal.
> So my questions is regarding the case where we are sliding it doen a
> straight wall, and say the wall ends, or evolves into a slope. For now
> lets
> just say we will drop it off the wall / unstick it. Since we are
> NOCLIP, can
> we use FL_ONGROUND at all, or when we are NOCLIP, the engine basicly
> overrides this flag?
I'm reasonably sure anything with SOLID_NOT or NOCLIP set will not
collide with solids via quake engine physics.
You set either of those two and give an ent some velocity and it will go
right through a wall.
I believe touch will also not happen with SOLID_NOT. Not sure what
touch does with NOCLIP.
FL_ONGROUND is most likely only set for MOVETYPE_WALK and MOVETYPE_STEP.
Not 100% certain, but I seem to remember those are the only movetypes
that set onground.
The quake-c manual has some info about these, but its pretty basic.
If you want to see what the gyro physics package can do (essentially
make quake look more like a modern physics engine)
check out the HD pack.
|