Chikanz / PolyRobots

Unity demo for the poly.pizza API

Home Page:https://poly.pizza/docs/api

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Poly Robots

header image

πŸ’‘ What?

Poly Robots is a demo of the poly.pizza api. Poly pizza is a website that hosts thousands of free low poly models under CC0 and CC-BY licenses. The site has an API that allows for real time loading of models into a game engine. You can view the API docs here

This example shows how you might load, scale, position and generate colliders in the Untiy game engine (it's harder than you think!)

πŸ–₯ Install

  • Make sure git is installed
  • Load up the project in Unity 2020.2.26f1 and install glTFast.
  • Get your API key from here (you'll need an account).
  • Paste your api key into the API manager on the spawner object unity screenshot

πŸ• Using it in your own projects

You can use the API manager in your own projects to load models from the poly.pizza api without reinventing the wheel.

  • First make sure glTFast is installed in your project as well as Unitask
  • Grab the PizzaBox directory and put it in your project

The API manager provides a few methods for loading and rendering models. First you'll need to decide what models you'd like to load. There's a few methods for this:

  • GetPopular(int limit) - Get an array of the most popular models on the site up to the limit you specify.

  • GetExactModel(string keyword) - Search for a model matching your keyword exactly. This is useful if you know what you want to load (like an apple or a monkey) but don't know the exact model.

  • GetModelByID(string id) - Get a model by it's unique ID. (crazy ik)

Once you've got the model data from the api you can make it into a gameObject with the MakeModel(Model model, float scale = 1, bool positionCenter = false) Positioning the model is tricky since the models origin can be totally fucked. Check out spawner.cs to see how to position objects where you want them.

πŸ€“ Deep lore

The Robot in this scene is a shittily rigged version of Doodle by Jeremy Edelblut [CC-BY]. A version of this lil robt guy was used to promo the Google Poly api, which poly pizza was created to replace after it shutdown. I'd like to think after poly shutdown he quit his corporate job, got a sick paint job and is living his best life.

corpobots

doodleboy

About

Unity demo for the poly.pizza API

https://poly.pizza/docs/api

License:MIT License


Languages

Language:GLSL 38.6%Language:C# 33.7%Language:ShaderLab 22.3%Language:Mathematica 2.8%Language:HLSL 2.6%