Skip to content

mubasharUnity/OnScreenPointer

main
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 

On Screen Direction and Position Indicator/Pointer for Unity


Asset Store Download Link

Purpose is to simplify on screen direction indicator common in 3D games where an arrow head is pointing toward a game object, or a waypoint or an enemy or an objective.

Setup

Setting up this system is pretty straight forward.

  • There are a total of two script OnScreenPointerController and OnScreenPointerObject.

  • OnScreenPointerController is a singleton. This script mainly contains enviroment info needed for this plugin.

  • OnScreenPointerControllerneeds two references. Camera related to player and ui RectTransform .

  • RectTransform will contain all the pointers. Purpose is to have one place for managing all pointers.

  • OnScreenPointerController has Camera reference. If it is null, plugin will try to find Main Camera and use it.

  • OnScreenPointerObjectis attached is to target game object whose position we intend to track in realtime during our gameplay session.

    • offset_local is normalized screen size in x andydirection. During final result calculation, offset_local.x is multiplied with screenWidthand result is the padding from screen edges. (same process repeats for yandscreenHeight).

    • MoveInCicle is use to place pointer at a fix distance from screen center. Smaller dimension is choosen from screen size and pointer is placed along that angle. Distance from center is controlled by circleSizeNormalized. Example: pointer is placed at a mid-way from screen center to screen edge when circleSizeNormalizedis 0.5

    • inScreenSprite: Pointer Image when object is with in screen area whether visible or not.

    • outScreenSprite: Pointer Image when object is not in screen. Object may be infront of player but not in periphery of camera view. Object may be in back of player/camera.

    • uiImagePrefab: Prefab configured for inScreenSprite/outScreenSprite. Can be a complex assembly of views chained togather. However, current implementation has the assumption that parent Prefab will have a Image component.

About

on screen direction indicator common in 3D games where an arrow head is pointing toward a game object, or a waypoint or an enemy or an objective.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages