《自定义临时实体动画》 上次小编为大家介绍了动画创建器,今天将会为大家继续介绍关于动画的创建,这次将会使用到surrogate翻译过来也就是替身,通过将替身赋予相关动画来进行演练,用于在动画创建器中模拟临时实体的动作,在仿真模型运行时,替身的外观、颜色、形状等会被临时实体外观所替代,替身是动画变量的一种。 Lasttimetheeditorintroducedtheanimationcreatortoeveryone。Today,Iwillcontinuetointroducethecreationofanimation。ThistimeIwillusesurrogatetotranslateit,whichisthestandin,andperformtheexercisebyassigningthestandintotherelevantanimation。,Usedtosimulatetheactionofflowitemsintheanimationcreator。Whenthesimulationmodelisrunning,theappearance,color,shape,etc。ofthestandinwillbereplacedbytheappearanceoftheflowitem,andthestandinisakindofanimationvariable。 动画变量可以在仿真模型运行时,在一定的条件或时间点下,改变动画的参数 Animationvariablescanchangetheanimationparametersundercertainconditionsortimepointswhenthesimulationmodelisrunning 那我们具体来看一个小案例,首先建立一个最基础的模型 Let’slookatasmallcaseindetail,andfirstestablishabasicmodel 借助上一次所学的,打开处理器的动画效果,首先依旧添加部件,将部件替身大小调节为临时实体的大小。 Withthehelpofwhatwelearnedlasttime,turnontheanimationeffectoftheprocessor,firststilladdparts,andadjustthesizeofthepartstandintothesizeofthetemporaryentity。 为部件添加一个动画,使其在2秒的时间内旋转一定角度,效果展示如下: Addananimationtotheparttorotateacertainanglein2seconds,theeffectisshownasfollows: 现在我们就利用替身做好了临时实体运动的效果,需要要将它转换为surrogate变量,让它成为真正的替身,选中替身,在右边的快捷属性窗口找到DrawSurrogate选择动画创建器里面所具有的外观Box,并设置一个名称。 Nowweusethesubstitutetocompletetheeffectofthetemporaryentitymovement,weneedtoconvertittoasurrogatevariabletomakeitarealsubstitute,selectthesubstitute,andfindtheDrawSurrogateintheshortcutpropertywindowontherighttoselecttheanimationcreator。AppearanceBox,andsetaname。 完全制作好替身动画之后,需要将临时实体进行替身替换,进入模型板块,在临时实体进入处理器的时候启动动画,点击处理器,在进入触发中设置动画模式,进行如下参数设置 Aftertheavataranimationiscompletelymade,youneedtoreplacethetemporaryentitywiththeavatar,enterthemodelsection,starttheanimationwhenthetemporaryentityenterstheprocessor,clicktheprocessor,settheanimationmodeintheentertrigger,andsetthefollowingparameters 运行模型可以看到出现了问题,出现了两个实体 Runthemodelandyoucanseethatthereisaproblemandtwoentitiesappear 其实是包含真正的临时实体和替身,由于替身跟临时实体现在已经是一模一样了,因此可以替代临时实体,所以可以将临时实体进行隐藏,隐藏的办法就是进入处理器的属性将显示内容的复选框给它去掉。 Infact,itcontainsrealtemporaryentitiesanddoubles。Sincethedoublesareexactlythesameasthetemporaryentities,theycanreplacethetemporaryentities。Therefore,thetemporaryentitiescanbehidden。ThewaytohideistoenterthepropertiesoftheprocessortodisplaythecontentcheckRemovethebox。 由于我设置的动画时间是2秒,因此将处理器的处理时间换为2秒,进行匹配。这样我们便得到这样的动画场景。 SincetheanimationtimeIsetis2seconds,theprocessingtimeoftheprocessorischangedto2secondsformatching。Inthisway,wegetsuchananimatedscene。 这样我们就实现了临时实体的动画,但是还有一个比较重要的逻辑步骤,我们应该在指定时间点清空surrogate变量,并停止动画。需要对处理器进行如下操作 Inthisway,wehaverealizedtheanimationoftemporaryentities,butthereisamoreimportantlogicalstep。Weshouldclearthesurrogatevariableatthespecifiedtimeandstoptheanimation。Thefollowingoperationsneedtobeperformedontheprocessor 到此我们就真正完成了这种方式的动画操作,当然关于动画的设置主要在于关键帧与时间轴的设置。 Sofarwehavereallycompletedtheanimationoperationinthisway。Ofcourse,theanimationsettingsmainlylieinthekeyframeandtimeaxissettings。 参考资料:腾讯课堂《从小白到大神》 英文翻译:Google翻译 本文由LearningYard学苑原创,若有侵权请联系删除。