Hertzole / gold-player

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

Improvements to interaction system #26

Closed ghost closed 5 years ago

ghost commented 5 years ago

First off: thanks for the great base controller. It's been lovely having something to drop in for prototyping. I assume I'll customize it a bunch for our game but this has been the simplest drop-in controller I've found that actually feels good.

So this change fixes a bug I encountered whereby nested interactables were un-interactable because the interaction system assumed that the collider and the transform were the same object. In my case I had this hierarchy:

With the old code it saw that I was looking at the button but used the Elevator's transform because that's the transform of the rigid body itself. This change switches to tracking the collider the player is looking at and prefers interactable components on the collider over interactable components on the rigidbody.

Hertzole commented 5 years ago

I'm glad you've seemed to enjoy the controller and I'm even more happy to see that you want to contribute!

The changes make sense and I'll merge them. Thanks a ton for your contribution!