欢迎来到天天文库
浏览记录
ID:34469349
大小:2.39 MB
页数:20页
时间:2019-03-06
《unity3d官方汽车教程的翻译版本car2》由会员上传分享,免费在线阅读,更多相关内容在学术论文-天天文库。
1、“TheCarTutorial”Part2CreatingaRacingGameforUnity在Unity中创建赛车游戏Part2:TweakingtheCar调整汽车Ifyou’vefollowedalongpart1ofthistutorialandassembledthecar,youarealreadyatapointwherethecarisprettyawesome.Butifyouhavedrivenitaroundabit,youwillprobablyhavenoticedthatthereisafterallroomforsomeimprovement.
2、如果你已经跟着教程的Part1部分学完并组装了汽车,那么在这个非常不错的汽车这里你已经做好了准备,但如果你驾驶它已经开了一点,你将可能会注意到还有一些可以改进的地方。Thisiswheretweakingentersthepicture.Ingamedevelopmenttweakingisacrucialpartofmakingyourgamefun,challenging,awesomeorwhatevergoalyouhaveforyourspecificgame.Theideaisthatwhenyouhavesetupthenutsandboltsthatmakes
3、yourgamerun,theremightbesomethingthatdoesn’tfeelquiteright-maybeyouwantthecarhandlingtobeabitdifferent,maybeyouwantthetopspeedtobeslightlydifferent,ormaybeyouwanttochangethescenelights.这是一个要调整进入的地方的图片,在游戏中,开发调整会使你的游戏更有趣,更具挑战性,更棒或你想在游戏中实现任何目标的一个最关键部分。这个想法就是当你设置螺栓和螺母使你的游戏能运行时,那里有一些东西你可能感觉不怎么正
4、确--也许你想让赛车的操控有一点不同,也许你希望的最高速度稍为有点不同,或者也许你只想改变场景内的灯光。AmajorstrengthofUnityisit’stweakability-asyouhaveseen,allthepublicvariablesinyourscriptsareshownintheinspector,soyoucanchangevalueswithoutgoingintothecode.Andevenmorepowerful:Whenyou’vemadeachangeyoujusthitplay,andyouwillinstantlyseetheres
5、ultofthatchange.Youneverhavetowaitforthescenetoberebuiltorforamajorrecompileofthecode.一个Unity引擎的实力是它的可调整性--像你看到的那样,在你的脚本中所有的公共变量在都显示在检查面板上,所以你能改变这些变量的值而不需要深入代码,并且更强大的是:当你有了改变时你只需点击播放,你会立即看到这种变化的结果,你不用等待场景被重构或等引擎重编译代码。CenterofMass质心Nowthemostobviousthingthatneedstobetweakedisprobablythatthec
6、arcanveryeasilybeflippedaroundwhenturning(ifyouhaven’ttriedyet,thenplayagainandspeedupabitandthenturnfromsidetosidewhilespeeding-thecarwillflipoverprettyeasily).Thereasonforthisflippingisthatwehaven’tyetdefinedthecar’scenterofmass.AlltheforcesthatareappliedtotheRigidbodyofthecar,areallappli
7、edattheRigidbody’scenterofmass.ThecenterofmassoftheRigidbodywillbecalculatedbyUnityaccordingtotheCollidersattachedtotheRigidbody,eitheronthesameGameObjectoronchildobjects.Sincethecenterofmassofacaristypicallynotthecenterofthecar(andprobablynotthecenterof
此文档下载收益归作者所有