As the title says, I’m looking forward to find a new method. I already tried different methods:
Raycasting, which I always use for my combat systems
Region3, I tried this and it looks very good, but many times it doesn’t work properly (ex. you can hit behind the player’s character);
Touched, very laggy and unresponsive. The hit is very delayed;
Magnitude, well it “works” but as you all know, it finds target near to the player in any direction, which is not what I’m looking for.
The best way would be to make the client do the hit, then fire a remote to the server telling the server which player was hit, but that would be a mess cause of exploiters.
So: does anyone here know how to create a good non-laggy and functional combat system? And also, what method do you recommend in the 4 I mentioned? Thanks!
Yeah you’re not really giving us any information here. The methods one uses depends entirely on what one is trying to make.
A melee combat system is a very vague. There are lots of different kinds of melee combat games out there. Something like mordhau and something like insert MMO here aren’t going to be comparable at all
I am curious to know what method did you use for the combat knife tool in your Project (The Wild West). I am assuming you used raycasts (since it is a pretty nifty function), but with short distances and curvatures.
local threshhold = 0 --set this number to the ‘percent’ at which the object is facing the target (-1 for fully facing away, 1 for completely facing the target); values go for all real numbers between -1 and 1
function ObjIsLookingAtTarget(object,target) --make sure all arguments passed in this function have a CFrame value
local dot = (object.CFrame.LookVector:Dot(target.Position-object.Position).Unit) – computes the dot product between the object and target
print(dot>=threshhold) – is the object facing the target?
return dot >= threshhold – will return a true or false value for later usage
end
No idea what all this code means. Just grabbed it from somewhere.
Just wanted to throw this out there, to get you on the right track if you’re interested.
But you could mix magnitude with something that returns whether or not you’re facing someone.
Also I don’t think a quick frame magnitude check is too expensive to need to put it on client.
As you said in my opinion the best way is to wait for the hit in the client and then fire a remote to the server that’s the way that will give u the best response in my opinion and then u can just do checks in the server to see if that hit actually should have hit , like magnitude check or raycast btwn the
(target and you) to see if there is a part btwn both I cant think about more but there is surely more.
Oh someone found this topic after 1 year.
And yeah, surprise surprise, I use GetPartsBoundsInBox. I find it extremely useful. It’s basically Region3 but easier to setup and more advanced. More customizable too i’d say.