View Single Post
kadet.89
Veteran Member
Join Date: Nov 2012
Location: Serbia
Old 07-26-2020 , 11:00   Re: [CS:GO] Calculate jump distance(long jump)
Reply With Quote #4

You can calculate the trajectory and then trace it against a solid surface.
Here is a small explanation https://translate.google.com/transla...st%2F131931%2F
Read the description below the image with jumping mario.
Use TR_TraceRay to get an intersection point with a solid surface.

The information you need is in these properties:
m_angAbsRotation - player angle
m_vecAbsOrigin - player position
m_vecAbsVelocity - player velocity
m_flGravity - gravity
m_flFriction - friction
GetGameTime() - engine time

To get the jump moment hook PlayerRunCmd and check if IN_JUMP button is pressed. Alternatively you can use m_hGroundEntity property. It is only valid when player is on the ground.
If the surface is curved, use TR_TraceHull, it will give a more precise result.
And one more thing - players can change their trajectory while in the fly. To make sure it doesn't happen, return Plugin_Handle in PlayerRunCmd.

Last edited by kadet.89; 07-26-2020 at 11:10.
kadet.89 is offline
Send a message via Skype™ to kadet.89