Ok, time to strut my rookie coder status again. My reasoning for putting this in a new thread instead of RiftQuake is so that others with a similar problem may stumble upon it easier.
I'm coding up a player crouch function for RiftQuake. Here is what I've done so far:
* Re-valued the VEC_HULL_MIN and VEC_HULL_MAX to '-16 -16 -28', '16 16 28' to put the origin dead in the center for simplicity.
* Re-valued the view offset in PutClientInServer() to 18 to maintain the original eye level, as changing the origin obviously changes this.
* My crouch function re-sizes the player to '-16 -16 -16', '16 16 16' (or 32x32x32 instead of the standing size of 32x32x56).
* Dropped the player's origin on the z-axis while in crouch (self.origin = self.origin - 12) to place the hull_min on the floor, and restored it upon standing (self.origin = self.origin + 12).
* Successfully decreased speed by a scalar of 0.65 while in crouch to add realism (checked in PlayerPreThink()).
* Successfully coded a CrouchToggle() function that is called on Impulse 21 to either crouch the player if standing, or stand the player if crouching.
The problem is, even with what appears to be proper re-sizing and re-positioning of the origin, the player won't walk under low hanging BSP clips while in crouch.
I found this while searching through the forums for an answer:
That quote came from this thread about player sizing:
http://quakeone.com/forums/quake-hel...-monsters.html
I have a few working solutions that I'd like to check with you pro coders.
1) If I use Q3's map format for levels, thus side-stepping conventional Q1 BSP clipping, will this hull check still apply?
2) Is there a DP/FTE extension to override this?
I may also not have a clear understanding of what exactly I'm modifying by changing the player size and origin values. What I have done makes sense in my mind, let me know if I'm wrong.
Here's the code from my PHYSICS.QC file:
Here's PlayerPreThink() from my CLIENT.QC file:
And here's where it's called on in my IMPULSES.QC file:
I know the problem isn't in IMPULSES.QC or CLIENT.QC, but I included them here so you can make the connections if you need them.
Thanks guys. I'll be actively searching for an answer in the meantime, but if you would like to offer some quick and dirty advice, I'd appreciate it.
I'm coding up a player crouch function for RiftQuake. Here is what I've done so far:
* Re-valued the VEC_HULL_MIN and VEC_HULL_MAX to '-16 -16 -28', '16 16 28' to put the origin dead in the center for simplicity.
* Re-valued the view offset in PutClientInServer() to 18 to maintain the original eye level, as changing the origin obviously changes this.
* My crouch function re-sizes the player to '-16 -16 -16', '16 16 16' (or 32x32x32 instead of the standing size of 32x32x56).
* Dropped the player's origin on the z-axis while in crouch (self.origin = self.origin - 12) to place the hull_min on the floor, and restored it upon standing (self.origin = self.origin + 12).
* Successfully decreased speed by a scalar of 0.65 while in crouch to add realism (checked in PlayerPreThink()).
* Successfully coded a CrouchToggle() function that is called on Impulse 21 to either crouch the player if standing, or stand the player if crouching.
The problem is, even with what appears to be proper re-sizing and re-positioning of the origin, the player won't walk under low hanging BSP clips while in crouch.
I found this while searching through the forums for an answer:
Originally posted by MH
http://quakeone.com/forums/quake-hel...-monsters.html
I have a few working solutions that I'd like to check with you pro coders.
1) If I use Q3's map format for levels, thus side-stepping conventional Q1 BSP clipping, will this hull check still apply?
2) Is there a DP/FTE extension to override this?
I may also not have a clear understanding of what exactly I'm modifying by changing the player size and origin values. What I have done makes sense in my mind, let me know if I'm wrong.
Here's the code from my PHYSICS.QC file:
/*
================================================
PLAYER CROUCH
This governs the player's crouching ability.
================================================
*/
void() PlayerCrouch =
{
if (!self.velocity_z)
{
self.origin_z = self.origin_z - 12;
setsize(self, '-16 -16 -16', '16 16 16');
self.crouch = 1;
}
};
//======================================
void() PlayerStand =
{
makevectors(self.v_angle);
tracebox(self.origin, '-16 -16 -28', '16 16 28', self.origin + '0 0 16', FALSE, self);
if ((trace_fraction == 1) && (!trace_ent.takedamage) && (!self.velocity_z))
{
self.origin_z = self.origin_z + 12;
setsize(self, '-16 -16 -28', '16 16 28');
self.crouch = 0;
}
};
//======================================
void() CrouchToggle =
{
if (self.crouch == 1)
PlayerStand ();
else
PlayerCrouch ();
};
================================================
PLAYER CROUCH
This governs the player's crouching ability.
================================================
*/
void() PlayerCrouch =
{
if (!self.velocity_z)
{
self.origin_z = self.origin_z - 12;
setsize(self, '-16 -16 -16', '16 16 16');
self.crouch = 1;
}
};
//======================================
void() PlayerStand =
{
makevectors(self.v_angle);
tracebox(self.origin, '-16 -16 -28', '16 16 28', self.origin + '0 0 16', FALSE, self);
if ((trace_fraction == 1) && (!trace_ent.takedamage) && (!self.velocity_z))
{
self.origin_z = self.origin_z + 12;
setsize(self, '-16 -16 -28', '16 16 28');
self.crouch = 0;
}
};
//======================================
void() CrouchToggle =
{
if (self.crouch == 1)
PlayerStand ();
else
PlayerCrouch ();
};
void() PlayerPreThink =
{
CheckImpulses();
PosChasecam();
if (self.crouch == 1)
{
self.velocity_x = self.velocity_x * 0.65;
self.velocity_y = self.velocity_y * 0.65;
}
if (self.button2)
{
if (self.crouch == 1)
PlayerStand();
else
PlayerJump();
}
else
self.flags = self.flags | FL_JUMPRELEASED;
};
{
CheckImpulses();
PosChasecam();
if (self.crouch == 1)
{
self.velocity_x = self.velocity_x * 0.65;
self.velocity_y = self.velocity_y * 0.65;
}
if (self.button2)
{
if (self.crouch == 1)
PlayerStand();
else
PlayerJump();
}
else
self.flags = self.flags | FL_JUMPRELEASED;
};
void() CheckImpulses =
{
if (self.impulse == 21)
CrouchToggle ();
self.impulse = 0;
};
{
if (self.impulse == 21)
CrouchToggle ();
self.impulse = 0;
};
Thanks guys. I'll be actively searching for an answer in the meantime, but if you would like to offer some quick and dirty advice, I'd appreciate it.
Comment