Skip to content
This repository has been archived by the owner on Sep 22, 2021. It is now read-only.

Nade Trajectory #139

Open
thiagofelix opened this issue Jan 23, 2018 · 5 comments
Open

Nade Trajectory #139

thiagofelix opened this issue Jan 23, 2018 · 5 comments

Comments

@thiagofelix
Copy link

Is it possible to grab the grenade trajectory from point where it is fired to the point where it explodes?

@econoraptor
Copy link
Contributor

econoraptor commented Jan 23, 2018

Yes, it's possible, though not through the public API. Each grenade has an associated projectile entity that you can track in the air. HEs and flashes are both CBaseCSGrenadeProjectile, molotovs and incendiaries use CMolotovProjectile and the others use CSmokeGrenadeProjectile CDecoyProjectile. You can track their positions using the Cell properties. If you want to see an implementation, look here: https://github.com/econoraptor/demoinfo/tree/DetonateInterpolate2

At a minimum you'll need to subscribe to the properties and use SetCellWidth and CellsToCoords to map the Cell values to normal position values.

@moritzuehling
Copy link
Contributor

We'd be open to a PR that opens the grenade-projectiles up via the API.

@thiagofelix
Copy link
Author

thiagofelix commented Jan 24, 2018

@econoraptor thanks for the explanation, I've been trying to track their trajectory using grenades velocity, angle, position at the throw moment but I think the cell strategy is more bullet proof.

@moritzuehling
Copy link
Contributor

@thiagofelix That method might have worked for demos where the snapshotrate matched the tickrate, but it would have been fairly inaccurate for all other demos.

@thiagofelix
Copy link
Author

@moritzuehling you'r right, just tried out using the cells and it worked like a charm =) thank you so much.

I am building a replay viewer that parses the demo in the browser itself on user's computer, sort of standalone app without need of a server, so far got everything I wanted working (player's position, nades, memory consumption acceptable)

Thanks again for the help

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

No branches or pull requests

3 participants