Jump to content

Server-side Hit Detection?


Raggar
 Share

Recommended Posts

This is my current setup:

.Player presses the Mouse button

.A Ray is fired using Babylon and the players camera

The intersection point (vector3) is sent to the server

The server uses Cannon to do it's own intersection testing (Using the player's head hitbox(Same location as the camera client-side) as the origin point, and the vector3 from the client as the target point.

 

Now, if I wanted the server to be a bit more authoritative when it comes to hit detection, I shouldn't send the point from Babylon, but rather a 'fire' command, and, somehow, calculate a point that Cannon can use for it's own testing.

The server is aware of the position of the origin vector, and has the rotation of the player's physics body. Now, my math is worse than bad, so:

Would it be possible to calculate a point, a fixed distance away, using only the origin vector and the direction in which the point should be placed?

I've seen various posts and discussions about it, but I really don't quite get it.

Oh. And I know aimbotting isn't impossible to prevent, but I feel like the above method, that I already use, makes a bit too easy to achieve.

Link to comment
Share on other sites

  • 3 months later...

Let me revive my thread for half a second.

I'm working on a smaller project right now, but a few days I thought up an idea that maybe should have been obvious from the beginning.

I can use the same method I use to calculate the right velocity for my player body, based on rotation, to achieve this.

But instead of applying velocity to the player body, I apply units to a simply physics body with a box shape and no mass or collision response.

This way, all it takes is the rotation that is already being sent as well as the mouse pressed command. This requires traditional aimbotting to cheat, which is easier to spot as well.

It's almost a shame, as my current hybrid model has hitboxes on head, upper body, lower, left lower arm, upper, right, leg, leg, etc. synched with the model, and I can't think of a performant way of recreating these server-side, while synching them with all the clients. Body, head and arms are relatively easy I believe. Problem is the animated parts like the legs. We'll see. I'm only a 1-man team, so simple hit boxes might be preferable for now. :P

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...