Zeropoint 016 Thisisgoingtobeforthe X forthewind's gonnabe 0.0 onetoyouandfordizzyIt's gonnabenegative.
Zeropoint.
Let's sayhere I wasgonnaleaveitjust a zeroJustasyouleavetheseaatzeroand I thinkhisheadisallisalsostilltoobig.
Soyeah, thisisOK.
Andlet's takehereandresizethehandle a bitSothescalesgonnabepointforsevenfor X Y and Z I thinknowit's okay.
Sowhenyouselecttheheadsaidthescaletopointforseventhatis 0.474 x, y and z Theposition X X isgonnabenegative 0.274 andwhyisgonnabe 0.12 andyeah, thisiswhereourheadisgoingtobeexactly, Anditlooksgood.
Looksgood, Actually.
Lookslikeit's alreadybuiltonhimanyways.
As I said, we'renotgonnadothisthatoftenbecausemostmodelscomewiththehead.
Now, onething I wanttogetoutrightnow, I likewhen I goandspontaneouslyhavethingsthat I needtoexplainwhyweneedtohitapplytomakethatchangeapplytotheprefabAndifyou'rewatchingmytutorialsprobablyheardmesingthatlife 1000 timesWell, thisprefabrighthereisbasicallynowtheoriginalgameobjectoffthiswarriorthatwehaveinthehierarchy.
Soif I selectthatwarriorprefabintheprefabsfolder, ithastheaudiosourcecomponentattachedonhimnow.
Buttheattentionoutif I goheretowarriorandremoveandthisisthewarriorinthehierarchy, thecopyif I nowremovetheaudiosourcecomponent, theoriginalstillhasthesourcecomponentTheaudiobecausewedidnothit, applybutpayattentiontothedifference.
Now, if, however, I selectthewarriorinsideoftheprefabsfoldertheoriginalone.
Andif I gohere, forexample, andfilterfor a rigidbodycomponentAndif I appliedthatrigidbodycomponentontheoriginal, whatdoyouthink?
WhichmeansifwehaveeitherpresenttheupHirokiorthe W keyonourkeyboard, becauseif I takeherequickly, thehighlighttoolandthisisthecoordinatesystem.
Soherewehave.
Whyherewehave X andherewehave Z becausethisis a three D gameandbasicallyuponthe Y isplusdownisminusonthe X axistotherightisplus, whichmeansthepositivesignandontheleftisnegative.
I'm goingtoseeit's equaltovector 30 ThisisthedefaultonebecauseVector 30 is a shorthandforwritingVector 3000 for X, Y and Z becausewe'regonnadetectinputagain.
We'regoingtoseeifinputdotgetaxesandwe'regoingtoseehereaxes, horizontalaxisIfthatvalueisgreateroractually, ifit's a lowerthanzeroAndherewe'regoingtoseeelsegiveinputthatgetaccessandagainhereaxesthehorizontal.
Andifyougohere a shorthandforwritingnegativeoneforexes, you'rezerofor y and Z andtherightispositive.
Onefor X zeroforfour.
Y and Z basicallyweretransformingthisintotheworldspace, andthiswilltransformitintotheleftsideoffourgameobjectinsideofworldspace, anditwilldothesamethingherefortherightdirection.
Sonowthatwehavetheinputfortheleftintherightdirection, wehaveheretherotationdirectionrighthere, we'regoingtosay, ifinputthatoractuallynowweneedThio, rotateourgameobjectsthatweregoingtosayif a rotationdirectionisnotequaltoVectorthreethatzero.
Look, rotationisgonnabe a rotationdirectioninthegivenspeedandareactuallythegreaseandthatthegreaseisgonnagoingtobe a rotatedegreespersecondmultipliedwithtimethatdeltatime.
Basically, ifwehave 60 framesin a secondthatitwillbecalled 60 times.
Updatefunctionisgoodformoving a gameobjectusingthetransformpropertyorthecharactercontrolleraswearealreadydoingandalsoforgettinginputwhichwerealsodoinghereiswe'regettinginput.
Wedothatintheupdatefunction.
Fixedupdatefunctionisnotcalledeveryframe, butit's calledin a fixednumber.
Frameintervals.
Whatdoesthatmean?
It's basicallycalledeverythirdorfourthframe, andthisrighthereisdependentorthatisdependentonifwegounder, enditandgohereunderprojectsettingsandthentimeIfyoutake a lookhere, letmejustclearitwiththepencil.
Soifwehavesomethinglikethis, forexample, I don't knowinto a B and C andwewanttoseehere C isequalto a plus B.
Thiscalculationwillbealreadydoneandwecanusethevalueof C inthelateupdate, anditwillbethisvalueherecalculating a plus B, anditwillgiveusthevaluesea, andwewillbeabletousethatinthelateupdatelate.
Andifwetestitoutrightnow, thebeautyhereisthatourmaincameranowhasthesevisibleininspectorvariablesfortheoffset X, Y and Z Andwhatwecandowhen I hittheplaybutton, youwillseenowwherethecameraisisbasicallyhere.