learn javascript for unity3d_2.6

63
Java Script Unity 3D 2.6 !" #$ %$!&’ & ( com . yahoo @ 800 mohamd )*+* , - +./+ 0

Upload: fady-youssef

Post on 28-Nov-2014

68 views

Category:

Documents


0 download

TRANSCRIPT

-='' .-='' -' -- -'- ' '-' ='=-- Java Script ==-- -'='' `' ' -' Unity 3D 2.6 -'-=' --'='' .-- -='' ---= --= --=- com . yahoo @ 800 mohamd `` / `'` ~'---' '- `=-- --- .-' --- - .' ''='' ' '- - -''`' ==-- -'='' -- Unity3d 2.6 ---` =--'' -'--'-' -'= --- --- =- '+--''-' '' =-- ` -'' --= ''' -- -'-- -''`' ==- '+- .-' '--' ''' -- .--'-- -'-- --= -=- ` .' .--- .'-'' --'--'' -'- - ``- --'' ==-'' '-=--' --=- '-'---' -'--=-'' - '+-- . ---' -'=' -`-=-'' --'' -'---'' -'-- .`- '+-'= -'--'' - '+-'= .- '-= -'-'='' -`' ` - = '-' - .-'-'' --=- ' ==-'' -'' '- .- ---' ` =- - . --- ='- : --=' '--'' '' ---- - -=- : .--'' -''' ' -'=- -''- .- '---- `.--'--'' --=' ........ --'-'' .- -'=- -= -'-'' --` .' ' -=- -=--- '-- -=- -'= --= --- ' -=-- ' ---' -- ' -=.' --- .' -'-'' --' =-'= -' .-' `'`--' ''- : - = '' . -= '' ''' - - - -' - . ' .- . - ' - ' - - ' - -- ' ' - - ' .- - '' ' + - ' ' -' - - ' ' ' = ' ' - - - ' ' . - '' ='' . ' '' = ---'' -- : -' ) `-' ( ---- : -`' -'-- .--'' .- .- ' .' .--'' .- --' ==- '+--'+- ---= .- ....... ' += ` =-` +- ='-- .' .=- -'-'' '- =- ='----' '= -='-= =' -- .' -- --` ----'' -`=' .' -- -= ' --- --= -- ` .' '= -'-'' .-` .-' =- -'----`' ' -='' -' -='- ... -= : - ` - com . yahoo @ 800 mohamdIRAQ - MUSEL -''`' ==-- -'='' --- ''= ' '-' ='=-- 2.6 D 3 Unity ''' -'-- : -- .-- ''' -'-`'' .- =-=- .- ) Classes ( .'-'' ) Functions ( -'' -'='' =-- -'='--=' -'=' -'- -''`' ----= .'- -'-` =-- --'-' - ----'' .- .--' ='--=' -'- '- -=- ' ) '- -''`' ----'' -=-'' ( -'=---' -- --= -'-`'' -- .=-'' ` .- '+-'--'- '' '-`'' -- .='-- -'' .'-'' ' -'---'' -'--'-'' --- -'+='-=- -'' -----' -'`' '+-- -'=-'' -'-`'' -- -'=---' --= .' -'= ---'- '- .'-'' : 1- Class.Function(); .'`- : transform.Rotate(x ,y ,z);animation.Play();

2- Class.variable; .'`- : transform.position; 3- Class.variable.variable; .'`- : transform.position.x; -'---'' .'-'' '= -=- -'--'' --- '- .`'' .' .-'' .-- .'-'' .' - '+--'+- .-- '= -=- -'' -'--'-'' '-+--- -- ' .-=' '-- + '-= '---- . --= -' -'--' -'--- .'- .- --=- '- ='--'' -'-`'' ''-'' --' : -' '=- -='' .' . -= : - ` - com . yahoo @ 800 mohamdIRAQ - MUSEL -''`' ==-- -'='' --- ''= ' '-' ='=-- 2.6 D 3 Unity -''' -=' ` Runtime Classes ='--'' -'-`'' --= =' +=- -- -'' .`'' -=' ``- -- --- +' -'-'' -'--'' .'-'' --= =--' +=- -- .`'' '- -= ---- =' +=-' '-=' -=' . '- -'- .'-'' -' .- . -= : - - com . yahoo @ 800 mohamdIRAQ - MUSEL -''`' ==-- -'='' --- ''= ' '-' ='=-- 2.6 D 3 Unity - - =- '--' .' --'' -= -=-'' --- -'' --'' -' -'- -= .= -=-'' -=--- '= =-'' ` -=-''- .'='' Enter -- -' -'- .'-'' .-'= -= . -= : - ' - com . yahoo @ 800 mohamdIRAQ - MUSEL -''`' ==-- -'='' --- ''= ' '-' ='=-- 2.6 D 3 Unity -'---'' .= ---- : ' ---'' .-- .`- -'= =--'' -'' -'' -'---'' -'-' .= .`=` '-= --=--'' -'---'' ---'' -='' -'---'' '+='-'- ---'' -'---'' . .- --- .= .`=`' .-- ``- -''`' ==-- -'='' -'---'' .= .`=`' .-- '- -' .-' -- ) GameObject ( - .-- ='- -''' ``` -=- ' - ---- '-- --- .-=- -- .- --- .= .`=`' ) Transform ( -'= ```'' -`-=-'' -'=' .-- ) .--''-==-'' ---'' ( '--' -- .- --- --- .-- Texture -'-'='' - .-'-'' .- --- --- .-- .` ' -'= --- =- ) '-=` -'-`'' --- '' -'-- ( -- -'--' -= .= ---'' .='- .- -''' -'--=- - .-'-'' '+-- .'' -''' -'--=- '' -'---'' --- '-'--' '+-'-=--' --= '= ----'`-`' -- --= -'-`'' . -'---'' ---' -''' --'' : var ---'' -' : =- ; ' : var ---'' -' = --- -- ; =- --=- -- ---'' '' -----'' ---'' .' --'`'' --='' . - '--- .' =-` ---'' -' .`- -'='' -'' -=' -=- .' ' ) ( # $ ! ... -'' ( ='-'' '-='- ) ( '+--=- .' ' '+- '--- .' =- . -'---'' --- '= '`-' : var v1 : int ; var v1 = 5 ; ---='' - -'' -'' .---` --=- --= -- --- --- - . var v2 : float ; var v2 = 5.0 ; ---='' - -'' -'' .--- --- --= -- --- --- - . var v3 : double ; --- --= -- --- --- - .-= -'' -'' .--- --'' -'=-'' ) -' .- -- . ( -= : - - - com . yahoo @ 800 mohamdIRAQ - MUSEL -''`' ==-- -'='' --- ''= ' '-' ='=-- 2.6 D 3 Unity var v4 : boolean ; var v4 = false ; ---='' - - . .-----'' .--- -=-- --- --- true false var v5 : GameObject ; -'-`' ``` -=- ` -'--'' .-'-='' ' ' -' .-' -- --- --- - . var v6 : Transform ; var v6 = Vector3( 5 , 0 , 6 ); var v6 = Vector3.zero; -- --- - ```'' ='' -`-=-'' -'=` -`'' .'-'' ' ='--- .-=- -- .- --'-=-'' . -'---'' -'-' --- - '- ..... +=- -''' -'--''' -=' '= - ---'' =-= '+--- -- -'---'' -- .--' --'- ---'' Inspector .-''' '-+' ' '- .- '+-- --- --= ---'' -='- -- .'-' ---'' --- --=-'' ---'' .= `-- ---'' -- ---'' .='- ---' .'`- '- --'- '+= --- -- =--- -'--- '= -=- Inspector --= '-- '- .'-'' '- .- '+-- -- .-- : var v1 : int ; var v2 = 5.6 ; var v3 = true ; var v4 = false ; var v5 : GameObject ; var v6 : Texture ; function Update () { } =='' '= .--'' -'' '-'' . -= : - - com . yahoo @ 800 mohamdIRAQ - MUSEL -''`' ==-- -'='' --- ''= ' '-' ='=-- 2.6 D 3 Unity '-- ---'' '- .--=`' .----'' -''`' ==-- -'='' -'---'' .' ==` +--- --= .-=' ' --- '`-' - --= +-'-=--' --- '' =--- -'-`''-- '- . ``- =-''- '`= .- =--' --- '-= ' ==`- var speed = 5; '---- ---'' '- --'- .-- '= =-'' --= '--' 0.1 speed = speed + 0.1; --= -' '= ---'' '-= '--' ---'' ---'' '' -- ' --'- --` ''='' -- - --=- '--- ' --'' -'' .---` speed = speed + 0.7 ; -=' '---- ---'' --'- -- -- .-' --=- --= -' '' ---- -'-'' .' ' -'' -'' = -=- ---'' - .-'-'' --= ---'' -- '' ---- .' -=- '-+'--- .' : var speed =5.0; =-'' '-= .-= '--- IF : if ( .-- =- ) { '- ---'' -'`' ----- -- =-'' -=- '-' } .---- .-- '-'-- -'-'-= .= -'-= .- =-'' ) > < == ... -'' ( -- ' .- .-- -' .= .- '+-'= .-='' -- --=-- True ' False -=----' --'-'' --'-'' '`-' .----=' . ==`- : '-= =- --=- --= ------ -'-'' -`' .' '-' IF .--'' .- -=' -' .'`' .= -'---`' { } . ---'-'' .-' ---'-'' --- . -= : - ` - com . yahoo @ 800 mohamdIRAQ - MUSEL -''`' ==-- -'='' --- ''= ' '-' ='=-- 2.6 D 3 Unity '- -'`' -'- .= -'==`- --- ''='' : ` - ''=' -'-= ''' -- -=`' ' -- ---'' ---'' '--- Var `-- .- var '--- ' ='- '== +=- -- update() .- `-- Update() - --- --- --= =' -'-=--' --= =' ''= '' ---- .' -=- -'' . ` - ` -'' .='- -'--'- - .-- -- -' ' '-= '= `- '+''=-- -'-- ='- --`= .`- -'-'' --- ` =-'' -'----- ``- - --- .= . -' -'-`' -'`' =- -=--- -- ' ==-'' --' -=- --'' '''- -'-'' .' --- '' File Encoding UCS-2 Big Endian . - -=- =- . .' =---'' -'-''- +--- ; `- -'-'-`--' ='- -- `=---'' -'-'' -- ` .'-'' =-'' '-= . ' - -= --= -'==' --`-' '+---- -- ==-'' .' ---'' +=- '=='' - -=-'' =-'' '' --- '=='' '' '+=' .--'' -'-''- =-`' View Line Numbers - - '=' .' '-' ''='' --- .' --- .- '== ' +=-` C# .' Boo .-=' +-'= +'='-- '- -=-- ' ----'' .---=---'' '== +=-- . - ''= --- -'- .-- --= Create JavaScript Assets ''-'' .' Update() '+-' --= '+---` '--'-'- '+-'-' -- - . ---- -'-- .- .-' ''-'' -- '= -'-- '+- =' .'- -'-' -''' '+'='- . .--''- `' -==' -= .-- ` ) ' .- -- - . ( -= : - - com . yahoo @ 800 mohamdIRAQ - MUSEL -''`' ==-- -'='' --- ''= ' '-' ='=-- 2.6 D 3 Unity - - - '+' -'-'' .'-'' -'-`'' : 1- Input : .'=-`' .`'' '-+- '-'-- ---` .- --- -'-=--' ' -'=- .-- -'-'' -' -''`' ```'' ----'' --'- -'-`' ---- -'' '' --'-' -'-= - .-'-'' .'=-`' -- '--' '--'' -'-=- ---- .'=-`' ``- : ---'--'' =' .'-'' -''' '-= '-= ... .`'' .---- Input -''-'' .'-'' : 1-1 Input.GetKey Input.GetKey ( ) '' -' ; -' -=--- =--'' '' ---'--'' =' .- '-= =- .-- .- '-''= if --' .=-'' '-' =-- '' .' ' ` . .'`- : -=- --- 45 =- '= =- Y '' '= =-'' --= K function Update () { if (Input.GetKey ("k")) { ransform.Rotate(0 , 45 , 0); } } '' '= '-=- ' K ''-''- =-'' --=- -- -- -=-'' --- --- ''= '' '= =-'' '---' .'-''- ----- -=-'' .' '--=-- --- =-'' .' ' . .''- .- '-'' '-= . -= : - - com . yahoo @ 800 mohamdIRAQ - MUSEL -''`' ==-- -'='' --- ''= ' '-' ='=-- 2.6 D 3 Unity 1-2 Input.GetKeyDown Input.GetKeyDown ( ) '' -' ; --- .' ' '--=-- =-'' ---` '' '= =-'' '---' --= -'' .' '+---'-'' '= =-'' --= --=' -- -=-- =-'' .'`- : function Update () { if (Input.GetKeyDown("k")) { ransform.Rotate(0 , 45 , 0); } } '-=- ' '' '= K ''-''- =-'' --=- -- -- -=-'' --- --- ''= '' '= =-'' '---' ` - --- -=-'' .'- =-'' .' ' ` '--=-- --- . 1-3 Input.GetKeyUp Input.GetKeyUp ( ) '' -' ; ---'--'' =' .- =-'' -= -'' '' -' -=--- -- =-'' --=- -- '' .= =-'' . 1-4 Input.GetButton , Input.GetButtonDown , Input.GetButtonUp .-- .'-'' -- -'--' --='' -'' .' --'-'' ```'' .'-'' .-= '`' .' --= -=--- -'-'' ```'' .'-'' -'--' '`' ' --'--=`' ---'--'' = .'-'' -- '- ' -=--- -'--' ---' --'-' '' '' -''' '-= ' ---'--'' =' .- --- .'-'' ' ''-'' '' .- '+'-'--'- -'--`' -- ---=- -- : .- .'- `'' -= . -= : - ` - com . yahoo @ 800 mohamdIRAQ - MUSEL -''`' ==-- -'='' --- ''= ' '-' ='=-- 2.6 D 3 Unity --'- +=- -- ) Inspector ( .'=-`'- -'='' -''-'' --'-'' -'= .'-'' '- .- -= ) -' .- -- . ( -= : - `` - com . yahoo @ 800 mohamdIRAQ - MUSEL -''`' ==-- -'='' --- ''= ' '-' ='=-- 2.6 D 3 Unity ==`-- .' ='- --' -' -`' .-- '-=--` ---'' -- .-'--' .- '' =' -'' .-- -''' '-= ---'--'' . - =' -- --'-' ---'--'' =' =-'- -'''- =-'' -'' .-- -''' '-= . .'=-`' .'`- -='-' ) Fire1 ( -`' --+' .-'--'' '' .' ==` -- '-- . .---'' '' --`' ''.'-'' ==`- : .-- -=-'' '' -' -'- -= .= ='- -='' --= '`' -- --- .-- ---'' --'-`' ''`' .- -`=' . ) -'- -'--'- --' '`' .' .'- -- -'+- Input ( .-' .--' '' Fire1 --'`'' -''' '-- -'= '-=-- .- -- '' ---=- - --= '' -''' '-= ) - -- '' -''--` '- .-''- .-'-- '-= ---' -'-= -' `-'=''- .'='' -''' - .'- '-' '-`'- .'='' =- (... -`' --- .`=`'- . -= : - `` - com . yahoo @ 800 mohamdIRAQ - MUSEL -''`' ==-- -'='' --- ''= ' '-' ='=-- 2.6 D 3 Unity .' '---=--' ' ``- Fire1 ---'' .-- -' -----' ``- '-=--' .--'' .- .-- ```'' '' ---'' -`=' =-'' -=- '+' '-=--`' --= : function Update () { if (Input.GetKeyButton("Fire1")) { ------ -'-'' -`' } } -='-' .'=-`' Horizontal ---' ='- .` =' ' .'`-'' -=--- -`=' -'' '' -'' .-= .=-` . -= : - ` - com . yahoo @ 800 mohamdIRAQ - MUSEL -''`' ==-- -'='' --- ''= ' '-' ='=-- 2.6 D 3 Unity ---'-'' '-= - '`' '' ---' -`' -- '-=--' .- '' ---'--'' =' .- '-= ' -'-= .'=-`' - '- '-' '' -'=-`' --`' -'=-`' .--`' .-'' '-+'-'-- a d ''-'' '= '`'' ---'-'' -- -'=-`' - '- -' --`' -''-'' ---'' .-=- ) Negative ( '=-`' - .--`' ---'' .-=- -=-'' ) Positive ( -=-'' --'' -- -- -''-'' -=` -'' = ```'' ' X ' Y ' Z --'= .- -=-'' =-'' --=- -- Axis .--`' =-' --=- '-''= '+-' --= X '-=- =-'' .-- '- ---'' ='- -- - ' -'=-`' '= =-'' .--`' ) '-'--'- ' : a ( =- '= -=- -- '= .-=-- X '-' -'=-`' '= '-=- --`' ) '-'--'- ' : d ( =- '= '-''- -- '= .-=-- X . ' '-=--`' --= '--' =- '= -=- =-=- X .- `-- .' ''-'' -=--- GetKey .--'-= .--- if -'=-`' '= =-'' --=' .--`' .---'' =-=-'' =`' =-'' -'=-`' '= --`' '--'' =-=-'' -- ''-'' : function Update () { if(Input.GetKey("right")) { transform.Translate( 1 , 0 , 0 ); } if(Input.GetKey("left")) { transform.Translate( -1 , 0 , 0 ); } } ='- .= `-- -=--- .'=-`' Horizontal '' ---'' --=- ' ''- : function Update () { transform.Translate(Input.GetAxis("Horizontal") ,0,0); } -=--- ---'' '- .' ='- '= -`= '`' '-= '---'' -''`' -- '- -`=' . .'--`' .- '=-'' . -= : - `' - com . yahoo @ 800 mohamdIRAQ - MUSEL -''`' ==-- -'='' --- ''= ' '-' ='=-- 2.6 D 3 Unity .= - '- Horizontal '= -=-- Vertical =- -=--- '-' Y -=--- '- '-''= =- '= =-=-'' Z ' -- '--' '' --- -'- -''=-`' '= =-=- -`' ) --- . '-- '-' -'= ( -'' .- : function Update () { transform.Translate(Input.GetAxis("Horizontal") ,0,0); transform.Translate(0 ,0, Input.GetAxis("Vertical")); } - --'-' --'= -= .= .-''=-`' .-- -- --'-= .-'--- '-' ='- =-'' .-'-- (sensitivity) --'' --=-'' -`=' - --'' -= .= ' ' -'' .- . transform.Translate(Input.GetAxis("Horizontal") * Time.deltaTime, 0,0); -''' -'-- .- - .' .-' --'` .' =-=-'' -- -'-= --' ='- '- ==--- ----''- .-' --'`''- --= . 1-5 Input.GetMouseButton Input.GetMouseButton (".'-'' "); .'-'' =--'' '' -' -=--- '-= =- .-- .- '-''= if .=-'' --' '-' .' =-- '' ' ` . - '' .'-'' : .'-'' --`' '' 0 '' .--`' .'-'' 1 '' '' .'-'' =- 2 . '-- .-' '--= .- ) -' .- -- . ( -= : - `- - com . yahoo @ 800 mohamdIRAQ - MUSEL -''`' ==-- -'='' --- ''= ' '-' ='=-- 2.6 D 3 Unity .'`- : '' '= =-'' --= --`' '' '= =-'' --= '-' -=-'' ==-- .'-'' .--`' -'='' -=-'' ==-- .'-'' : function Update () { if ( Input.GetMouseButton(0) ){ transform.Translate(0 ,0 , 0.1); } if ( Input.GetMouseButton(1) ){ transform.Translate(0, 0 , -0.1); } } '= =-'' '---' --= '' =-=-'' ---- ''-''- =-'' --=- ---- .'-'' . 1-6 Input.GetMouseButtonDown Input.GetMouseButtonDown (".'-'' "); '--' .'-'' =--'' '' -' -=--- .'-'' '= =-'' '---' --= .' =-'' --=- ----` '' =- --= --=' -- -=-- =-'' .' ' .'`-'' '+--=--'-'' -' -'-'' . 1-7 Input.GetMouseButtonUp Input.GetMouseButtonUp (".'-'' "); -=--- .'-'' .- =-'' -= --'' '' -' =-'' -- =-'' --=- --= '' . .-- .' '+---'- .-- '+--- -'' -'--' -'-'' .'`-'' '+--=--- . - ---- -='' .- -= --'- .- -'' .- . -= : - ` - com . yahoo @ 800 mohamdIRAQ - MUSEL -''`' ==-- -'='' --- ''= ' '-' ='=-- 2.6 D 3 Unity - - - '`' --'--'' --='--'' -'- --=- '- : - Normal keys: "a", "b", "c" ... '`' `' --'--= --- '+--'- -=- . ------------------------------------- Number keys: "1", "2", "3", ... '' '`' --'--=`' ------------------------------------- Arrow keys: "up", "down", "left", "right" '' -''=-`' -`' ------------------------------------- (Num Lock) '`' - .-- -'' Keypad keys: "[1]", "[2]", "[3]", "[+]", "[equals]" ------------------------------------- .-=-' .- +-'--' '-= '- =' '=- ---'-- ='- .--'= + .--`' '' .--'- .--- Modifier keys: "right shift", "left shift", "right ctrl", "left ctrl", "right alt", "left alt", "right cmd", "left cmd" ------------------------------------- Mouse Buttons: "mouse 0", "mouse 1", "mouse 2", ... '' .'-'' ------------------------------------- '' -''' '-= Joystick Buttons (from any joystick): "joystick button 0", "joystick button 1", "joystick button 2", ... Joystick Buttons (from a specific joystick): "joystick 0 button 0", "joystick 0 button 1", "joystick 1 button 0", ... ------------------------------------- '`' .- =-' -'='' '+-'--' Special keys: "backspace", "tab", "return", "escape", "space", "delete", "enter", "insert", "home", "end", "page up", "page down" ------------------------------------- '' --'='' Function keys: "f1", "f2", "f3", ... --+'' =--- ==-'' -` . -= : - `` - com . yahoo @ 800 mohamdIRAQ - MUSEL -''`' ==-- -'='' --- ''= ' '-' ='=-- 2.6 D 3 Unity 2- Transform: .`'' '- -=--- -'=` -`-=-''- ---- -'--=-'' '= -`-=-'' .--'' ) Translate ( ---'' ) Rotate ( -==-'' ) Scale ( . 2-1 Rotate : ---'' transform.Rotate ( x , y , z ); ```'' .'=-'' '= -=-'' ---' -=--- ' ' '-- -- .-- =- '= -=-'' --- '=-'' .'- -- -- =-'' .'- -'=-'' ---'' =`' --- ---'' --.'-'' -' ) ----'' .- .-=-'' ='=` -- ----- .-' --'- -' ''-'-'' ( . .'`- : -- -=-'' .=' 50 =- .= =- Y --= '= =-'' R function Update () { if (Input.GetKeyDown("r") ) { transform.Rotate(0 , 50 , 0); } } '' '= =-'' -- R -- -- '-' 50 =- '' =- '= -=-'' --- Y - '--'- ---- - . =-'' ' ` '-=- ' -- R -- =' -- -- '-' - =- =' =- '= -=-'' --- ---- Y 180 '-''- '- =- .-'-- -' ='- -- .' -= .= ---'' offset .' -= .= .-' .'- - `''- absolute . ' '--' -''-''- -''' -- .=- .''- ---'' : transform.Rotate(0 , -50 , 0); '-=--` '=-'' ---'' absolute ' --- '--' -=-'' --- 50 - --'' .- = ' -''' -'-'' ---'' -'-'' .'`-'' .=' -''-'' --'' -=--- ---='' ---'' --=- : function Update () { if (Input.GetKeyDown("r") ) { transform.eulerAngles.y = 50 ; } } --- -= .'='' . -= : - ` - com . yahoo @ 800 mohamdIRAQ - MUSEL -''`' ==-- -'='' --- ''= ' '-' ='=-- 2.6 D 3 Unity .' .-- -'' --'' ---- ' Rotate .' eulerAngles '--- -=-'' ---- =- '= ----'' --'- .- X -= -`' -'-'' .'`-'' '' transform.Rotate(0 , 0 , 0); '= =-' -''' .- R --'' ---'' '= -=-'' --- --- ' .-=- ` -- -'-'' -= -`' '' ''-'' transform.eulerAngles.x = 0 ; '= =-' -''' .- R -- -- -''' -=-'' --- -'-'' =- '= X . ' '--' -''' -=--- '=-'' --= '= -=-'' --- : transform.eulerAngles =Vector3(0 ,0 , 0); ' : transform.eulerAngles =Vector3.zero ; ==`- : .`- -=' =- '= ---'' --='' -- '-=--' --= : transform.eulerAngles =Vector3 (0 , 45 ,0); ---'' -''' --- -' --'-'' -' '=-'' '= =`' . .' - '+-'-=--' .'-- - '-' .=---'' '-' --'--=`' --='' -'-= Rotate . .- .-='' .-- .' --= eulerAngles -- '= -=-'' ---'' -' : .'`- : =- '= -- -=-'' .=- Z '-' .- -' .'-'' =- -'- 90 -- =- ---'' -'=' 50 =-''' .-- '= -'='' =- . function Update () { transform.Rotate(0 , 0 , 1); if (transform.eulerAngles.z > 90 ) { transform.Rotate(0 , 0 , -50); } } -''' .- ............ -'= = . .--'''' -'- .- -' - . -= : - ` - com . yahoo @ 800 mohamdIRAQ - MUSEL -''`' ==-- -'='' --- ''= ' '-' ='=-- 2.6 D 3 Unity .'-'' .`' .' .=' -- eulerAngles .' .-= .-- Rotate .'- ='- =--- --='' ---'' -- ---- ---'' '' ''-'' ---='' ---'' transform.eulerAngles.z = transform.eulerAngles.z + 30; ''--=' transform.eulerAngles.z += 30; ) --`= .-- '-- =--` ---' '==+=-- ( '- '- -`' transform.Rotate(0 , 0 , 30); --- .''- ---'' .' ' : transform.eulerAngles.z -= 30; -`' '- '- transform.Rotate(0 , 0 , -30); .`' =-' '' .'`-'' ''-'' : function Update () { transform.Rotate(0 , 0 , 5); } -=-'' --- --- ---'' '- ----- --= 5 =- '= -'=- Z ---- .-- - . ' '--' ---'' -- .' 5 '- -'' .-'- --- - . .-' --'` . -'=- ''-'' : function Update () { transform.Rotate(0 , 0 , 5 * Time.deltaTime); } ---'' --= ='- '-=' transform.rotation ' .' --` .'-- .=-- ---- .' -- '+--=--- . '-'' .'-- --''- --'' '-- . -= : - ` - com . yahoo @ 800 mohamdIRAQ - MUSEL -''`' ==-- -'='' --- ''= ' '-' ='=-- 2.6 D 3 Unity 2-2 Translate : .--'' ) =-=-'' ( transform.Translate( x , y , z ); --- ```'' '=-'' '= -=-'' =-=-' -= ' '--' '=-'' -=' '= -=-'' =-=- -- '=-'' .'- -- -- =-'' .'- -'=-'' ---'' =`' . .' -= .= =-=-'' .-'-- offset .' -= .= .-' .'- - `''- absolute -'=-'' ---'' '-' -- -- '' -=-'' -' ----'' ---'' '-''- '- . .'`- : =-' -'-`' -'=-`' '= ==-- -=-'' .=' Z '=`' -'=-`' '= =-'' --= ' W -'='' -'=-`' '= =-' Z '= =-'' --= ' .--`' -'=-`' S =- .= .---'' -- Y -`' '= =-'' --= ' .--`' -'= D .= '--'' -- =- Y ' --`' -'=-`' '= =-'' --= A . function Update () { if(Input.GetKey("up") || Input.GetKey("w")) { transform.Translate(0, 0 , 0.1 ); } if(Input.GetKey("down") || Input.GetKey("s")) { transform.Translate( 0 , 0 , -0.1 ); } if(Input.GetKey("right") || Input.GetKey("d")) { transform.Rotate(0, 1 , 0 ); } if(Input.GetKey("left") || Input.GetKey("a")) { transform.Rotate( 0 , -1 , 0 ); } } '-- `= .-' -' =-=- --- .-- ---'' '- ' '-=- -- -'' .='' --'''-'' '--'- : '-- -='' .=--` ) -' .- -- . ( -= : - `` - com . yahoo @ 800 mohamdIRAQ - MUSEL -''`' ==-- -'='' --- ''= ' '-' ='=-- 2.6 D 3 Unity function Update () { transform.Translate( 0 , 0 , Input.GetAxis("Vertical") ); transform.Rotate( 0 , Input.GetAxis("Horizontal") , 0); } '- --- =-' ' .`' .='' -- '' =-'' -'-' --- ) ' ( =-'' -'-' ) (. =-'' -'-' ) ' || : ( '-' '-= =- --=- -- '-` ' .-=-'' -=' -=- IF ----- ''-''- '+'='-- '- .=-'' --` -'' ---='' ''='' =' --- '' '-= IF .- '---= .-=-''.---=-- -= . .`' .='' ' .'`-'' =-'' -'-' '= .'`- -'-' ' || . =-'' -'-' ) && ( : '-' .=-'' --` '-` ' .-=-'' -=' -=-- ' '' '-= IF --- '-= .=-' ---='' ''='' =' IF .---=-- .-=-'' - .' . .'`- : '= =-'' --= .--- .-- X =- '= -=-'' --- -- '- X . function Update () { if(Input.GetKey("right ctrl") && Input.GetKey("x")) { transform.Rotate(1, 0 , 0 ); } } ==` '-' =-'' - '= =-'' --=- --` =- .-'' -=' `' ' '- .-'' '= =-'' - . ==`- : '-' '= =-' ==-'' .='- .- -''' -'- X .--- .-- ` '-' '-''--- '- -- ` -----'' -'-'' .- '+-'- . ' '--' -=-'' .-- -- '=-'' .--'' '-=--' '' ' ``- -=- .-' .-- - '--' -='' .-- '' '' =-- ( 5 , 3 , 1) ''-'' -=--- : transform.position=Vector3( 5 , 3 , 1 ) ; '='' .-= --'' -'- . -= : - `` - com . yahoo @ 800 mohamdIRAQ - MUSEL -''`' ==-- -'='' --- ''= ' '-' ='=-- 2.6 D 3 Unity ' '--' =- ``- .-- =- '= .--'' X --- : transform.position.x = 5 ; --- ` : transform.position=Vector3( 5 , 0 , 0 ); - ='- .` =- .=- - Y Z -- '-+-' ) -'- ` ='- '--= ''= .( .' --= .=' -- +---'' .'-'' position .-= .-- Translate =--- -'=''----'' ---'' - ----='' ---'' -=- .'- ='- : transform.position.z = transform.position.x + 0.1 ; ''--=' transform.position.z += 0.1 ; -`' -'- '- transform.Translate( 0 , 0 , 0.1); --- =-'' .- =-=-'' .' ' : transform.position.z -= 0.1 ; '- '- -`' - transform.Translate( 0 , 0 , -0.1); '--= .'-- '-' .=- --='' -- .'-=`' - '-' '- =-=-'' ---'' '---=--'-'--'' -`== '- -=-'' .-- '= . .' .-- -'' ----' Translate .' position '--=- - --=- '--- - -=.-` -- -'' ) =-- .-`' ( .--`' --- : transform.Translate( 0 , 0 , 0 ); -- ---'' --' ' '-' '--` -=-'' - --- --` -- '' .- -=-'' - - -='' ' '-`' -'-= '= `-` --'' .' --'' . transform.position=Vector3( 0 , 0 , 0 ); ' transform.position=Vector3.zero ; . : ---' ` -' `' '' ` . -= : - ` - com . yahoo @ 800 mohamdIRAQ - MUSEL -''`' ==-- -'='' --- ''= ' '-' ='=-- 2.6 D 3 Unity -=-'' .--' ' '-' '--` -=-'' - --- ==`- -- '' =-- .-`' --'' . .' --= .- .-='' .-- position -=-'' - - '= : .'`- : =-- -=- =--' .' ' = =- '= X '-' =--'' '=- 15 '= -- =-'' .-- =-'' .-- '= -- =--'' ='=' : function Update () { transform.Translate(0.5 , 0 , 0); if (transform.position.x > 15 ) { transform.position.x = 0 ; } } .`' =' --- --= -=-'' ---- =- '= =`' -'= -=' +' X -''' .- . =-' '' ''-'' .'`-'' : function Update () { if ( Input.GetKey("up") ) { transform.Translate(0 , 0 , 3); } } '---- -=-'' =-=- --- ---'' '- ----- --= 3 =- '= -'-= Z - - . . -''' -'-- ' '--' =-=-'' -- .' --- - . .-' --'` . -'-= ''-'' '- -'' .-'- : function Update () { if ( Input.GetKey("up") ) { transform.Translate(0 , 0 , 3 * Time.deltaTime); } } '-' -' .-- .-'' `'' . -= : - `' - com . yahoo @ 800 mohamdIRAQ - MUSEL -''`' ==-- -'='' --- ''= ' '-' ='=-- 2.6 D 3 Unity 2-3 Scale : -==-'' ) ' ---'' ---' ( .-=-'' '- .' --= offset =-'' '- -'= -= .---'-'' .-'- --= -=- =-- .' -- .' '+-'-=--` '' -'=-'' --='' absolute =- '-'=- .-- -==-'') Locale ( '-'= .-' ) Global ( .''- -- -` . transform.localScale=Vector3( x , y , z ); ```'' '=-'' '= -=-'' -==-' -=--- ' '--' '=-'' -=' '= -=-'' == --- -- =-'' .'- -'=-'' ---'' -- -=' '=-'' .'- =`' . '- '--' -=- '-- -- ---'' -=''' .- -' '-' '--' -- -- ---'' - -' -=-=''' .- '-' -- ' --- --` -=' '-- . --'' ---'' '= ---- .'-'' .`- ```'' ----'' --'- -- '- -==-'' ''='' -=-'' ==' ---''- ''='' =='' --- -- 100 ' '--' -- -- ---'' ``- -' 150 '-' --' ' ``- -' -- -- ---'' 50 '-- ' 100 --`- ' --- . ---'' - .-'-'' .-- .' --'' .-- '- 100 ---'' - .-'-'' -- 1 . .'`- : '' '= =-'' --= S '=-'' . '= -- '---- -=-'' --- -- . function Update () { if (Input.GetKeyDown("s") ) { transform.localScale =Vector3( 2 , 2 , 2 ); } '= =-'' -- S -== --- -=-'' --- --- .- -== -- -== ----- '---'' -- =-'' --= =' -- ' --- --` '' '= --='' -- .' '-' .=---'- .-' -'=- . ' '--' -- -=-'' - '' --- -== --- : transform.localScale =Vector3( 0.5 , 0.5 , 0.5 ); - '- '--- ' -=- : transform.localScale =Vector3( 1 , 1 , 1 ); -- ' --- --` -' -- -'='' . ---'' .= ---=- =--- '--' ---' --- .- .-' . . -= : - `- - com . yahoo @ 800 mohamdIRAQ - MUSEL -''`' ==-- -'='' --- ''= ' '-' ='=-- 2.6 D 3 Unity --- -== --- '---- ---'' -'=-'' .' ' : transform.localScale =Vector3( 1.5 , 1.5 , 1.5 ); .`' - '- '--- ' -=- : transform.localScale =Vector3( 0, 0, 0); -=-'' --=- -- '--` -- -== '-'= ' ----'' -=- '-+' '--' -=-'' --- ``- ---- 0.2 =- '= Y =''' .- =- .' --- : transform.localScale =Vector3( 0 , 1.2 , 0 ); =- '= ---'' .= - .` -=-'' --=-- ''='' -- - X Z -- .' -=---- : transform.localScale =Vector3( 1 , 1.2 , 1 ); ''-'' .-' --=- ' : transform.localScale.y = 1.2; ' '--' ---- ---'' 0.2 =- '= Y --- : transform.localScale.y = 0.2; .`' =- '' .' --= offset -==-'' -'' '+----' --'-''- -` --` -''' -==-'' -- .- -=-'' -'-'' '-' ----='' --'' -'' --='' -'- .-- '-- -==-'' ---='' '' -==-'' ''-'' ---'' : transform.localScale +=Vector3( 0.1 , 0.1 , 0.1 ); ---- .- =='' --- --` .' -=' .- -' ---'' '- ---' '--` '---' ---'' -- ''---- --- ''-''- ''='' =='' . ' '--' --- --='' --+- =='' --- : transform.localScale -= Vector3( 0.1 , 0.1 , 0.1 ); '--- ' : transform.localScale +=Vector3( 0 , 0 , 0 ); -- ' --- --` '--` '-- '-- -- '' -- `-` ''-''- ---'' =='' . -'- . .' --='' -'-'' --- ---'' . -= : - ` - com . yahoo @ 800 mohamdIRAQ - MUSEL -''`' ==-- -'='' --- ''= ' '-' ='=-- 2.6 D 3 Unity .'`- : ---- -=-'' --- -- 0.1 '---'- =- '= Y '-' .- '' ' .- -' --- '-- 5 -- ='=' '' -== '-`' . function Update () { transform.localScale += Vector3( 0 , 0.1 , 0 ); // transform.localScale.y += 0.1; // ' if (transform.localScale.y > = 5) { transform.localScale = Vector3( 1 , 1 , 1 ); // transform.localScale.y = 1; // ' } } 2-4 localRotation , localPosition .' '-=- -'-'' ---'' localScale '-' -- .' =-- '' '' -`-=-localPosition) localRotation ( +-'-=--' --= ='' -'' --= .- - -''- -'' '-=--' .= -`-=- ) position eulerAngles ( . ==`- : -''' -`-=-'' --'' '- .---` ) Global ( -'=-'' ) (Local -'' '-+=' --- . ='' -'' '-=--' --= .----='' - ---=- ---'' - ' '-' -='- -=-'' .' -'- ---'' ) .-' ( =' -=-' ` ' . -=-' -'- -= -=-'' .' ' =' '-=--' .-- -=- ` -`-=-'' .----='' '-' -=-' -'- -=-'' .' .'= =' -`-=-'' '-=--' -- Local =-- ---- .-`') --'' ( -=-'' '-+' ) .-`' ( -'' =--'' -=-'' - .`-- =`' ) -`' ( '-' --= --''' -`-=-'' '-=--' --'' -- '--=' -- ` . --- ` '- - --'' `-' .-= .- ) -' .- -- . ( -= : - `` - com . yahoo @ 800 mohamdIRAQ - MUSEL -''`' ==-- -'='' --- ''= ' '-' ='=-- 2.6 D 3 Unity .'`- : - -- ----'' --'- --- free =' -- - --- parent -= --'= .- - position --'- inspector '' ''-'' ) 3 0 5 ( =' -- - --- child .`' '- -- Hierarchy --'' '= =-' child '---' - --'' -=-' =-'' parent ' --'' '- -' .`' ---' --'' child --'' -'- parent --'' '- : .`' ''-'' -'' --' : function Update () { if (Input.GetKeyDown("m") ) { transform.position=Vector3.zero; } } ---'' - .---'' '= free child ' -''' .- - '= = M ==`-- '-+'-- - .---'' '' =-- .-`' ) --'' ( -=' -- .--- .' +-` ' - ='- .- -'-- --' -''' .--- '---' - '' --'- Scene +=-' .- ` ----'' --'- --'- Inspector +- - ' .---'' -=' . - .-'' - ''' - . -= : - ` - com . yahoo @ 800 mohamdIRAQ - MUSEL -''`' ==-- -'='' --- ''= ' '-' ='=-- 2.6 D 3 Unity .`' -'' -= '' : function Update () { if (Input.GetKeyDown("m") ) { transform.localPosition=Vector3.zero; } } '= =-' -''' .- M --'' .-- -- -- free '' =-- ' .-` ) --'' ( '-' --'' child '-- -- '' --'' - parent -` '-=--' --= '-' '- ' -'- -'=-'' -`-=-'' Local =-- --- .-`' -`' -=-'' - -=-'' .' -= . .`' -'' -= : transform.localPosition.z = 1; --'' .' ==`-- free =-- .- --=' --= -- '= - - .-`' ) --'' ( ---''- =-' Z --'' '---- child --'' .= --=' --= -- '= - - -`' parent .'`- : -'-'' .'`-'' ```'' -'--'' - .- .' .' --'' .=- child -'-'' -- parent - -' .=- -'' .' - parent 45 - =- '= = X ` --'' .=' child --'' -'- parent ''-'' ---'' --' ` : function Update () { if (Input.GetKeyDown("m") ) { transform.eulerAngles =Vector3.zero; } } .---'' '= ---'' - free child '= =-' -''' .- M --- --` .---'' -- ' .`' ---'' -= '' : function Update () { if (Input.GetKeyDown("m") ) { transform.localEulerAngles =Vector3.zero; } } '' '= =-' -''' .- M --'' .' ==`- -- free - --` - -- ' -- '-' --'' child --'' --- --- '--- -='- -- .' parent ------ ' 45 '= =- X '--` '=-'' ---'' '---=--' . --= - .- -= -= .- . -= : - ` - com . yahoo @ 800 mohamdIRAQ - MUSEL -''`' ==-- -'='' --- ''= ' '-' ='=-- 2.6 D 3 Unity 2- 5 RotateAround : --- =-- .= ---'' .-- =- '= --- =-- .= -=-'' .'-' -=--- transform.RotateAround( Position , Axis , Angle ) ; Position : .'-'' - =-- '+'= -=-'' --- -'' ' . -- '+''=-' .----=- Vector3( x ,y ,z ) : -- --= .'=-' .' .-- -=-'' --'' x , y , z) .( translate.position : '--= ''= .' -'' - .- .' .-- -=- - . Axis : .'-'' =- ---=- -- =-- -- -- -'' =-'' ---=- -=- .'-'' - .= -=-'' -'= -'' =-- . Angle : -=-'' .'-'' -' . .'-'' =- .--- --= Axis : ` - =- X : Vector3.right ' Vector3( 1 , 0 , 0 ) : `'- --='' -'=- Vector3.left ' Vector( -1 , 0 , 0 ): -'' -'=-`'- ` - =- Y : Vector3.up ' Vector3(0 , 1 , 0 ) : --='' -'=-`'- Vector3( 0 , -1 , 0 ): -'' -'=-`'- - =- Z : Vector3.forward ' Vector3(0 , 0 , 1 ) : --='' -'=-`'- Vector3( 0 , 0 , -1 ): -'' -'=-`'- ' - '=- --= : Vector3(1 , 1 , 0 ) : Y X '= =- Vector3(1 , 5 , 0 ): X=- .= '-- -' Y=- .= .' Y X '= =- .-'- .-- -- . -=-'' '=-'' .'- -=-'' --'' -- '- . --`' .-'' .'-= .'-='' .' . -= : - - com . yahoo @ 800 mohamdIRAQ - MUSEL -''`' ==-- -'='' --- ''= ' '-' ='=-- 2.6 D 3 Unity .'`- : =-- .= -- -=-'' .=' .-`' ) --'' ( -'- 90 --'`'' =- '= =- X . function Update () { transform.RotateAround(Vector3.zero,Vector3.right , 90 * Time.deltaTime); } .'`- : --' =' -=- .= -- -=-'' .=' center -'- 5 =- '= -'=- Z . --='' '`' : function Update () { var pos = gameObject.Find("center").transform.position; transform.RotateAround( pos ,Vector3. forward , 5 ); } - ---'' ' '= -=-'' .= --- -''' .- -=-' center . `- =-' ---''- .--'-=- .-- .---=-'' .=' == Z ==`-- `' .' -=-'' -- --- .= . --'`'' --='' : var pos : Transform;function Update () { transform.RotateAround(pos.position,Vector3. forward , 5 ); } - ---'' ' '= .- -=-' --'- Inspector ---'' -=-- ---'' --' -=-'' pos.--' ---' ---'' -'' -=-'' "center" --'' '- : -' .-' . .-' -'' .--' =='' -= -'== ) -' .- -- ( . -= : - ` - com . yahoo @ 800 mohamdIRAQ - MUSEL -''`' ==-- -'='' --- ''= ' '-' ='=-- 2.6 D 3 Unity .----='' .-- -''- -=' .-- '-- '-' ' --='' '`' .+-' : -'='' -=- .' ' `' --' -=- .- center --='' - '`' '-- ----` -'' -=-'' ---'' -='- .=- .--- -'--=- ='- .' ' -= -'=-'' -=-'' ---=- -=--- --'`'' --='' - =' --= ='- .' --= --' -'--' --'' -'' -= ---'' -`=' -=-'' -``' --'' '- -'--' : '--- -- . .- '- . -= : - ` - com . yahoo @ 800 mohamdIRAQ - MUSEL -''`' ==-- -'='' --- ''= ' '-' ='=-- 2.6 D 3 Unity 2-6 LookAt : ---'' -'=-'- --- =-- =-- -=-'' .=' -=--- '' --- =-- -'=-`' .= --- -'-`' =-' Z -=-'' =-- '' =--'' ='- . Transform.LookAt ( position ); --= .'=-' =--'' position --= .`- .'=-' .' position .' AroundRotate =--'' -`=' . .'`- : .' -'-'' .'`-'' .-- '= AroundRotate ''-'' ---'' --' : var lookat : Transform; function Update () { transform.LookAt(lookat.position); } ' '= ---'' - -=-' center .-' ' '= '= -- -'' -=-' "Cube" --'- .' Inspector .' center --' ---'' --'' - lookat .--' --'' - -=- '--'- '- -=-'' -``' ='' .' ==`-- -''' .- -'-`' Z -=-'' center =-- '''= -- --'' . .' '-=--' .-- LookAt =-- ' --''' - '' .-- -=- .-' ==- '- . 3- Distance .-- '--'' .--=-- Vector3.Distance ( position1 , position2 ) -''- .-` ' -'=- -- -'-`' ```'' -'--'' .--=-- .-- '--'' -' -=---.'=`' .- .'= ' . .'`- : '-- ' .' --' '-' =' -=- ---'' -='- -=-'' .-- '--'' -'-= -- 3 -'-= ---= .- -''='' '=-'' .--=- --'=' -- var other : Transform; function Update () { if (Vector3.Distance(transform.position , other.position )