Find out where the water hits the ground
#1

Hi,

I've been looking for ways to detect at which coordinates the water hits the ground when you spray with the firetruck's watercannon at any angle.

I've got some basic formula working, but it's not quite right.
When testing this, my code creates a small checkpoint to indicate the calculated coordinates.
Only at some specific angles and on flat terrain, the coordinates are correct.
But spraying horizontally or more vertically, or on elevated terrain, the coordinates aren't accurate anymore.

Like in single player, you could extinguish cars using a firetruck easily.
I want to be able to do the same thing.

Is there a standard way to detect this?
Some specific formula?
Reply
#2

Not really I would think there is no way to get the angles of the nozzle.
Reply
#3

Then there is really no proper way to create a firefighter class for example?

It should be possible, as single player has it working properly.

I've seen the nozzle goes up and down along with the player's camera, between 2 limited angles (maximum down and maximum up).
I've also been looking at some parabolic formulas on the internet.

If it's possible to interpolate the nozzle's angle based on the player's camera angle, and calculate the position of the nozzle based on the vehicle's coordinates and direction, something could be worked out I guess.

I can't believe nobody has tried such a thing before (and succeeded).

A perfect parabolic formula isn't needed, but it should be possible to calculate 5 to 10 steps of the parabolic line and do a distance check between those points and the burning target and see if at least one of those points is close to it.
And if it is, the player is spraying on the burning object to extinguish it.
Reply
#4

In Argonath for example they have a textdraw at the fire and they have a function to check if the textdraw is located in the middle of the screen, meaning if the water is being sprayed directly on the source.

I don't think you need to go all math on this one since there's got to be a way to do it more easily.

You might as well try IsPlayerLookingAtPoint function?

Код:
IsPlayerLookingAtPoint(playerid,Float:X,Float:Y,Float:Z,Float:ViewWidth,Float:ViewHeight)
You need this include for that though.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)