Object CollX, CollY, CollZ position?
#1

Hello guys,

I am working on a new thing in SA:MP, but I got stuck in some kind of strange problem.

So, my problem is, I need to find two object's intersection point. Namely there are 2 objects which is getting moved, and I would like to find the intersection (or hit position) of the two objects, if they hit each other.

This is very smiliar to the OnPlayerWeaponShot callback which returns the bullet's impact.

I'll try to explain it with a picture (it's really hard to show a 3D element on a 2D picture):


So the red line shows the object's arrival point and the yellow is the impact of the two objects.
Reply
#2

You may find your answer in this:
https://sampforum.blast.hk/showthread.php?tid=446286
https://sampforum.blast.hk/showthread.php?tid=407909
Reply
#3

You could try contacting IceCube! as he seems to have worked on that recently: http://forum.sa-mp.com/showthread.ph...68#post3182268
Reply
#4

Hey,

MicroD's the ModelSizes.inc I've never seen before but on brief and I mean just glancing here. It would do the job, however it doesn't seem the check a only the objects near the client. Therefore running this for every client every time they fie a single bullet could cause your server to lag due to the sheer processing volume. If you have an MP5 for example, and you fire 100 shots, that has to loop through the loop of 19902 objects each time. That's 1990200 checks for 100 shots.

This is another reason why I made this in plugin form as Mauzen said. Although this would be much more efficient as I could check, the player co-ordinates and then load the IPL file relative to where the player is along with the collision ID's from the the objects stated in the IPL file. This would make a loop of 19902 objects more like 30 or 40 checks at the most (I can't remember how many items are in the largest IPL file.).

EDIT: Just thought I'd clarify this more. Server objects could be defined to a pre-existing .IPL file or they could be loaded 24/7. This means that you would only check these server objects when they are near them, (where you have defined with:

pawn Код:
CollisionForObject(objectID, OPIONAL "IPLFileName");
Or even create your own IPL file to cover a smaller distance or a new Mapped area (Warning: Will actually create a .IPL to save memory).

pawn Код:
CreateIPL("Name");
AddToIPL("Name", ...);
The ...'s are encase I do release this officially and that anyone sees this and the paramaters are named differently. Just posted this edit... as a second guy added me asking how I'd detect server Objects as my post was "unclear". #END OF EDIT.

If you would like the plugin, you should contact me on Skype. However I cannot give you this today, as I deleted it thinking it was useless. Until others opened my eyes and told me it wasn't and they had many idea for it.

You would still however have to use some guess work, using the players camera vector to find the players line and sight and likely bullet path. As SA comes with minimal bullet physics, I don't know if this follows a path or hits anything near by, therefore finding it would be difficult to get accurate. This however would be apart of the "TraceLine" function which would be player camera vector to nearest collision.
Reply
#5

Thank you very much guys. I'll try it, if I have any problems I'll post here.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)