private AdjustGroundVelocityToNormal ( Vector3 hVelocity, Vector3 groundNormal ) : Vector3 | ||
hVelocity | Vector3 | |
groundNormal | Vector3 | |
Результат | Vector3 |
private Vector3 AdjustGroundVelocityToNormal(Vector3 hVelocity, Vector3 groundNormal)
{
Vector3 sideways = Vector3.Cross(Vector3.up, hVelocity);
return Vector3.Cross(sideways, groundNormal).normalized * hVelocity.magnitude;
}