Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PM_CheckFalling angle boundary doubt #995

Open
dystopm opened this issue Aug 13, 2024 · 3 comments · May be fixed by #996
Open

PM_CheckFalling angle boundary doubt #995

dystopm opened this issue Aug 13, 2024 · 3 comments · May be fixed by #996

Comments

@dystopm
Copy link
Contributor

dystopm commented Aug 13, 2024

// punch z axis
pmove->punchangle[2] = pmove->flFallVelocity * 0.013;
if (pmove->punchangle[0] > 8.0f)
{
pmove->punchangle[0] = 8.0f;
}

Should the boundary check the Z axis instead of the X axis?

@dystopm
Copy link
Contributor Author

dystopm commented Aug 13, 2024

@s1lentq @wopox1337

@wopox1337
Copy link
Collaborator

wopox1337 commented Aug 14, 2024

pmove->punchangle[2] = pmove->flFallVelocity * 0.013;

  1. I have BIG doubts that the screen should rotate along the Z axis.

    In game engines BEFORE GoldSrc and AFTER, the screen has a logical "forward" tilt on the X axis when falling.

    Therefore, only the line that unreasonably rotates the Roll angle needs to be fixed.

  2. Also, investigating all possible source code of other similar engines it was found that the value here should be 0.01 (1% of the fall velocity to apply the angle).

Sources:

CS:GO:

https://github.com/perilouswithadollarsign/cstrike15_src/blob/f82112a2388b841d72cb62ca48ab1846dfcc11c8/game/shared/gamemovement.cpp#L4397-L4408

	float flFallVel = player->m_Local.m_flFallVelocity;
	if ( flFallVel > 16.0f && flFallVel <= PLAYER_FATAL_FALL_SPEED )
	{
		// punch view when we hit the ground
		QAngle punchAngle = player->GetViewPunchAngle();
		punchAngle.x = (flFallVel * 0.001);
	
		if ( punchAngle.x < 0.75 )
			punchAngle.x = 0.75;

		player->SetViewPunchAngle( punchAngle );
	}

Source-sdk-2013

https://github.com/ValveSoftware/source-sdk-2013/blob/0d8dceea4310fde5706b3ce1c70609d72a38efdf/mp/src/game/shared/gamemovement.cpp#L3978-L3986

	//
	// Knock the screen around a little bit, temporary effect.
	//
	player->m_Local.m_vecPunchAngle.Set( ROLL, player->m_Local.m_flFallVelocity * 0.013 );

	if ( player->m_Local.m_vecPunchAngle[PITCH] > 8 )
	{
		player->m_Local.m_vecPunchAngle.Set( PITCH, 8 );
	}

Player fall tilt in Quake 2 (video)

Quake 2 RTX | P_FallingDamage (screen shake angle)

Q2 source code: https://github.com/id-Software/Quake-2/blob/372afde46e7defc9dd2d719a1732b8ace1fa096e/game/p_view.c#L560

Quake family engine tree

https://upload.wikimedia.org/wikipedia/commons/8/85/Quake_-_family_tree_2.svg

some reflections https://hlfx.ru/forum/showthread.php?s=8f03de21bacaf9bf2192e8defd2b8d74&postid=123925

@dystopm
Copy link
Contributor Author

dystopm commented Aug 14, 2024

Actually it makes sense that roll changes, since it gives a feeling of imbalance. Changing pitch axis will provoke a little itch from client prediction, I suggest to only change the capping axis to Z instead of X and leave roll axis changing, what do you think?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants