Combat in unity

if im creating a game like saying skyrim or even a straight fist fighting game when it comes to the collision and animations is character controller or box colliders the right way to go still? as far as the combat goes relating to hands and feet?

i cant see how those options work with that type of game…

This is not including weapons because those i know can use basic colliders. thanks in advance guys

Use capsule colliders for all body parts, they are much faster and more precise than box colliders.

They’re faster but much is completely wrong. They’re only slightly faster.

I thought sphere colliders were fastest.

1 Like

ok so basically i should you capsule collider for length of the body like usual and then for each body part(both arms and legs), put a collider on each?

im getting mixed answers which collider should i use or is the speed so minimal it doesnt matter? the game will have a fallout/skyrim feel with the exception of waaaayyyyyyy better combat lol

thanks for the answers guys

IIRC the Sphere collider is quickest, then the capsule collider then the cube collider. Though these only become obvious when you have thousands of them in a scene.

On the subject you asked about, if the game isn’t multiplayer then just having a capsule over the player will give a better feel. The general idea is you have three, the collision collider, the positive collider and the negative collider. These can be on different layers. The collision collider should be roughly the same size as the player. The positive collider should be a little larger and the negative collider should be a little smaller. The positive collider is used for things like picking up items and talking to people while the negative collider is used for things like when you take damage.

ok that i get that, but my main concern is for fighting really. am i to put a capsule collider on each body part (Head,arms,legs,feet,body)? i want to have a nice combat system that properly detects the punch or kick or head butt lol and also in skyrim , when the enemies health got to a certain level you would do a type of finishing move i want to implement this (on a much cleaner scale tho lol) this is what im mainly concerned about thanks

Triggering execution can be done with simple “if” statement that triggers pre-made execution event/animation…
And like ppl said, you could use single collider for player, if it’s a first person game than it won’t matter much, what you want is detailed colliders on enemy characters and remember to put the coliders on the bones so they get animated accordingly.

OK C# or animation isn’t the problem I was just confused on the whole detecting the hand and feet as hits …thanks for the clarification I appreciate it! So your saying that one capsule collider should do it? Its third person game(might add first person view)

Well, you could add collision to the hands and stuff but for a single player game this makes the controls worse. The only time you’d do that is for a multiplayer fighting game.

The only difference between a multiplayer fighting game and a singleplayer fighting game is more human players. You wouldn’t change how the game works. Effectively, you are saying that adding collision detection to hands “and stuff” would make the controls worse in a multiplayer fighting game too.

Hey Daniel, that’s what I thought, so I could use multiple colliders for more precise combat cause I’m not using weapons that’s easy the hands and feet confuse me a tad bit

No, NPCs dont complain if they are treated unfairly, its easy for a player to be a tiny bit off then they will rage at the game because they think they should have hit but they didn’t, in multiplayer they just have to deal with it(Well, the hits are way bigger then the characters hands anyway) I don’t mean have a second set of collisions for the single player, but if the game is only singleplayer then don’t bother with fine controls.

Its easy, each bone in you character can have a hitbox, that way it will be smooth with animations, then just record which collider is which part, when the attack animation is played check for collisions on that part.

1 Like

OK that makes sense that sounds more like the effect I want “fine” tune hits, want to be like assassin creed if I wanted to

hey guys one last thing will this work best if i handle my own physics using rigibody or character controller will do?

A spherical collider would make most sense as being the most efficient as it should only need to calculate the difference between two positions. It would need to determine if the magnitude of the distance between the center of the sphere and the other object in question is less than the radius.

I would imagine it’d more complex to determine if an object is in a box.

ok my last question tho was for character movement should i use rigidbody physics or character controller? i assume using real physics would be correct since combat needs to look fluid but i want tomake sure im on the right track

Hey,

I’m running into an issue with attaching hitboxes to the bones (as someone mentioned above), and I was wondering if anyone has solved this. My raycasts are going through my boxes when my animation is playing … I turned updateMode to AnimatePhysics but its just not making any difference. Any ideas? I’ve been surfing the web / trying everything I can think of for hours now …

Why use ray casts. Just use the PhysX collision. You can even get unlimited variation in reaction to a hit if you find the parent of the bone chain hit and turn the children to non-kinematic rigid bodies momentarily and apply a force based on the vector of the collision.hit. You could even take the value of the impact force and decide that if above a certain value that the force would travel up the bone chain and diminish by such and such a value per bone. You also have to apply CharacterJoint to each bone collider. Capsules do the best for bones. A box on fists and feet are fine and can be used to determine if the feet or hands are the actual collision by checking the collider type.