by Gutawer » Sun May 21, 2017 1:34 am
Bob speed already affects the bobbing intensity, if you check gzdoom.pk3/zscript/shared/player.txt the bob function looks like this:
Code: Select all
void Bob (double angle, double move, bool forward)
{
if (forward && (waterlevel || bNoGravity) && Pitch != 0)
{
move *= cos(Pitch);
}
player.Vel += AngleToVector(angle, move);
}
See how
move is used as the second as the second argument of AngleToVector? That means that
move controls the magnitude of the vector, meaning higher movement speeds give a higher bobbing intensity. The Bob function is called from the virtual MovePlayer, so if you want to change how bobbing works, you'll want to override MovePlayer and write your own Bob function (or, in some cases, it may be sufficient to just pass different arguments to Bob inside MovePlayer). Now of course, this isn't that adjustable, since the
player.Vel vector controls how bobbing acts, but if you just want to control intensity of the normal Doom-style bobbing, that functionality is already here.
Bob speed already affects the bobbing intensity, if you check gzdoom.pk3/zscript/shared/player.txt the bob function looks like this:
[code]
void Bob (double angle, double move, bool forward)
{
if (forward && (waterlevel || bNoGravity) && Pitch != 0)
{
move *= cos(Pitch);
}
player.Vel += AngleToVector(angle, move);
}
[/code]
See how [i]move[/i] is used as the second as the second argument of AngleToVector? That means that [i]move[/i] controls the magnitude of the vector, meaning higher movement speeds give a higher bobbing intensity. The Bob function is called from the virtual MovePlayer, so if you want to change how bobbing works, you'll want to override MovePlayer and write your own Bob function (or, in some cases, it may be sufficient to just pass different arguments to Bob inside MovePlayer). Now of course, this isn't that adjustable, since the [i]player.Vel[/i] vector controls how bobbing acts, but if you just want to control intensity of the normal Doom-style bobbing, that functionality is already here.