functions for custom player  controller