AlliedModders (
-   Scripting (
-   -   [CS:GO] Calculate jump distance(long jump) (

Rogerbot 07-22-2020 18:34

[CS:GO] Calculate jump distance(long jump)
Is it possible to calculate the distance only starting from the red line (, if someone is running in the white part and jumps before the red line only calculates the distance between the red line and land position, something like this:

Kellan123 07-23-2020 10:23

Re: [CS:GO] Calculate jump distance(long jump)

Rogerbot 07-23-2020 15:51

Re: [CS:GO] Calculate jump distance(long jump)

Originally Posted by Kellan123 (Post 2711280)

I've seen that when i was searching for this, but how do i get players landing position and if i use that how can i make it so when players jump from different positions like these (red line is where they jump, green and blue is the air time and yellow is the landing) end up with the same result so the player that jumped diagonally doesn't get more distance.
I don't know if i was clear, english isn't my first language and thank you for the response.

kadet.89 07-26-2020 11:00

Re: [CS:GO] Calculate jump distance(long jump)
You can calculate the trajectory and then trace it against a solid surface.
Here is a small explanation
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.

All times are GMT -4. The time now is 05:00.

Powered by vBulletin®
Copyright ©2000 - 2020, vBulletin Solutions, Inc.