Hertzole / gold-player

A first person player controller for Unity.
MIT License
160 stars 16 forks source link

Allow for camera based recoil/external forces being applied to the camera rotation #37

Closed Kellojo closed 3 years ago

Kellojo commented 3 years ago

Hi, first off, thanks for creating such a cool player controller. I keep coming back to it, ever since I found it some day πŸ˜„

Is your feature request related to a problem? Please describe. I would like to be able to apply camera recoil to the player controller, while still respecting the Minimum X and Maximum X rotation of the camera.

Describe the solution you'd like I would like to have a method like ApplyExternalRotation(float horizontal, float vertical) available to me on the PlayerCamera module. It should then add the two values to the internally tracked rotation of the Camera Head. This way we could modify the camera rotation by external forces, without having to sacrifice the limits emposed on the character.

For sure, there is a problem, when reaching the maximum rotation due to the external forces. I think though this is fine.

Describe alternatives you've considered I.e. adding a child to the Camera Head and applying the recoil there can be done, but leads to the min and max values being shifted by the applied recoil.

Additional context Add any other context or screenshots about the feature request here.

Hertzole commented 3 years ago

Hi! I'm glad you're enjoying Gold Player! :)

There is the ApplyRecoil(amount, time) method that may be useful for you. If it isn't enough for you, please tell me what you think is missing and we can sort it out. :)

Kellojo commented 3 years ago

just saw, this is already part of the PlayerCamera module. Well, nvm then πŸ₯‡

Hertzole commented 3 years ago

Like I said, if you feel like it's not working the way you want it to work you can tell me and I'll if there any changes that could be made. Feel free to comment here or make a new issue! I'll be closing this for now.