Posted on 25.12.2012, 22:01 By Shad
Скрипты C# (Unity 3D) для управления камерой в стратегии или изометрическом РПГ. Так же может пригодиться в других случаях, когда надо перемешать камеру вдоль плоской поверхность с помощью мыши.
Скрипт MoveCamera — управляет самой камерой:
private Vector3 _lastPosition; public Camera MainCamera; //Здесь подключается камера public Vector3 LastPosition{ set{_lastPosition = value;} get{return _lastPosition;} } void Start () { _lastPosition = MainCamera.transform.position; } void Update () { if (_lastPosition != MainCamera.transform.position){ MainCamera.transform.position = _lastPosition; } }
Скрипт MouseControl — отслеживает мышь и при необходимости двигает камеру:
private Vector2 _pos; private bool buttonDown = false; //Коэффициент смещения камеры, относительно движения мыши. //Для каждого конкретного случая определяется методом подбора private float konvert = .05f; void Update () { Vector2 mouse = Input.mousePosition; if (buttonDown){ Vector2 move = _pos - mouse; Vector3 move3 = new Vector3(move.x*konvert, 0, move.y*konvert); gameObject.GetComponent<MoveCamera>().LastPosition+= move3; _pos = mouse; } if (Input.GetMouseButtonDown(0)) { buttonDown = true; _pos = mouse; } if (Input.GetMouseButtonUp(0)){ buttonDown = false; } }
Оба скрипта, естественно, должны быть прикреплены к одному из объектов на сцене.
Если для игры не нужна перспектива, то её можно отключить изменив в камере параметр Projection на Orthographic.
Скачать пример (909)
lioresal baclofen
valtrex 1000 mg daily
bupropion sr 150 mg tablets
over the counter valtrex
lasix 20
1500 mg metformin
accutane prescription australia
tadacip price
buy elimite cream over the counter
buy elimite cream online
gabapentin medicine
tizanidine 6mg coupon
strattera uk
prednisone 20mg cheap
how much is augmentin 875
clindamycin 300 mg prices
finasteride without prescription
gabapentin drug
buy antabuse uk
trazodone 100mg brand name
online lasix without prescription
buy levothyroxine online
buy azithromycin online fast shipping
citalopram 20mg coupon
canadian pharmacy service
metformin 1000 mg for sale
orlistat 120 mg buy uk
legal online pharmacy coupon code
lioresal pill
buy metformin online pharmacy
zestril 10 mg cost
online pharmacy
cheap zanaflex online
generic accutane prices
cost of generic lyrica
synthroid 0.100 mg
cheap amoxicillin tablets
diflucan rx online
buy xenical online uk
amoxicillin 500 mg discount
strattera generic us
amoxil 500 mg cost
buy synthroid uk
propecia prices australia
lisinopril online
robaxin for pain
brand levitra for sale
atarax over the counter uk
order accutane online
order levitra online usa
25 mg propecia
celexa tab 20 mg
retino gel
colchicine brand canada
synthroid buy online uk
colchicine medication
cialis 10mg daily
finasteride tablets
buy augmentin 1000 mg
8mg zanaflex
buy gabapentin uk
buy synthyroid online
motilium price singapore
celebrex 2017
canadian pharmacies compare
1 propranolol
metformin pills 500 mg
sildenafil 50 mg tablet coupon
synthroid buy
buy cymbalta cheap online
cost of lisinopril 40mg
methocarbamol robaxin 500mg
buy synthyroid online
generic elimite cream
12000 mg seroquel
seroquel xr 50mg
cheap lioresal
clonidine 0.1mg tab purepac
albendazole mexico
trazodone 100 mg tab
diflucan rx price
vermox over the counter canada
azithromycin erythromycin
online pharmacy delivery usa
propranolol canada over the counter
prozac nz
motilium 10mg uk
robaxin 500 mg price
acyclovir 2000 mg
mexican online mail order pharmacy
levaquin buy
orlistat 60 mg capsules
Read reviews and was a little hesitant since I had already inputted my order. as but thank god, I had no issues. particularly the received item in a timely matter, they are in new condition. an invaluable so happy I made the purchase. Will be definitely be purchasing again.
cheap louis vuitton handbags https://www.louisvuittonsoutletonline.com/
metformin 3115 tablets
augmentin 625 in canada
cafergot drug
Read reviews and was a little hesitant since I had already inputted my order. alternatively but thank god, I had no issues. choose the received item in a timely matter, they are in new condition. blue jays so happy I made the purchase. Will be definitely be purchasing again.
cheap jordans https://www.realjordansshoes.com/
glucophage tablets 250mg
flomax 4 mg price
avana 2 no rx avana avana 164
Read reviews and was a little hesitant since I had already inputted my order. nicely but thank god, I had no issues. themselves received item in a timely matter, they are in new condition. in any event so happy I made the purchase. Will be definitely be purchasing again.
authentic louis vuitton outlet https://www.louisvuittonsoutletstore.com/
90 vermox buy vermox australia buy vermox tablets
Antibiotics cipro should only be taken under the advice of a doctor.
albendazole 400 mg cost albendazole coupon albenza 400 mg
avodart discount
Patients should not crush or chew Synthroid 0.112 mcg tablets.
fildena 100 mg
zoloft tablet price
online zoloft
generic bactrim for sale bactrim cost australia cheapest generic bactrim (sulfamethoxazole / trimethoprim) without a persription
triamterene tablets
neurontin brand name neurontin 300 mg price in india neurontin 150 mg
discount celebrex online
I appreciate the resources online that helped me understand how to buy Clomid online UK with confidence.
proscar 5 mg tablets buy proscar uk proscar tablets uk
I’m interested in knowing more about how a Metformin coupon can benefit me.
I’ve noticed a significant improvement since I started taking Lasixs Water Pill.
buy dapoxetine usa buy generic dapoxetine online buy generic dapoxetine uk
how much is proscar proscar for hair loss proscar cheap
I just wanted to thank you for the fast service. also they look great. I received them a day earlier than expected. particularly the I will definitely continue to buy from this site. in either case I will recommend this site to my friends. Thanks!
original louis vuittons outlet https://www.bestlouisvuittonoutlet.com/
I just wanted to thank you for the fast service. maybe they look great. I received them a day earlier than expected. which includes the I will definitely continue to buy from this site. blue jays I will recommend this site to my friends. Thanks!
cheap jordan shoes https://www.realjordansretro.com/
I just wanted to thank you for the fast service. on the other hand they look great. I received them a day earlier than expected. decline I will definitely continue to buy from this site. in any event I will recommend this site to my friends. Thanks!
original louis vuittons outlet https://www.cheapreallouisvuitton.com/
Перевозка лежачих больных в Москве от 2000р, круглосуточно — частная служба МедЛайнер Круглосуточная Перевозка лежачих больных в Москве и Московской области. Частная служба МедЛайнер. Срочный вызов, оборудованный транспорт.
пропустил, нада будет глянуть
fitflop best price