Note: Heads up! If you're looking for the scripts of tutorials, goto the tutorials page

Downloadable Assets, Scripts and Packages

beat8.unitypackage

download


working from the home computer

C# History.docx

download view


history of features added to each version of c#

CamMove.cs

download view


Use this C# script by attaching it to a camera. Then the camera will rotate and be able to zoom in/out around a centerpoint you specify in the inspector window for the script.

get-with-computer-program.jpg

download view


omarvision wallpaper

InputManager.asset

download view


input settings file that works with up to 2 gamepads written by Omarvision. Put the file in your unity ../ProjectSettings/ folder. You may have to reopen your Unity project to take effect

Jan-2020-Camp.jpg

download view


Jan 2020 Omarvision Game Camp Flyer

NavMeshComponents.zip

download


dynamic navmeshes can be built at runtime.

nyc subway 2.jpg

download view


omarbvision wallpaper

omarvision kids coding subway.jpg

download view


omarvision wallpaper

omarvision-my-hero-academia.jpg

download view


omarvision wallpaper

omarvision-wallpaper-205.jpg

download view


omarvision wallpaper

omarvision-wallpaper-alchem.jpg

download view


omarvision wallpaper

omarvision-wallpaper.jpg

download view


omarvision wallpaper

Assets

Dynamic Navmesh - Download or GitHub

Build navmeshes dynamically from script at runtime. Drag and drop folder into Unity project.

  • NavMeshSurface - added to gameobject, can build navmesh from script
  • NavMeshModifier - added to gameobject, build navmesh around object
  • NavMeshObstacle - added to gameobject, dynamically updates navmesh with carve property.

InputManager.asset - Download

Standard input definitions, plus 2 joystick input definitions.

Model Download

Functions

Function 1 - CreateAudioSource()

Adds audiosource component to gameobject. And loads sound file to it. Sound file must be in a folder called "Resources" at root of Assets folder. Name must be specified without extension.

private AudioSource CreateAudioSource(string filenamenoextension)
{
    AudioSource audio = this.gameObject.AddComponent<AudioSource>();
    audio.clip = Resources.Load<AudioClip>(filenamenoextension);
    return audio;
}

Function 2 - FirstPersonControls()

First person controls for a player gameobject with the Main camera as a child object. The main camera must be reset to the player gameobject location.

private void FirstPersonControls()
{
    //move control (W,A,S,D keys)
    float V = Input.GetAxis("Vertical");
    float H = Input.GetAxis("Horizontal");
    this.transform.Translate(Vector3.forward * V * 3.5f * Time.deltaTime);
    this.transform.Translate(Vector3.right * H * 3.5f * Time.deltaTime);
    
    
    //look control (mouse)
    float mX = Input.GetAxis("Mouse X");
    float mY = Input.GetAxis("Mouse Y");
    Vector2 mouseLook = new Vector2(mX, mY);
    mouseLook = Vector2.Scale(mouseLook, new Vector2(120.0f, 120.0f));
    this.transform.localRotation *= Quaternion.AngleAxis(mouseLook.x * Time.deltaTime, Vector3.up);
    Camera.main.transform.localRotation *= Quaternion.AngleAxis(-mouseLook.y * Time.deltaTime, Vector3.right);
}

Function 3 - GetMouseClickPoint()

Get the position within the 3D scene that the mouse click hits a gameobject. Return the Raycast hit object.

private bool GetMouseClickPoint(out RaycastHit hit)
{
    if (Input.GetMouseButtonDown(0) == true)
    {
        Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
        return Physics.Raycast(ray, out hit);
    }
    return false;
}

Unity Packages

Multiplayer Download

TPose Animate Download

First Person Download

3d fighter Download

zoe fighter Download

Note: install 2D Animation package before import

Mr Peabody 2D Download

Note: install 2D Animation package before import

TagURIT3 Racing Download

Olivia Maze Download

MakingRacing Download

2d fighter Download

Transform To Target Download

3D Walking Adventure Download

Scripts

IMPORTANT: Unity script classname and filename must match

Script 1 - MoveControl.cs

This script allows a user to control movement of gameobject along the X, Z plane. Movement is with the W,A,S,D keys, or the Arrow keys, or the Joystick Left Analog stick. It uses the InputManager definitions of "Horizontal" and "Vertical"

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class MoveControl : MonoBehaviour
{
    public float MoveSpeed = 3.5f;

    private void Update()
    {
        float horizontal = Input.GetAxis("Horizontal");
        float vertical = Input.GetAxis("Vertical");
        this.transform.Translate(Vector3.right * horizontal * MoveSpeed * Time.deltaTime);
        this.transform.Translate(Vector3.forward * vertical * MoveSpeed * Time.deltaTime);
    }
}

Script 2 - LookControl.cs

