Git Product home page Git Product logo

springarmcomponent's Introduction

Build Status CodeFactor

platforms GitHub size

Recreation of Unreal's Spring Arm Component in Unity.

Spring Arm Component is a solution for cameras to expand/retract based on gameplay situations. Typically when you add a Camera to a character for the purposes of creating a third person perspective. Spring Arm automatically controls how the camera handles situations where it becomes obstructed by level geometry or other objects in the level.

Features

  • Multiple collision detection using Raycasts
  • Collision test resolution for different levels of preciseness
  • TPS camera movement integrated
  • Takes a minute to setup
  • Fully commented code for better understanding

Getting Started

Set the “Tool Handle Position” to Pivot mode for this to work correctly.

Image

Just drag and drop the SpringArm prefab from Prefabs folder to Hierarchy and delete your existing Main Camera or alternatively create a new GameObject, add SpringArm Script to it and make your Main Camera the child of this gameobject.

Image

Image

Usage

  • Target : The gameobject (Transform) which SpringArm has to follow.

  • Movement Smooth Time : The camera lag time while following the target.

  • Target Arm Length : Maximum distance to which the camera can move to behind the target. (Red line)

Image

  • Socket Offset : Offset for the camera from the SpringArm (Socket is the position where camera will be).

  • Target Offset : Offset of the SpringArm from the target.

  • Do Collision Test : Turn On or Off collision tests.

  • Collision Test Resolution : The count of rays raycasting from the SpringArm position to Camera position also referred as probe.

Image

Resolution - 4

Image

Resolution - 20

  • Collision Probe Size : Radius of collision (Green sphere).

Image

  • Collision Smooth Time : The camera lag time while moving for collision tests.

  • Collision Layer Mask : The layer mask for collision tests.

  • Use Control Rotation : To turn on/off the mouse input for rotation of the spring arm.

Note : All the gizmos shown in above images can be turned on/off for debugging
purposes under Debugging Header.

springarmcomponent's People

Contributors

gloriousptr avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.