-
Notifications
You must be signed in to change notification settings - Fork 4
Getting Started
Welcome to the getting started guide for OpenPutt!
Please make sure that you have the VRChat Creator Companion (VCC) installed as well as the latest recommended Unity version. VCC should walk you through installing the correct Unity version anyway.
When you have both of those installed you will need to add a couple of library repositories to VCC, these repositories contain some libraries that OpenPutt relies upon to function. The web pages may look a little different but the process is basically the same for all.
First you will need to add Varneons VUdon Repository to VCC - Add VUdon to VCC

Third you can now add the OpenPutt Repository to VCC - Add To VCC

When finished with both you should see them listed inside Settings -> Packages -> Community Repositories

You can skip this if you already have a VRChat World Project open!
Create a new project by clicking the 'Create New Project' button

Now that you have a project and VCC set up correctly, you can add OpenPutt and its dependencies to your project.
If you are not already on the Manage Project page in VCC, please open it. It should look like the screenshot below.
Find OpenPutt in the list of packages and then click on the add button. This should install the latest version of OpenPutt and its dependencies for you.
When everything has finished installing you should have both of the packages highlighted in the screenshot below. If so everything is ready to go!

Once these have finished everything you need should be installed and you can now open your project.
Upon opening a brand new project the VRChat SDK should open up a default scene for you. You should probably click File -> Save As and save this scene into your assets folder so you can find it easier later.
Adding OpenPutt to your scene is fairly simple now with the addition of the Setup Helper window. At the top of your Unity window there should be a menu called 'OpenPutt' go into there and click on 'Open Setup Helper' (Screenshot below)

The Setup Helper is a tool I made to help detect issues with OpenPutt and make it a bit easier to fix them!
Now the Setup Helper is open, you can just click 'Add OpenPutt to the scene' and it will start adding the OpenPutt prefab to the root of your scene.
If you haven't used OpenPutt or TextMeshPro in this scene before, this window may appear:

Just click the 'Import TMP Essentials' to import the essentials needed to make TextMeshPro work in your scene.
Once finished you can close this window.
In OpenPutt I use the word 'Course' to define each level as each course can technically have more than one 'Hole'.
(As can be seen on the final hole of my test Junkyard Mini Golf world - it has 3 holes)
To add your first course we will use the course included with the demo scene data to make it simple.
This can be found inside Packages/OpenPutt/Runtime/DemoScene

Please drag the Hole1 object into your scene, make sure that it is not inside of the floor.

There is also a 'CourseSurface' material in the same folder, you can drag this onto the floor of the course to give it a texture for now.

Please disable the 'Cylinder' object!
(It was used to create the hole in the floor and was left there to help people see how I created them :))
Next we need to add colliders to the course so the ball can interact with it!
The process is as follows: Select Mesh -> Add Component -> Mesh Collider

To make it nicer for people in VR you should also swap the walls to be on the Walkthrough layer. This way the players don't collide or stand on the walls but the golf balls do.

We now need to set up physics materials on these 2 colliders so things work a bit nicer.
The Physics Materials can be found inside Packages/OpenPutt/Runtime/PhysicMaterials
You just have to drag the corresponding materials to they type of object that you're using them on. (FloorPhysics -> Floor mesh / Wall Physics -> Wall or obstacle mesh)

We now need to register this course with OpenPutt so it can keep track of scores etc
We can add a new course to OpenPutt from within the Setup Helper by clicking '+ Add New Course'

This will add an OpenPuttCourse prefab and register it with OpenPutt. This prefab contains a start pad with 3 starting positions and a box collider for the hole.

Place these into position like so:

Now we need to register the floor mesh with the course by dragging 'Hole1Floor' into the list of 'Floor Objects' on the OpenPuttCourse object:

This allows OpenPutt to tell whether a ball is still on its current course or not. If a golf ball is touching a mesh not in the list above for too long, it will be reset back to its last valid position.
Due to performance constraints, the scoreboards have to be setup and prepopulated before uploading your world. This will need to be done any time you change the number of courses in your scene. Failure to do so will result in the scoreboards crashing. Fortunately this is as easy as opening the Setup Helper and clicking 'Rebuild Scoreboards'

OpenPutt uses a 'pool' of scoreboards that are moved around the world dynamically. You can define where the scoreboards should be displayed by clicking '+ Add New Scoreboard Position' in the Setup Helper window. This will display a blank window that you can use to visually position the scoreboard for that area. There are some settings on the ScoreboardPositioner script but you can just leave them at their defaults for now.
Hopefully.. if I've done a good job writing this you should now have a golf project that has 1 course to play on!
You can press the play button at the top of the Unity window and give it a go.
Walk up to the start pad, and hold B on your keyboard and a line should be drawn the nearest start position. Let go to place your ball there and then press E to swap to the desktop camera and use your mouse to aim and shoot the ball towards the hole. If all goes well the scoreboard should update itself with the scores etc.
If you have problems please open an issue and hopefully I can help you get it working :)