dbrizov / NaughtyCharacter

Third Person Controller for Unity
MIT License
988 stars 139 forks source link

Where is the code from character collisions ? #6

Closed horemhamer closed 2 years ago

horemhamer commented 3 years ago

I would like to know where the collisions are programmed since I have added an animation of crouching to the character and they work badly for me.

dbrizov commented 3 years ago

The collisions are handled by Unity's CharacterController. It uses an algorithm called "collide and slide". You basically have to override the collision check functions associated with the CharacterController

On Thu, Oct 21, 2021, 20:08 horemhamer @.***> wrote:

I would like to know where the collisions are programmed since I have added an animation of crouching to the character and they work badly for me.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/dbrizov/NaughtyCharacter/issues/6, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA3TV5OLMTXEL5HT6SXSD33UIBCIRANCNFSM5GOTSIDQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

horemhamer commented 3 years ago

I've never really used that, I've always used box colliders, etc.

dbrizov commented 3 years ago

When you make a call to the Move() function of the CharacterController, it handles collisions automatically. Internally they are using NVIDIAs API for character controllers. There is the actual collide and slide algorithm implementation

On Thu, Oct 21, 2021, 20:20 horemhamer @.***> wrote:

I've never really used that, I've always used box colliders, etc.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/dbrizov/NaughtyCharacter/issues/6#issuecomment-948841769, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA3TV5J5PZPXMGZUEGLQIGLUIBDVXANCNFSM5GOTSIDQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

horemhamer commented 3 years ago

If anything about how it works can happen to me, because I honestly don't know how to do it

horemhamer commented 3 years ago

I haven't been using unity for a long time

horemhamer commented 3 years ago

I have been able to solve it, I don't know if you mean this xd, I have modified the parameters of the character controller