Player inventory for VR and keyboard players
Golf balls can be placed and picked, golf clubs can be spawned and returned back.
Keyboard player:
- On Alpha 2 keypress (number 2 on english keyboard, ě on czech keyboard) raycasting is started and ball appears on the ground in front of player (ray is going through the aim dot, so the ball will appear there, if player is aiming on surface that ball can be placed on). On second keypress of that key, raycasting is canceled and ball disappears.
- If action key (E) is pressed while raycasting, ball will stay on the ground and rigidbody and collider will be applied to it (so it will most probably start rolling away).
- Golf club spawning has 3 states, state 0 is when no club is shown, on state 1 putter is shown next to player (on his right side), on state 2, 5 Iron club is shown. You can iterate through these states by pressing Alpha 1 key.
VR player:
- On left primary button press, ball will show on the end of ray and will be moving with ray. On another press, raycasting is canceled.
- If left trigger is pressed while raycasting a ball, ball will be placed on the ground (same as in keyboard player).
- Golf club spawning has 3 states (same as keyboard player). Iterating through these states is done with right primary button. Golf clubs will appear in front of player so they can be grabbed.
Other changes:
- Add ball counter above the ball that is raycasted on the ground. This is very useful for VR player, because as of now, he cannot see number of balls that he has.
- Add haptic feedback for VR player on some actions (club grab, no clubs in inventory, no balls in inventory).
- Change colliders on clubs. Add box collider on bottom of the clubs for better hit precision.