This script requires a Camera be attached as a child gameobject. Is allows the rotation of the gameobject on the Y axis, and the rotation of the Camera on the X axis. In other words it allows the gameobject to rotate and look up and down.

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class LookControl : MonoBehaviour
{
    public float Sensitivity = 90.0f;
    public bool LockMouse = true;
    private Camera ChildCamera = null;

    private void Start()
    {
        Renderer rend = this.GetComponent<Renderer>();

        ChildCamera = this.transform.GetComponentInChildren<Camera>();
        ChildCamera.transform.position = rend.bounds.center;
        ChildCamera.transform.Translate(Vector3.up * (rend.bounds.size.x));
        ChildCamera.transform.rotation = this.transform.rotation;

        if (LockMouse == true)
        {
            Cursor.lockState = CursorLockMode.Locked;
        }
    }
    private void Update()
    {
        float mousex = Input.GetAxis("Mouse X");
        float mousey = Input.GetAxis("Mouse Y");
        this.transform.localRotation *= Quaternion.AngleAxis(mousex * Sensitivity * Time.deltaTime, Vector3.up);
        ChildCamera.transform.localRotation *= Quaternion.AngleAxis(mousey * Sensitivity * Time.deltaTime, Vector3.left);

        if (Input.GetButtonDown("Cancel") == true)
        {
            Cursor.lockState = CursorLockMode.None;
        }
    }
}

Script 3 - ShootControl.cs

This script, when attached to a player gameobject, will create a shot object and then have it fire from the player

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class ShootControl : MonoBehaviour
{
    public GameObject ShotPrefab = null;
    public float ShotStrength = 5.0f;
    private Camera ChildCamera = null;
    private Renderer rend = null;

    private void Start()
    {
        rend = this.GetComponent<Renderer>();
        ChildCamera = this.transform.GetComponentInChildren<Camera>();
    }
    private void Update()
    {
        if (Input.GetButtonDown("Fire1") == true)
        {
            Ray ray = ChildCamera.ScreenPointToRay(new Vector3(Screen.width / 2.0f, Screen.height / 2.0f, 0.0f));
            Vector3 target = ray.origin + (ray.direction * 5.0f);

            GameObject projectile = Instantiate(ShotPrefab);
            projectile.transform.position = rend.bounds.center;
            Physics.IgnoreCollision(this.GetComponent<Collider>(), projectile.GetComponent<Collider>());

            Shot script = projectile.GetComponent<Shot>();            
            script.FireShot(target, ShotStrength);
        }
    }
}

Script 4 - Shot.cs

This script is to be attached to whatever gameobject you want to be the shot projectile

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Shot : MonoBehaviour
{
    public float LifeTime = 3.0f;
    private float mark = -1.0f;

    private void Update()
    {
        if (mark != -1 && (Time.time - mark) > LifeTime)
        {
            Destroy(this.gameObject);
        }
    }
    public void FireShot(Vector3 target, float strength)
    {
        Rigidbody rb = this.GetComponent<Rigidbody>();
        Vector3 direction = target - this.transform.position;
        rb.AddForce(direction * strength, ForceMode.VelocityChange);
        mark = Time.time;
    }
}

Script 5 - PlayerTouch.cs

This script allows a user to control movement of gameobject along the X, Z plane. Movement is with the W,A,S,D keys, or the Arrow keys, or the Joystick Left Analog stick. It uses the InputManager definitions of "Horizontal" and "Vertical"

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

[RequireComponent(typeof(Rigidbody))]
public class PlayerTouch : MonoBehaviour
{
    //event
    public delegate void PlayerCollect();
    public static event PlayerCollect OnPlayerCollect;
    public delegate void PlayerTouchEnemy();
    public static event PlayerTouchEnemy OnPlayerTouchEnemy;

    public string EnemyTag = "Enemy";
    public string CollectableTag = "Collectable";
    private Rigidbody rb = null;

    private void Start()
    {
        rb = this.GetComponent<Rigidbody>();
        rb.constraints = RigidbodyConstraints.FreezeRotationX | RigidbodyConstraints.FreezeRotationZ;
    }
    private void OnCollisionEnter(Collision collision)
    {
        if (collision.gameObject.CompareTag(EnemyTag) == true)
        {
            if (OnPlayerTouchEnemy != null)
            {
                OnPlayerTouchEnemy();
            }
            Destroy(collision.gameObject);
        }

        if (collision.gameObject.CompareTag(CollectableTag) == true)
        {
            if (OnPlayerCollect != null)
            {
                OnPlayerCollect();
            }
            Destroy(collision.gameObject);
        }
    }
}

Script 6 - CanvasController.cs

This script allows a user to control movement of gameobject along the X, Z plane. Movement is with the W,A,S,D keys, or the Arrow keys, or the Joystick Left Analog stick. It uses the InputManager definitions of "Horizontal" and "Vertical"

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI; //for Text

public class CanvasController : MonoBehaviour
{
    public Text txtCollected = null;
    public Text txtEnemies = null;
    private int NumCollected = 0;
    private int NumEnemies = 0;

    private void OnEnable()
    {
        PlayerTouch.OnPlayerCollect += OnPlayerCollect;
        PlayerTouch.OnPlayerTouchEnemy += OnPlayerTouchEnemy;
        SetCollected(NumCollected);
        SetEnemies(NumEnemies);
    }
    private void OnDisable()
    {
        PlayerTouch.OnPlayerCollect -= OnPlayerCollect;
        PlayerTouch.OnPlayerTouchEnemy -= OnPlayerTouchEnemy;
    }
    public void SetCollected(int value)
    {
        txtCollected.text = "Collected " + value.ToString();
    }
    public void SetEnemies(int value)
    {
        txtEnemies.text = "Enemies " + value.ToString();
    }
    private void OnPlayerCollect()
    {
        NumCollected = NumCollected + 1;
        SetCollected(NumCollected);
    }
    private void OnPlayerTouchEnemy()
    {
        NumEnemies = NumEnemies + 1;
        SetEnemies(NumEnemies);
    }
}