• Stars
    star
    211
  • Rank 186,063 (Top 4 %)
  • Language
    C#
  • License
    Apache License 2.0
  • Created almost 6 years ago
  • Updated over 4 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Unity library to dynamically keep multiple objects in camera view

Dynamic Multi Target Camera for Unity

Concise Unity library which dynamically keeps a set of objects (e.g. players and important objects) in view, a common problem for a wide range of games.

The library was originally developed for, and used by Survival Ball, a game with a heavy shared screen local co-op component, requiring the camera to dynamically keep many key elements in view. More information about the library's inner workings and underlying math in the related blog article.

Get it for free on the Unity Asset Store

Camera Multi Target Example Scene Video

Camera Multi Target Example Scene Screenshot

Install

From Unity's Asset Store

Available at https://assetstore.unity.com/packages/tools/camera/camera-multi-target-dynamic-135922. Via Unity Editor, download and import the CameraMultiTarget folder into your project.

By importing CameraMultiTarget.unitypackage

The pre-built package can be downloaded from the repository's releases here. After downloading the package, import it to your project via Unity Editor: Assets -> Import Package -> Custom Package...

Or by cloning this repository

Clone entire repository (git)

This repository contains the complete Unity project which includes the library and an example usage scene. After you clone the entire repository using git, copy the Assets/CameraMultiTarget folder to your project

git clone https://github.com/lopespm/unity-camera-multi-target.git

Checkout specific features (SVN)

Since cloning a specific folder can be a quite convoluted process via git, you can checkout the Assets/CameraMultiTarget folder directly to your project using SVN:

cd <your_project_root_folder>
svn checkout https://github.com/lopespm/unity-camera-multi-target/trunk/Assets/CameraMultiTarget Assets/CameraMultiTarget

Or if you wish to only install the library without the example scene:

cd <your_project_root_folder>
svn checkout https://github.com/lopespm/unity-camera-multi-target/trunk/Assets/CameraMultiTarget/Library Assets/CameraMultiTarget/Library

Usage

Add the CameraMultiTarget component to a camera and then you can programatically set which game objects the camera will track via the component's SetTargets(GameObject[] targets) method.

For example, you can set the targets in your game controller component (if you choose to have one), like the following:

public class ExampleGameController : MonoBehaviour
{
    public CameraMultiTarget cameraMultiTarget;

    private void Start() {
        var targets = new List<GameObject>();
        targets.Add(CreateTarget());
        targets.Add(CreateTarget());
        targets.Add(CreateTarget());
        cameraMultiTarget.SetTargets(targets.ToArray());
    }

    private GameObject CreateTarget() {
        GameObject target = GameObject.CreatePrimitive(PrimitiveType.Capsule);
        target.transform.position = Random.insideUnitSphere * 10f;
        return target;
    }
}

Example Scene

An example scene of the library's usage is included in this repository and in the pre-built package located in the repository's releases.

Games using Dynamic Multi Target Camera

Did you develop, or know about, a game using this library? Add it here via pull request

More Repositories

1

arxiv-papers-mobile

ArXiv Papers, a React Native app, currently available for Android. Search, download and save arXiv scientific papers
JavaScript
72
star
2

agent-trainer

Using tensorflow, this agent can autonomously train itself to play Out Run and potentially be modified to play other games or perform tasks other than gaming
Python
67
star
3

autocomplete

Implementation of Autocomplete System Design for Large Scale - using Docker Compose
Python
58
star
4

react-native-offscreen-toolbar

Component which animates the toolbar off-screen while scrolling, a material design pattern.
JavaScript
22
star
5

hackernews-daily

Lightweight Daily Hacker News Best Stories, with Screenshots and Top Comments: https://lopespm.github.io/hackernews-daily/
Python
9
star
6

quick-fix-switchcompat-resources

A quick fix for the switch compat's issue with hdpi thumb resources
7
star
7

agent-trainer-deployer

Bash scripts for deploying agent trainer to a remote machine (AWS EC2 instance or Generic Linux remote machine).
Shell
3
star
8

agent-trainer-docker

Dockerfiles for building docker images with a pre-prepared environment for agent trainer.
2
star
9

compressed-deque

A python deque which compresses its items for a decreased volatile and persistent memory footprint
Python
2
star
10

lopespm.github.com

Byte Tank Blog
HTML
2
star
11

mobiscroll

Automatically exported from code.google.com/p/mobiscroll
JavaScript
1
star
12

ZipBrowserOSX

A Zip File Browser, based on the sample code provided by Apple
Objective-C
1
star
13

agent-trainer-results

Collection of agent trainer training sessions, each containing their resulting network, metrics and visualizations.
Python
1
star
14

personal_llm

Python
1
star