samp-streamer-plugin
samp-streamer-plugin copied to clipboard
Point 1 to point 2 cylindrical and conic areas
The concept is to be able to define a cylinder area or a conic area by two points and a radius (well, two radii for the cone, where both points would have a radius).
On both shapes the two points are the axis endpoints, obviously. The radii will be around the axis. On the cylinder that will be throughout the entire axis, and the cone would have a gradient radius from one end to the other.
Suggested functions: Get Cone/Cylinder Unit Vector (from pt1 to pt2) Get Cone/Cylinder Length (from pt1 to pt2) All of streamer's area functions
I suggested this a while ago but I forgot about it, it was back when I made that zipline script. A function to grab the distance to a line is still around here: https://github.com/Southclaw/Zipline/blob/master/Zipline.inc#L317-L319 but obviously that only works for constant-diameter tube shapes not cone shapes.
Well I have PAWN code for checking points in cylinders and cone defined as I suggested, I made it a while back. It includes a DistanceFromPointToLine
function I wrote (well, JernejL wrote the code in C++ in his math plugin, I converted it to PAWN) which returns the distance and the point on the line that the point intersects (like, the circle that the point is in the radius of). https://github.com/Crayder/Notebook/blob/master/IsPointIn-Geometry
Also, I wrote in Python first, in case you want to see that for any reason: https://github.com/Crayder/Notebook/blob/master/IsPointIn-Geometry.py
Notice in both of those:
if (LineMag < 0.001):
return -1.0
That is not required, it just ignores lines that are extremely small.
And yeah I know you suggested the cylinder part once. I'm even pretty sure I commented on it. (Found it: https://github.com/samp-incognito/samp-streamer-plugin/issues/79#issuecomment-142565317)
I do like the idea. I suppose that you'd really only need the cone with two radii, though (that would be a truncated cone or conical frustum, technically). If both radii are the same, it would just be a cylinder. However, in terms of area detection, I can't think of many reasons why someone would need two different radii. A simple cylinder defined along an arbitrary axis (which is effectively just a "line" with some thickness) would be far more useful, I think.
I suppose that you'd really only need the cone with two radii
Which is actually how I do it in the code I linked above...
However, in terms of area detection, I can't think of many reasons why someone would need two different radii.
I can think of a few reasons why I alone need a cone area. One for example, my proximity mines. They check if players are in a cone. My laser tripper mines use cylinders, since a laser is just a line.
Look here: https://github.com/Crayder/Notebook/blob/master/mine-concept.pwn This script would no longer require using OnPlayerUpdate or the slow PAWN functions if you add this! I would only need to check stuff in OnPlayerEnterDynamicArea, super simplified!
@Crayder Spheres...
@Patrik356b streamer already has spheres... lol
nono. I mean you could use them for proximity mines and such.
@Patrik356b Nope, that's a horrible concept. That's not how a proximity mine or a laser tripping mine works. Plus this isn't the only reason I need cones and cylinders, this was just a primary example.
Not horrible. Different perhaps. I don't see why you couldn't just use a cylinder if a sphere wouldn't be adequate.
(but a proximity mine could technically be built to trigger over a spherical area)
On Sun, Sep 4, 2016, 05:57 Corey Iles [email protected] wrote:
@Patrik356b https://github.com/Patrik356b Nope, that's a horrible concept. That's not how a proximity mine or a laser tripping mine works.
— You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub https://github.com/samp-incognito/samp-streamer-plugin/issues/139#issuecomment-244582964, or mute the thread https://github.com/notifications/unsubscribe-auth/AB6HP3GvurC4y3kXzU5_LCDxsEht-19sks5qmkGjgaJpZM4JyIwP .