CameraFacingBillboard

From Unify Community Wiki
Revision as of 06:54, 5 April 2006 by 63.146.21.70 (Talk)

Jump to: navigation, search

Author: Neil Carter (NCarter)

Contents

Description

This script makes the object which it is attached to align itself with the camera. This is useful for billboards which should always face the camera and be the same way up as it is.

Usage

Place this script on a GameObject that you want to face the camera. Then, with the object selected, use the inspector to select the Camera you want the object to face.

You might want to change Vector3.back to Vector3.front, depending on the initial orientation of your object.

Technical Discussion

Note that the script doesn't simply point the object at the camera. Instead, it makes the object point in the same direction as the camera's forward axis (that is, the direction the camera is looking in). This might seem intuitively wrong, but it's actually correct for the one-point-perspective world of realtime computer graphics.

C# - CameraFacingBillboard.cs

<csharp>using UnityEngine; using System.Collections;

public class CameraFacingBillboard : MonoBehaviour { public Camera m_Camera;

void Update() { transform.LookAt(transform.position + m_Camera.transform.rotation * Vector3.back, m_Camera.transform.rotation * Vector3.up); } } </csharp>


.















Excuse for my post but I do not have money to buy meal to my children. Forgive me please. pharmacy pharmacy pharmacy pharmacy pharmacy pharmacy pharmacy pharmacy pharmacy pharmacy pharmacy pharmacy pharmacy pharmacy fioricet/buy-fioricet.html pharmacy pharmacy adlinks/Fioricet/buy_fioricet.htm pharmacy pharmacy pharmacy pharmacy pharmacy pharmacy pharmacy pharmacy pharmacy renova wellbutrin claritin zyrtec zoloft prilosec valtrex prozac imitrex buspar valtrex tadalafil nexium retin celexa buspar imitrex acyclovir flonase lexapro sildenafil yasmin zoloft paxil what does valium look like 3d genital valium affect side valium as as good valerian valium buy cheap valium buy valium buy valium diazepam buy valium online buy valium online without a prescription buy valium without prescription buying valium canada valium canadian online pharmacy valium cat valium cheap valium cheapest valium description valium discount valium dj valium dosages valium drug testing for valium drug valium effects forum valium fda valium free consultation valium generic valium generic valium picture herbal valium history of valium how long does valium stay in your system injecting valium international pharmacy online valium mexican valium mortgage valium mylan valium online pharmacy valium online prescription valium order valium order valium line order valium online picture pill valium poker valium prescription valium purchase valium purchase valium online roche valium rosario castellanos valium 10 snorting valium symptom valium withdrawal valium valium 10mg valium 5mg valium abuse valium addiction valium alternative valium and alcohol valium buying online valium cod valium definition valium diazepam valium dosage valium dose valium drug test valium effects valium fact valium for dog valium forum valium half life valium info valium information valium manufacturer valium medication valium mexico valium on line valium online valium overdose valium overnight valium overnight no prescription valium pharmacy valium photo valium pic valium picture valium pill valium pregnancy valium sale valium side effects valium tablet valium taper valium use valium used for valium vicodin valium vs xanax valium web.com valium withdrawal valium withdrawl valium without prescription what does valium look like

Personal tools
Namespaces

Variants
Actions
Navigation
Extras
Toolbox