12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459 |
- import { threeWorld } from "@/stores/threeWorld.ts";
- import { courseChapter3dShow } from "@/stores/courseChapter3dShow.ts";
- /**
- * 处理指定物体拖拽逻辑
- * 鼠标事件处理
- */
- export class DragAndDropEvent {
- // 可以被调用的 iframe 对象
- public objIframe : any = null;
- // 三维对象
- public ChengGuangYuanJing : any = null;
- // babylon 对象
- public BABYLON : any = null;
-
- /**
- * 用于记录当前的相机对应参数
- * 当 cameraRadius、cameraAlpha、cameraBeta 都不等于空
- * 则固定视角对应的参数
- */
- public cameraRadius : any = null;
- public cameraAlpha : any = null;
- public cameraBeta : any = null;
- /**
- * 记录当前被点击的物体,当鼠标释放后,则重置为null
- */
- public objClickMesh : any = null;
- /**
- * 记录另外一个可以跟着移动拖拽的物体的坐标,当鼠标释放后,则重置为null
- */
- public objClickMesh2 : any = null;
- /**
- * 记录被点击的物体的时候的坐标
- * */
- public clickMeshPosition = { "x" : 0, "y" : 0, "z" : 0 };
- /**
- * 记录鼠标当时点击三维的坐标
- */
- public clickPosition = { "x" : 0, "y" : 0, "z" : 0 };
- /**
- * 当前不可选中的物体列表,当鼠标弹起,则对应的物体先全部恢复可选中,然后重置为 []
- */
- public isPickableList : any = [];
- /**
- * 上一步是否显示 回调方法
- * open true - 显示, false - 隐藏
- */
- public tipsBtnsUpOpenEventCallback : any = null;
- /**
- * 下一步是否显示 回调方法
- * open true - 显示, false - 隐藏
- */
- public tipsBtnsDownOpenEventCallback : any = null;
- /**
- * 当前的鼠标移动逻辑是否可以触发了,进行一个控制
- * 要不然会出现闪烁问题
- */
- public meshBtnInteractiveBool = true;
- // 处理高光的对象
- public objHighlightLayerEvent : any = null;
- // 当前是否弹出对应的文字逻辑
- public txtBool = false;
- /**
- * 记录本次点击,高亮的物体列表
- */
- public highlightLayerMeshListClick = [];
- // 每次 new 出对象则会调用这个构造函数
- constructor() {
-
- }
- /**
- * 用于控制点击是否触发拖拽的逻辑
- * pickResult 鼠标的对象
- * statue 当前的步骤状态
- */
- public dragAndDropClick = (pickResult : any, statue : any) => {
- // console.log(
- // "用于控制点击是否触发拖拽的逻辑",
- // pickResult
- // );
- // @ts-ignore
- let objSceneActiveCamera = this.ChengGuangYuanJing.CommonVal.find().objSceneActiveCamera;
-
- let objMesh = pickResult.pickedMesh;
- let thisClickPosition = pickResult.pickedPoint;
- // 触发点击事件
- let clickEventBool = false;
-
- if (
- (
- statue == "将四个安全桩放置到正确的位置"
- && (
- objMesh.id == "model_1709892139359安全桩001"
- || objMesh.id == "model_1709892139359安全桩004"
- || objMesh.id == "model_1709892139359安全桩003"
- || objMesh.id == "model_1709892139359安全桩002"
- )
- )
-
- || (
- statue == "将检测机器人6寸轮子安装到正确位置"
- && (
- objMesh.id == "exhibition_html_1710385814466_6”后轮左_primitive0"
- || objMesh.id == "exhibition_html_1710385814466_6”后轮左_primitive1"
- || objMesh.id == "exhibition_html_1710385814466_6”中轮左_primitive0"
- || objMesh.id == "exhibition_html_1710385814466_6”中轮左_primitive1"
- || objMesh.id == "exhibition_html_1710385814466_6”前轮左_primitive0"
- || objMesh.id == "exhibition_html_1710385814466_6”前轮左_primitive0"
- || objMesh.id == "exhibition_html_1710385814466_6”后轮右_primitive0"
- || objMesh.id == "exhibition_html_1710385814466_6”后轮右_primitive0"
- || objMesh.id == "exhibition_html_1710385814466_6”中轮右_primitive0"
- || objMesh.id == "exhibition_html_1710385814466_6”中轮右_primitive1"
- || objMesh.id == "exhibition_html_1710385814466_6”前轮右_primitive0"
- || objMesh.id == "exhibition_html_1710385814466_6”前轮右_primitive1"
- )
- )
-
- || (
- statue == "将检测机器人的轮子安装到正确的位置"
- && (
- objMesh.id == "exhibition_html_1710385814466_10”后轮左_primitive0"
- || objMesh.id == "exhibition_html_1710385814466_10”后轮左_primitive1"
- || objMesh.id == "exhibition_html_1710385814466_10”后轮左_primitive2"
-
- || objMesh.id == "exhibition_html_1710385814466_10”前轮左_primitive0"
- || objMesh.id == "exhibition_html_1710385814466_10”前轮左_primitive1"
- || objMesh.id == "exhibition_html_1710385814466_10”前轮左_primitive2"
- || objMesh.id == "exhibition_html_1710385814466_10”后轮右_primitive0"
- || objMesh.id == "exhibition_html_1710385814466_10”后轮右_primitive1"
- || objMesh.id == "exhibition_html_1710385814466_10”后轮右_primitive2"
- || objMesh.id == "exhibition_html_1710385814466_10”前轮右_primitive0"
- || objMesh.id == "exhibition_html_1710385814466_10”前轮右_primitive1"
- || objMesh.id == "exhibition_html_1710385814466_10”前轮右_primitive2"
- )
- )
- || (
- statue == "将检测机器人6寸右侧轮子安装到正确位置"
- && (
- // objMesh.id == "exhibition_html_1710385814466_6”后轮左_primitive0"
- // || objMesh.id == "exhibition_html_1710385814466_6”后轮左_primitive1"
- // || objMesh.id == "exhibition_html_1710385814466_6”中轮左_primitive0"
- // || objMesh.id == "exhibition_html_1710385814466_6”中轮左_primitive1"
- // || objMesh.id == "exhibition_html_1710385814466_6”前轮左_primitive0"
- // || objMesh.id == "exhibition_html_1710385814466_6”前轮左_primitive0"
- objMesh.id == "exhibition_html_1710385814466_6”后轮右_primitive0"
- || objMesh.id == "exhibition_html_1710385814466_6”后轮右_primitive0"
- || objMesh.id == "exhibition_html_1710385814466_6”中轮右_primitive0"
- || objMesh.id == "exhibition_html_1710385814466_6”中轮右_primitive1"
- || objMesh.id == "exhibition_html_1710385814466_6”前轮右_primitive0"
- || objMesh.id == "exhibition_html_1710385814466_6”前轮右_primitive1"
- )
- )
-
- || (
- statue == "将检测机器人6寸左侧轮子安装到正确位置"
- && (
- objMesh.id == "exhibition_html_1710385814466_6”后轮左_primitive0"
- || objMesh.id == "exhibition_html_1710385814466_6”后轮左_primitive1"
- || objMesh.id == "exhibition_html_1710385814466_6”中轮左_primitive0"
- || objMesh.id == "exhibition_html_1710385814466_6”中轮左_primitive1"
- || objMesh.id == "exhibition_html_1710385814466_6”前轮左_primitive0"
- || objMesh.id == "exhibition_html_1710385814466_6”前轮左_primitive0"
- // || objMesh.id == "exhibition_html_1710385814466_6”后轮右_primitive0"
- // || objMesh.id == "exhibition_html_1710385814466_6”后轮右_primitive0"
- // || objMesh.id == "exhibition_html_1710385814466_6”中轮右_primitive0"
- // || objMesh.id == "exhibition_html_1710385814466_6”中轮右_primitive1"
- // || objMesh.id == "exhibition_html_1710385814466_6”前轮右_primitive0"
- // || objMesh.id == "exhibition_html_1710385814466_6”前轮右_primitive1"
- )
- )
- || (
- statue == "将检测机器人10寸右侧轮子安装到正确位置"
- && (
- // objMesh.id == "exhibition_html_1710385814466_10”后轮左_primitive0"
- // || objMesh.id == "exhibition_html_1710385814466_10”后轮左_primitive1"
- // || objMesh.id == "exhibition_html_1710385814466_10”后轮左_primitive2"
-
- // || objMesh.id == "exhibition_html_1710385814466_10”前轮左_primitive0"
- // || objMesh.id == "exhibition_html_1710385814466_10”前轮左_primitive1"
- // || objMesh.id == "exhibition_html_1710385814466_10”前轮左_primitive2"
- objMesh.id == "exhibition_html_1710385814466_10”后轮右_primitive0"
- || objMesh.id == "exhibition_html_1710385814466_10”后轮右_primitive1"
- || objMesh.id == "exhibition_html_1710385814466_10”后轮右_primitive2"
- || objMesh.id == "exhibition_html_1710385814466_10”前轮右_primitive0"
- || objMesh.id == "exhibition_html_1710385814466_10”前轮右_primitive1"
- || objMesh.id == "exhibition_html_1710385814466_10”前轮右_primitive2"
- )
- )
- || (
- statue == "将检测机器人10寸左侧轮子安装到正确位置"
- && (
- objMesh.id == "exhibition_html_1710385814466_10”后轮左_primitive0"
- || objMesh.id == "exhibition_html_1710385814466_10”后轮左_primitive1"
- || objMesh.id == "exhibition_html_1710385814466_10”后轮左_primitive2"
-
- || objMesh.id == "exhibition_html_1710385814466_10”前轮左_primitive0"
- || objMesh.id == "exhibition_html_1710385814466_10”前轮左_primitive1"
- || objMesh.id == "exhibition_html_1710385814466_10”前轮左_primitive2"
- // || objMesh.id == "exhibition_html_1710385814466_10”后轮右_primitive0"
- // || objMesh.id == "exhibition_html_1710385814466_10”后轮右_primitive1"
- // || objMesh.id == "exhibition_html_1710385814466_10”后轮右_primitive2"
- // || objMesh.id == "exhibition_html_1710385814466_10”前轮右_primitive0"
- // || objMesh.id == "exhibition_html_1710385814466_10”前轮右_primitive1"
- // || objMesh.id == "exhibition_html_1710385814466_10”前轮右_primitive2"
- )
- )
-
- || (
- statue == "将检测机器人的防撞杆安装到正确的位置"
- && (
- objMesh.id == "exhibition_html_1710385814466_防撞杆_primitive0"
- || objMesh.id == "exhibition_html_1710385814466_防撞杆_primitive1"
- )
- ) || (
- statue == "将检测机器人的防撞杆锁安装到正确的位置"
- && (
- objMesh.id == "exhibition_html_1710385814466_防撞杆锁_primitive0"
- || objMesh.id == "exhibition_html_1710385814466_防撞杆锁_primitive1"
- )
- ) || (
- statue == "将检测机器人的镜头架安装到正确的位置"
- && (
- objMesh.id == "exhibition_html_1710385814466_镜头架_primitive0"
- || objMesh.id == "exhibition_html_1710385814466_镜头架_primitive1"
- || objMesh.id == "exhibition_html_1710385814466_镜头架_primitive2"
- || objMesh.id == "exhibition_html_1710385814466_镜头架_primitive3"
- || objMesh.id == "exhibition_html_1710385814466_相机_primitive0"
- || objMesh.id == "exhibition_html_1710385814466_相机_primitive1"
- || objMesh.id == "exhibition_html_1710385814466_相机_primitive2"
- || objMesh.id == "exhibition_html_1710385814466_相机_primitive3"
- )
- ) || (
- statue == "将检测机器人的相机安装到正确的位置"
- && (
- objMesh.id == "exhibition_html_1710385814466_镜头架_primitive0"
- || objMesh.id == "exhibition_html_1710385814466_镜头架_primitive1"
- || objMesh.id == "exhibition_html_1710385814466_镜头架_primitive2"
- || objMesh.id == "exhibition_html_1710385814466_镜头架_primitive3"
- || objMesh.id == "exhibition_html_1710385814466_相机_primitive0"
- || objMesh.id == "exhibition_html_1710385814466_相机_primitive1"
- || objMesh.id == "exhibition_html_1710385814466_相机_primitive2"
- || objMesh.id == "exhibition_html_1710385814466_相机_primitive3"
- )
- ) || (
- statue == "将绕线车的电源线安装到正确的位置"
- && (
- objMesh.id == "exhibition_html_1710385814466_绕线车-电源线"
- )
- ) || (
- statue == "将绕线车的纠偏轮安装到正确的位置"
- && (
- objMesh.id == "exhibition_html_1710385814466_绕线车-纠偏轮_primitive0"
- || objMesh.id == "exhibition_html_1710385814466_绕线车-纠偏轮_primitive1"
- )
- ) || (
- statue == "将绕线车的锂电池安装到正确的位置"
- && (
- objMesh.id == "exhibition_html_1710385814466_锂电池_primitive0"
- || objMesh.id == "exhibition_html_1710385814466_锂电池_primitive1"
- || objMesh.id == "exhibition_html_1710385814466_锂电池_primitive2"
- )
- ) || (
- statue == "将绕线车的电脑主机放置到正确的位置"
- && (
- objMesh.id == "exhibition_html_1710385814466_电脑屏幕_primitive0"
- || objMesh.id == "exhibition_html_1710385814466_电脑屏幕_primitive1"
- || objMesh.id == "exhibition_html_1710385814466_电脑屏幕_primitive2"
- || objMesh.id == "exhibition_html_1710385814466_电脑主机_primitive0"
- || objMesh.id == "exhibition_html_1710385814466_电脑主机_primitive1"
- || objMesh.id == "exhibition_html_1710385814466_电脑主机_primitive2"
- || objMesh.id == "exhibition_html_1710385814466_电脑主机_primitive3"
- )
- ) || (
- statue == "将绕线车的手柄安装到正确的位置"
- && (
- objMesh.id == "exhibition_html_1710385814466_手柄_primitive0"
- || objMesh.id == "exhibition_html_1710385814466_手柄_primitive1"
- || objMesh.id == "exhibition_html_1710385814466_手柄_primitive2"
- || objMesh.id == "exhibition_html_1710385814466_手柄_primitive3"
- )
- )
-
- ) {
- clickEventBool = true;
-
- this.iframeCanvasStyle("pointer");
-
- // 开始触发鼠标移动逻辑
- courseChapter3dShow().show.pickResultMoveBool = true;
- }
- if (clickEventBool == false) {
- return;
- }
- // console.log(
- // "是否允许拖拽",
- // statue,
- // objMesh.id,
- // gizmoManagerBool,
- // objMesh
- // );
- if (
- objMesh.parent != null && objMesh.parent != undefined
- && (
- (
- objMesh.id == "exhibition_html_1710385814466_10”后轮左_primitive0"
- || objMesh.id == "exhibition_html_1710385814466_10”后轮左_primitive1"
- || objMesh.id == "exhibition_html_1710385814466_10”后轮左_primitive2"
-
- || objMesh.id == "exhibition_html_1710385814466_10”前轮左_primitive0"
- || objMesh.id == "exhibition_html_1710385814466_10”前轮左_primitive1"
- || objMesh.id == "exhibition_html_1710385814466_10”前轮左_primitive2"
- || objMesh.id == "exhibition_html_1710385814466_10”后轮右_primitive0"
- || objMesh.id == "exhibition_html_1710385814466_10”后轮右_primitive1"
- || objMesh.id == "exhibition_html_1710385814466_10”后轮右_primitive2"
- || objMesh.id == "exhibition_html_1710385814466_10”前轮右_primitive0"
- || objMesh.id == "exhibition_html_1710385814466_10”前轮右_primitive1"
- || objMesh.id == "exhibition_html_1710385814466_10”前轮右_primitive2"
- || objMesh.id == "exhibition_html_1710385814466_6”后轮左_primitive0"
- || objMesh.id == "exhibition_html_1710385814466_6”后轮左_primitive1"
- || objMesh.id == "exhibition_html_1710385814466_6”中轮左_primitive0"
- || objMesh.id == "exhibition_html_1710385814466_6”中轮左_primitive1"
- || objMesh.id == "exhibition_html_1710385814466_6”前轮左_primitive0"
- || objMesh.id == "exhibition_html_1710385814466_6”前轮左_primitive0"
- || objMesh.id == "exhibition_html_1710385814466_6”后轮右_primitive0"
- || objMesh.id == "exhibition_html_1710385814466_6”后轮右_primitive0"
- || objMesh.id == "exhibition_html_1710385814466_6”中轮右_primitive0"
- || objMesh.id == "exhibition_html_1710385814466_6”中轮右_primitive1"
- || objMesh.id == "exhibition_html_1710385814466_6”前轮右_primitive0"
- || objMesh.id == "exhibition_html_1710385814466_6”前轮右_primitive1"
- ) || (
- objMesh.id == "exhibition_html_1710385814466_镜头架_primitive0"
- || objMesh.id == "exhibition_html_1710385814466_镜头架_primitive1"
- || objMesh.id == "exhibition_html_1710385814466_镜头架_primitive2"
- || objMesh.id == "exhibition_html_1710385814466_镜头架_primitive3"
- ) || (
- objMesh.id == "exhibition_html_1710385814466_相机_primitive0"
- || objMesh.id == "exhibition_html_1710385814466_相机_primitive1"
- || objMesh.id == "exhibition_html_1710385814466_相机_primitive2"
- || objMesh.id == "exhibition_html_1710385814466_相机_primitive3"
- ) || (
- objMesh.id == "exhibition_html_1710385814466_绕线车-纠偏轮_primitive0"
- || objMesh.id == "exhibition_html_1710385814466_绕线车-纠偏轮_primitive1"
- ) || (
- objMesh.id == "exhibition_html_1710385814466_锂电池_primitive0"
- || objMesh.id == "exhibition_html_1710385814466_锂电池_primitive1"
- || objMesh.id == "exhibition_html_1710385814466_锂电池_primitive2"
- ) || (
- objMesh.id == "exhibition_html_1710385814466_电脑屏幕_primitive0"
- || objMesh.id == "exhibition_html_1710385814466_电脑屏幕_primitive1"
- || objMesh.id == "exhibition_html_1710385814466_电脑屏幕_primitive2"
- || objMesh.id == "exhibition_html_1710385814466_电脑主机_primitive0"
- || objMesh.id == "exhibition_html_1710385814466_电脑主机_primitive1"
- || objMesh.id == "exhibition_html_1710385814466_电脑主机_primitive2"
- || objMesh.id == "exhibition_html_1710385814466_电脑主机_primitive3"
- ) || (
- objMesh.id == "exhibition_html_1710385814466_手柄_primitive0"
- || objMesh.id == "exhibition_html_1710385814466_手柄_primitive1"
- || objMesh.id == "exhibition_html_1710385814466_手柄_primitive2"
- || objMesh.id == "exhibition_html_1710385814466_手柄_primitive3"
- ) || (
- objMesh.id == "exhibition_html_1710385814466_防撞杆_primitive0"
- || objMesh.id == "exhibition_html_1710385814466_防撞杆_primitive1"
- ) || (
- objMesh.id == "exhibition_html_1710385814466_防撞杆锁_primitive0"
- || objMesh.id == "exhibition_html_1710385814466_防撞杆锁_primitive1"
- )
- )
- ) {
- // 重新更新被拖拽的目标物体
- objMesh = objMesh.parent;
- let list : any = [];
- // 设置旋转
- if (objMesh.id == "exhibition_html_1710385814466__10”前轮右") {
-
- list = [
-
- { "name" : "10”前轮右轴", "speed" : 1, "from" : 6, "to" : 6 },
- { "name" : "10”前轮右", "speed" : 1, "from" : 6, "to" : 6 },
- ];
-
-
- } else if (objMesh.id == "exhibition_html_1710385814466__10”后轮右") {
- list = [
-
- { "name" : "10”后轮右轴", "speed" : 1, "from" : 6, "to" : 6 },
- { "name" : "10”后轮右", "speed" : 1, "from" : 6, "to" : 6 },
- ];
-
- } else if (objMesh.id == "exhibition_html_1710385814466__10”前轮左") {
- list = [
-
- { "name" : "10”前轮左轴", "speed" : 1, "from" : 6, "to" : 6 },
- { "name" : "10”前轮左", "speed" : 1, "from" : 6, "to" : 6 },
-
- ];
- } else if (objMesh.id == "exhibition_html_1710385814466__10”后轮左") {
- list = [
- { "name" : "10”后轮左轴", "speed" : 1, "from" : 6, "to" : 6 },
- { "name" : "10”后轮左", "speed" : 1, "from" : 6, "to" : 6 },
-
- ];
-
- } else if (objMesh.id == "exhibition_html_1710385814466__6”前轮右") {
- // @ts-ignore
- this.ChengGuangYuanJing.CommonVal.find().animationGroupsEventCallback(
- "6”前轮右", 'start', 10, 6, 6, false, null, function(state : any, objAnimation : any) {
- if (state == "播放完成") {
-
- }
-
- }
- );
- } else if (objMesh.id == "exhibition_html_1710385814466__6”中轮右") {
- // @ts-ignore
- this.ChengGuangYuanJing.CommonVal.find().animationGroupsEventCallback(
- "6”中轮右", 'start', 10, 6, 6, false, null, function(state : any, objAnimation : any) {
- if (state == "播放完成") {
-
- }
-
- }
- );
- } else if (objMesh.id == "exhibition_html_1710385814466__6”后轮右") {
- // @ts-ignore
- this.ChengGuangYuanJing.CommonVal.find().animationGroupsEventCallback(
- "6”后轮右", 'start', 10, 6, 6, false, null, function(state : any, objAnimation : any) {
- if (state == "播放完成") {
-
- }
-
- }
- );
- } else if (objMesh.id == "exhibition_html_1710385814466__6”前轮左") {
- // @ts-ignore
- this.ChengGuangYuanJing.CommonVal.find().animationGroupsEventCallback(
- "6”前轮左", 'start', 10, 6, 6, false, null, function(state : any, objAnimation : any) {
- if (state == "播放完成") {
-
- }
-
- }
- );
- } else if (objMesh.id == "exhibition_html_1710385814466__6”中轮左") {
- // @ts-ignore
- this.ChengGuangYuanJing.CommonVal.find().animationGroupsEventCallback(
- "6”中轮左", 'start', 10, 6, 6, false, null, function(state : any, objAnimation : any) {
- if (state == "播放完成") {
-
- }
-
- }
- );
- } else if (objMesh.id == "exhibition_html_1710385814466__6”后轮左") {
- // @ts-ignore
- this.ChengGuangYuanJing.CommonVal.find().animationGroupsEventCallback(
- "6”后轮左", 'start', 10, 6, 6, false, null, function(state : any, objAnimation : any) {
- if (state == "播放完成") {
-
- }
-
- }
- );
- }
- for (let i = 0; i < list.length; i++) {
- let thisList = list[i];
- // @ts-ignore
- this.ChengGuangYuanJing.CommonVal.find().animationGroupsEventCallback(
- thisList.name, 'start', thisList.speed, thisList.from, thisList.to, false, null, function(state : any, objAnimation : any) {
- if (state == "播放完成") {
-
- }
-
- }
- );
- }
-
- }
-
- if (
- objSceneActiveCamera != null && objSceneActiveCamera != undefined
- && clickEventBool == true
- ) {
- this.cameraRadius = objSceneActiveCamera.radius;
- this.cameraAlpha = objSceneActiveCamera.alpha;
- this.cameraBeta = objSceneActiveCamera.beta;
- this.objClickMesh = objMesh;
- // console.log(
- // "点击选中的物体,或者是节点",
- // this.objClickMesh
- // );
- // 进行特殊处理
- if (this.objClickMesh.id == "exhibition_html_1710385814466__镜头架") {
- this.objClickMesh2 = this.ChengGuangYuanJing.CommonVal.find().objScene.getNodeById("exhibition_html_1710385814466__相机");
- }
- else if (this.objClickMesh.id == "exhibition_html_1710385814466__相机") {
- this.objClickMesh2 = this.ChengGuangYuanJing.CommonVal.find().objScene.getNodeById("exhibition_html_1710385814466__镜头架");
- }
- else if (this.objClickMesh.id == "exhibition_html_1710385814466__电脑屏幕") {
- this.objClickMesh2 = this.ChengGuangYuanJing.CommonVal.find().objScene.getNodeById("exhibition_html_1710385814466__电脑主机");
- }
- else if (this.objClickMesh.id == "exhibition_html_1710385814466__电脑主机") {
- this.objClickMesh2 = this.ChengGuangYuanJing.CommonVal.find().objScene.getNodeById("exhibition_html_1710385814466__电脑屏幕");
- }
- else {
- this.objClickMesh2 = null;
- }
- // objClickMesh2 = objMesh;
- // 临时记录 objClickMesh2 的所在世界坐标
- if (this.objClickMesh2 != null && this.objClickMesh2 != undefined) {
- this.objClickMesh2["oldAbsolutePosition"] = JSON.parse(JSON.stringify({
- "x" : this.objClickMesh2.absolutePosition.x,
- "y" : this.objClickMesh2.absolutePosition.y,
- "z" : this.objClickMesh2.absolutePosition.z
- }));
- }
- /**
- * 这里是关键,一定要把对应的物体不可选中
- * 后续开发你会发现,会让目标多个物体同时设置不可选中
- */
- this.isPickableList = [];
- this.isPickableList.push(objMesh);
- this.childrenIsPickableUpdate(this.isPickableList, false);
-
- // 一定要用获取绝对坐标,这样才可以解决不同模型轴向,问题导致设置 position 会各种出错
- this.clickMeshPosition.x = objMesh.absolutePosition.x;
- this.clickMeshPosition.y = objMesh.absolutePosition.y;
- this.clickMeshPosition.z = objMesh.absolutePosition.z;
-
- this.clickPosition.x = thisClickPosition.x;
- this.clickPosition.y = thisClickPosition.y;
- this.clickPosition.z = thisClickPosition.z;
- } else {
- this.cameraRadius = null;
- this.cameraAlpha = null;
- this.cameraBeta = null;
- this.objClickMesh = null;
- this.objClickMesh2 = null;
- // 重置为可选中
- this.childrenIsPickableUpdate(this.isPickableList, true);
- this.isPickableList = [];
- }
-
- }
- /**
- * 切换3d的iframe的canvas 的手势样式
- * type normal - 正常样式, pointer - 手势样式
- */
- public iframeCanvasStyle = (type : any) => {
-
- // @ts-ignore
- // let objRenderCanvas = threeWorld().obj.newIframe.objIframe.document.getElementById("renderCanvas");
- let objRenderCanvas = threeWorld().obj.newIframe.objIframe.document.getElementById("canvasZone");
- if (objRenderCanvas == null || objRenderCanvas == undefined) {
- return;
- }
- // console.log(
- // "切换3d的iframe的canvas 的手势样式",
- // objRenderCanvas,
- // type
- // );
- if (type == "pointer") {
-
- objRenderCanvas.style.cursor = "pointer";
- return;
- }
-
- objRenderCanvas.style.cursor = "default";
-
- }
-
- /**
- * 设置目标对象,是否存在子物体对象,来设置 ( isPickable ) 是否可选中
- * objMeshList 目标 mesh 或者 node 对象 列表
- * bool true - 可选中, false - 不可选中
- */
- public childrenIsPickableUpdate = (objMeshList : any, bool : any) => {
- // 设置为不可选中
- for (var i = 0; i < objMeshList.length; i++) {
- let thisObjMeshList = objMeshList[i];
- // 如果存在子物体
- if (thisObjMeshList._children != null && thisObjMeshList._children != undefined) {
- for (let i = 0; i < thisObjMeshList._children.length; i++) {
- let thisChildren = thisObjMeshList._children[i];
- thisChildren.isPickable = bool;
- }
-
- }
-
- thisObjMeshList.isPickable = bool;
- }
-
- }
- /**
- * 用于控制拖拽鼠标弹起后的逻辑
- * pickResult 鼠标的对象
- * statue 当前的步骤状态
- */
- public dragAndDropPointerup = (pickResult : any, statue : any) => {
- // console.log(
- // "用于控制拖拽鼠标弹起后的逻辑",
- // // pickResult,
- // pickResult.pickedPoint
- // );
- // let objMesh = pickResult.pickedMesh;
- // let thisClickPosition = pickResult.pickedPoint;
-
- if (
- statue == "将四个安全桩放置到正确的位置"
- || statue == "将检测机器人6寸轮子安装到正确位置"
- || statue == "将检测机器人的轮子安装到正确的位置"
- || statue == "将检测机器人6寸右侧轮子安装到正确位置"
- || statue == "将检测机器人6寸左侧轮子安装到正确位置"
- || statue == "将检测机器人10寸右侧轮子安装到正确位置"
- || statue == "将检测机器人10寸左侧轮子安装到正确位置"
- || statue == "将检测机器人的防撞杆安装到正确的位置"
- || statue == "将检测机器人的防撞杆锁安装到正确的位置"
- || statue == "将检测机器人的镜头架安装到正确的位置"
- || statue == "将检测机器人的相机安装到正确的位置"
- || statue == "将绕线车的电源线安装到正确的位置"
- || statue == "将绕线车的纠偏轮安装到正确的位置"
- || statue == "将绕线车的锂电池安装到正确的位置"
- || statue == "将绕线车的电脑主机放置到正确的位置"
- || statue == "将绕线车的手柄安装到正确的位置"
- ) {
- this.dragAndDropPointerupEvent(pickResult, statue);
- }
-
- this.cameraRadius = null;
- this.cameraAlpha = null;
- this.cameraBeta = null;
- this.objClickMesh = null;
- this.objClickMesh2 = null;
- // 重置为可选中
- this.childrenIsPickableUpdate(this.isPickableList, true);
- this.isPickableList = [];
-
- if (
- statue == "将四个安全桩放置到正确的位置"
- || statue == "将检测机器人6寸轮子安装到正确位置"
- || statue == "将检测机器人的轮子安装到正确的位置"
-
- || statue == "将检测机器人6寸右侧轮子安装到正确位置"
- || statue == "将检测机器人6寸左侧轮子安装到正确位置"
- || statue == "将检测机器人10寸右侧轮子安装到正确位置"
- || statue == "将检测机器人10寸左侧轮子安装到正确位置"
- || statue == "将检测机器人的防撞杆安装到正确的位置"
- || statue == "将检测机器人的防撞杆锁安装到正确的位置"
- || statue == "将检测机器人的镜头架安装到正确的位置"
- || statue == "将检测机器人的相机安装到正确的位置"
- || statue == "将绕线车的电源线安装到正确的位置"
- || statue == "将绕线车的纠偏轮安装到正确的位置"
- || statue == "将绕线车的锂电池安装到正确的位置"
- || statue == "将绕线车的电脑主机放置到正确的位置"
- || statue == "将绕线车的手柄安装到正确的位置"
- ) {
- this.iframeCanvasStyle("normal");
- // 开始触发鼠标移动逻辑
- courseChapter3dShow().show.pickResultMoveBool = false;
- }
-
- }
- /**
- * 拖拽鼠标弹起后判断对应流程是否可以继续往下走
- * pickResult 鼠标的对象
- * statue 当前的步骤状态
- *
- */
- public dragAndDropPointerupEvent = (pickResult : any, statue : any) => {
- if (this.objClickMesh == null || this.objClickMesh == undefined) {
- return;
- }
-
- let meshInstallConfig : any = threeWorld().obj.meshInstallConfig;
- // console.log(
- // "拖拽鼠标弹起后判断对应流程是否可以继续往下走",
- // statue,
- // meshInstallConfig
- // );
- // @ts-ignore
- let CommonVal = this.ChengGuangYuanJing.CommonVal;
- // 被判断的多个物体列表
- let list : any = [];
- // 对应数组下标数量
- let positionListIndex : any = {};
- // 记录 positionListIndex 出现的数量
- let positionListIndexSum = 0;
- // 记录符合条件的数量
- let sumOk = 0;
- // 记录符合条件的id
- let okJsonId : any = {};
- // 是否出现过不符合条件的数据
- let noCondition = false;
- // 是否出现设置到范围坐标里
- let updatePosition = false;
- switch (statue) {
- case '将四个安全桩放置到正确的位置':
- // objClickMesh
- list = [
- "model_1709892139359安全桩001",
- "model_1709892139359安全桩002",
- "model_1709892139359安全桩003",
- "model_1709892139359安全桩004",
- ];
- // 判断已经在的数组下标数量
- for (let i = 0; i < list.length; i++) {
- let thisList = list[i];
- let objMesh = CommonVal.find().objScene.getMeshById(thisList);
- if (objMesh != null && objMesh != undefined) {
-
- if (meshInstallConfig[thisList] != null && meshInstallConfig[thisList] != undefined) {
- let objMeshInstallConfig = meshInstallConfig[thisList];
- let absolutePosition = objMeshInstallConfig['absolutePosition'];
- let positionList = objMeshInstallConfig['positionList'];
- let distance = objMeshInstallConfig['distance'];
-
- for (let positionListI = 0; positionListI < positionList.length; positionListI++) {
- let thisPositionList = positionList[positionListI];
- // 得到两点之间的距离
- let thisVector3distanceTo = this.BABYLON.Vector3.Distance(
- new this.BABYLON.Vector3(parseFloat(objMesh.absolutePosition.x), parseFloat(objMesh.absolutePosition.y), parseFloat(objMesh.absolutePosition.z)),
- new this.BABYLON.Vector3(parseFloat(thisPositionList.x), parseFloat(thisPositionList.y), parseFloat(thisPositionList.z))
- );
- // console.log(
- // "thisVector3distanceTo", thisVector3distanceTo
- // );
- if (thisVector3distanceTo <= distance) {
- if (positionListIndex[positionListI] == null || positionListIndex[positionListI] == undefined) {
- positionListIndex[positionListI] = [];
- }
- positionListIndex[positionListI].push(thisList);
- // 设置为所在坐标
- if (thisList == this.objClickMesh.id) {
- updatePosition = true;
- // 回归坐标点逻辑
- this.objClickMesh.setAbsolutePosition(
- new this.BABYLON.Vector3(
- parseFloat(thisPositionList.x), parseFloat(thisPositionList.y), parseFloat(thisPositionList.z)
- )
- );
- }
-
- }
-
- }
- }
- }
- }
- // console.log(
- // "positionListIndex", positionListIndex
- // );
-
- // 循环判断是否恢复原始位置
- for (let key in positionListIndex) {
- positionListIndexSum += 1;
- let array = positionListIndex[key];
- // console.log(
- // "array", array
- // );
- if (array.length <= 0) {
- noCondition = true;
- }
- if (array.length >= 2) {
- noCondition = true;
- for (let i = 0; i < array.length; i++) {
- let thisArray = array[i];
- // console.log(
- // "thisArray", thisArray
- // );
- if (thisArray == this.objClickMesh.id) {
- if (meshInstallConfig[thisArray] != null && meshInstallConfig[thisArray] != undefined) {
- let objMeshInstallConfig = meshInstallConfig[thisArray];
- let absolutePosition = objMeshInstallConfig['absolutePosition'];
- // 回归坐标点逻辑
- this.objClickMesh.setAbsolutePosition(
- new this.BABYLON.Vector3(
- parseFloat(absolutePosition.x), parseFloat(absolutePosition.y), parseFloat(absolutePosition.z)
- )
- );
-
- }
-
- }
- }
- }
- }
- // console.log(
- // "noCondition", noCondition,
- // positionListIndex
- // );
- // 没有出现过在范围做表里
- if (updatePosition == false) {
- if (meshInstallConfig[this.objClickMesh.id] != null && meshInstallConfig[this.objClickMesh.id] != undefined) {
- let objMeshInstallConfig = meshInstallConfig[this.objClickMesh.id];
- let absolutePosition = objMeshInstallConfig['absolutePosition'];
- // 回归坐标点逻辑
- this.objClickMesh.setAbsolutePosition(
- new this.BABYLON.Vector3(
- parseFloat(absolutePosition.x), parseFloat(absolutePosition.y), parseFloat(absolutePosition.z)
- )
- );
- }
- }
- if (noCondition == false && positionListIndexSum >= list.length) {
- courseChapter3dShow().show.showCongratulationsViewBool = true;
- courseChapter3dShow().show.showEndViewBool = true;
- // courseChapter3dShow().show.showCongratulationsTxt = "安全桩成功放置完成,请点击下一步,将盒子拆开";
-
- // 上一步和下一步是否显示
- this.tipsBtnsUpOpenEvent(true);
- this.tipsBtnsDownOpenEvent(true);
- } else {
- courseChapter3dShow().show.showCongratulationsViewBool = false;
- courseChapter3dShow().show.showEndViewBool = false;
- // 上一步和下一步是否显示
- this.tipsBtnsUpOpenEvent(false);
- this.tipsBtnsDownOpenEvent(false);
- }
-
- break;
- case '将检测机器人6寸轮子安装到正确位置':
- list = [
-
- "exhibition_html_1710385814466__6”前轮右",
- "exhibition_html_1710385814466__6”中轮右",
- "exhibition_html_1710385814466__6”后轮右",
- "exhibition_html_1710385814466__6”前轮左",
- "exhibition_html_1710385814466__6”中轮左",
- "exhibition_html_1710385814466__6”后轮左",
- ];
- this.dragAndDropPointerupAnimationEvent(statue, list, 'node');
- break;
- case '将检测机器人的轮子安装到正确的位置':
- list = [
- "exhibition_html_1710385814466__10”前轮右",
- "exhibition_html_1710385814466__10”后轮右",
- "exhibition_html_1710385814466__10”前轮左",
- "exhibition_html_1710385814466__10”后轮左",
- ];
- this.dragAndDropPointerupAnimationEvent(statue, list, 'node');
-
- break;
- case '将检测机器人6寸右侧轮子安装到正确位置':
- list = [
-
- "exhibition_html_1710385814466__6”前轮右",
- "exhibition_html_1710385814466__6”中轮右",
- "exhibition_html_1710385814466__6”后轮右",
- // "exhibition_html_1710385814466__6”前轮左",
- // "exhibition_html_1710385814466__6”中轮左",
- // "exhibition_html_1710385814466__6”后轮左",
- ];
- this.dragAndDropPointerupAnimationEvent(statue, list, 'node');
- break;
- case '将检测机器人6寸左侧轮子安装到正确位置':
- list = [
-
- // "exhibition_html_1710385814466__6”前轮右",
- // "exhibition_html_1710385814466__6”中轮右",
- // "exhibition_html_1710385814466__6”后轮右",
- "exhibition_html_1710385814466__6”前轮左",
- "exhibition_html_1710385814466__6”中轮左",
- "exhibition_html_1710385814466__6”后轮左",
- ];
- this.dragAndDropPointerupAnimationEvent(statue, list, 'node');
- break;
- case '将检测机器人10寸右侧轮子安装到正确位置':
- list = [
- "exhibition_html_1710385814466__10”前轮右",
- "exhibition_html_1710385814466__10”后轮右",
- // "exhibition_html_1710385814466__10”前轮左",
- // "exhibition_html_1710385814466__10”后轮左",
- ];
- this.dragAndDropPointerupAnimationEvent(statue, list, 'node');
-
- break;
- case '将检测机器人10寸左侧轮子安装到正确位置':
- list = [
- // "exhibition_html_1710385814466__10”前轮右",
- // "exhibition_html_1710385814466__10”后轮右",
- "exhibition_html_1710385814466__10”前轮左",
- "exhibition_html_1710385814466__10”后轮左",
- ];
- this.dragAndDropPointerupAnimationEvent(statue, list, 'node');
-
- break;
-
- case '将检测机器人的防撞杆安装到正确的位置':
- list = [
- "exhibition_html_1710385814466__防撞杆",
- ];
-
- this.dragAndDropPointerupAnimationEvent(statue, list, 'node');
-
- break;
- case '将检测机器人的防撞杆锁安装到正确的位置':
- list = [
- "exhibition_html_1710385814466__防撞杆锁",
- ];
-
- this.dragAndDropPointerupAnimationEvent(statue, list, 'node');
-
- break;
- case '将检测机器人的镜头架安装到正确的位置':
- list = [
- "exhibition_html_1710385814466__镜头架",
- ];
- this.dragAndDropPointerupAnimationEvent(statue, list, 'node');
-
- break;
- case '将检测机器人的相机安装到正确的位置':
- list = [
- "exhibition_html_1710385814466__相机",
- ];
- this.dragAndDropPointerupAnimationEvent(statue, list, 'node');
-
- break;
- case '将绕线车的电源线安装到正确的位置':
- list = [
- "exhibition_html_1710385814466_绕线车-电源线",
- ];
- this.dragAndDropPointerupAnimationEvent(statue, list, 'mesh');
-
- break;
-
- case '将绕线车的纠偏轮安装到正确的位置':
- list = [
- "exhibition_html_1710385814466__绕线车-纠偏轮",
- ];
- this.dragAndDropPointerupAnimationEvent(statue, list, 'node');
-
- break;
- case '将绕线车的锂电池安装到正确的位置':
- list = [
- "exhibition_html_1710385814466__锂电池",
- ];
- this.dragAndDropPointerupAnimationEvent(statue, list, 'node');
-
- break;
- case '将绕线车的电脑主机放置到正确的位置':
- list = [
- "exhibition_html_1710385814466__电脑屏幕",
- // "exhibition_html_1710385814466__电脑主机",
- ];
- this.dragAndDropPointerupAnimationEvent(statue, list, 'node');
-
- break;
- case '将绕线车的手柄安装到正确的位置':
- list = [
- "exhibition_html_1710385814466__手柄",
- ];
- this.dragAndDropPointerupAnimationEvent(statue, list, 'node');
-
- break;
-
- }
- }
- /**
- * 统一判断拖拽通过动画来决定安装的结果
- * statue 当前的步骤状态
- * list 目标列表
- * type 类型
- * mesh - 物体
- * node - Node
- *
- *
- *
- */
- public dragAndDropPointerupAnimationEvent = (statue : any, list : any, type : any) => {
-
- let meshInstallConfig : any = threeWorld().obj.meshInstallConfig;
- // @ts-ignore
- let CommonVal = threeWorld().obj.newIframe.objIframe.ChengGuangYuanJing.CommonVal;
-
- // 记录符合条件的数量
- let sumOk = 0;
- // 记录符合条件的id
- let okJsonId : any = {};
- // 判断已经在的数组下标数量
- for (let i = 0; i < list.length; i++) {
- let thisList = list[i];
- // let objMesh = CommonVal.find().objScene.getMeshById(thisList);
- let objNode = type == 'mesh' ? CommonVal.find().objScene.getMeshById(thisList) : CommonVal.find().objScene.getNodeById(thisList);
- // console.log(
- // statue, objClickMesh.getClassName(), thisList, objMesh, objNode
- // );
- if (objNode != null && objNode != undefined) {
-
- if (meshInstallConfig[thisList] != null && meshInstallConfig[thisList] != undefined) {
- let objMeshInstallConfig = meshInstallConfig[thisList];
- let animationInstall = objMeshInstallConfig['animationInstall'];
- let animationEnd = objMeshInstallConfig['animationEnd'];
- let animationInstallList = objMeshInstallConfig['animationInstallList'];
- let animationEndList = objMeshInstallConfig['animationEndList'];
- let positionList = objMeshInstallConfig['positionList'];
- let distance = objMeshInstallConfig['distance'];
- let resetPosition = objMeshInstallConfig['resetPosition']
-
- for (let positionListI = 0; positionListI < positionList.length; positionListI++) {
- let thisPositionList = positionList[positionListI];
- // 得到两点之间的距离
- let thisVector3distanceTo = this.BABYLON.Vector3.Distance(
- new this.BABYLON.Vector3(parseFloat(objNode.absolutePosition.x), parseFloat(objNode.absolutePosition.y), parseFloat(objNode.absolutePosition.z)),
- new this.BABYLON.Vector3(parseFloat(thisPositionList.x), parseFloat(thisPositionList.y), parseFloat(thisPositionList.z))
- );
- // console.log(
- // "thisVector3distanceTo",
- // thisVector3distanceTo,
- // distance
- // );
- if (thisVector3distanceTo <= distance) {
-
- // console.log(
- // "距离范围【内】播放动画", animationEnd, animationEndList
- // );
- if (okJsonId[thisList] == null || okJsonId[thisList] == undefined) {
- okJsonId[thisList] = thisList;
- sumOk += 1;
- }
- // 单个动画
- if (animationEnd != null && animationEnd != undefined) {
- // @ts-ignore
- threeWorld().obj.newIframe.objIframe.ChengGuangYuanJing.CommonVal.find().animationGroupsEventCallback(
- animationEnd.name, 'start', animationEnd.speed, animationEnd.from, animationEnd.to, false, null, function(state : any, objAnimation : any) {
- if (state == "播放完成") {
-
- }
-
- }
- );
- }
- // 多个动画
- if (animationEndList != null && animationEndList != undefined) {
- for (let animationEndListI = 0; animationEndListI < animationEndList.length; animationEndListI++) {
-
- let thisAnimationEndList = animationEndList[animationEndListI];
- // @ts-ignore
- threeWorld().obj.newIframe.objIframe.ChengGuangYuanJing.CommonVal.find().animationGroupsEventCallback(
- thisAnimationEndList.name, 'start', thisAnimationEndList.speed, thisAnimationEndList.from, thisAnimationEndList.to, false, null, function(state : any, objAnimation : any) {
- if (state == "播放完成") {
-
- }
-
- }
- );
- }
- }
-
- } else {
- // console.log(
- // "距离范围【外】播放动画", animationInstall, animationInstallList
- // );
- // 单个动画
- if (animationInstall != null && animationInstall != undefined) {
- // @ts-ignore
- threeWorld().obj.newIframe.objIframe.ChengGuangYuanJing.CommonVal.find().animationGroupsEventCallback(
- animationInstall.name, 'start', animationInstall.speed, animationInstall.from, animationInstall.to, false, null, function(state : any, objAnimation : any) {
- if (state == "播放完成") {
-
- }
-
- }
- );
- }
- // 多个动画
- if (animationInstallList != null && animationInstallList != undefined) {
- for (let animationInstallListI = 0; animationInstallListI < animationInstallList.length; animationInstallListI++) {
-
- let thisAnimationInstallList = animationInstallList[animationInstallListI];
- // @ts-ignore
- threeWorld().obj.newIframe.objIframe.ChengGuangYuanJing.CommonVal.find().animationGroupsEventCallback(
- thisAnimationInstallList.name, 'start', thisAnimationInstallList.speed, thisAnimationInstallList.from, thisAnimationInstallList.to, false, null, function(state : any, objAnimation : any) {
- if (state == "播放完成") {
-
- }
-
- }
- );
- }
- }
- }
- // 回归原始坐标
- if (resetPosition != null && resetPosition != undefined) {
- for (let resetPositionKey in resetPosition) {
- let objMeshReset = CommonVal.find().objScene.getMeshById(resetPositionKey)
- let objNodeReset = CommonVal.find().objScene.getNodeById(resetPositionKey);
- let thisResetPosition = resetPosition[resetPositionKey];
- let thisResetPositionNew = { "x": 0, "y": 0, "z": 0 };
- if (thisVector3distanceTo <= distance) {
- thisResetPositionNew = thisResetPosition["End"];
- } else {
- thisResetPositionNew = thisResetPosition["Install"];
- }
- if (objMeshReset != null && objMeshReset != undefined) {
- objMeshReset.setAbsolutePosition(
- new this.BABYLON.Vector3(
- thisResetPositionNew.x,
- thisResetPositionNew.y,
- thisResetPositionNew.z
- )
- );
- }
- if (objNodeReset != null && objNodeReset != undefined) {
- objNodeReset.setAbsolutePosition(
- new this.BABYLON.Vector3(
- thisResetPositionNew.x,
- thisResetPositionNew.y,
- thisResetPositionNew.z
- )
- );
- }
-
- }
- }
-
- }
- }
- }
-
- // console.log(
- // statue, sumOk, list.length
- // );
- if (sumOk >= list.length) {
- courseChapter3dShow().show.showCongratulationsViewBool = true;
- courseChapter3dShow().show.showEndViewBool = true;
- // 上一步和下一步是否显示
- this.tipsBtnsUpOpenEvent(true);
- this.tipsBtnsDownOpenEvent(true);
- } else {
- courseChapter3dShow().show.showCongratulationsViewBool = false;
- courseChapter3dShow().show.showEndViewBool = false;
- // 上一步和下一步是否显示
- this.tipsBtnsUpOpenEvent(false);
- this.tipsBtnsDownOpenEvent(false);
- }
- }
- }
- /**
- * 用于每帧是否固定相机视角逻辑,该方法每帧被调用
- */
- public cameraVisualAngleUpdate = () => {
-
- // 固定相机视角逻辑
- if (
- this.cameraRadius != null && this.cameraRadius != undefined
- && this.cameraAlpha != null && this.cameraAlpha != undefined
- && this.cameraBeta != null && this.cameraBeta != undefined
- ) {
- // @ts-ignore
- let objSceneActiveCamera = threeWorld().obj.newIframe.objIframe.ChengGuangYuanJing.CommonVal.find().objSceneActiveCamera;
- if (objSceneActiveCamera != null && objSceneActiveCamera != undefined) {
- objSceneActiveCamera.radius = this.cameraRadius;
- objSceneActiveCamera.alpha = this.cameraAlpha;
- objSceneActiveCamera.beta = this.cameraBeta;
-
- }
-
- }
- }
- /**
- * 用于拖拽移动的逻辑
- * pickResult 鼠标的对象
- * statue 当前的步骤状态
- */
- public dragAndDropMove = (pickResult : any, statue : any) => {
- // console.log(
- // "用于拖拽移动的逻辑",
- // pickResult
- // );
- if (this.objClickMesh == null || this.objClickMesh == undefined) {
- return;
- }
- let objMesh = pickResult.pickedMesh;
- let thisMovePosition = pickResult.pickedPoint;
- console.log(
- "this.objClickMesh", this.objClickMesh
- );
- console.log(
- "鼠标移动触发逻辑",
- // "pickResult",
- // pickResult,
- thisMovePosition,
- this.objClickMesh.id
- );
- // 追加的xyz坐标
- let addPosition2 = { "x" : 0, "y" : 0, "z" : 0 };
- // 旋转
- let rotationQuaternionNew : any = null;
- // 对应的物体也要跟着旋转
- let rotationQuaternionList : any = null;
- // 特殊处理
- if (this.objClickMesh.id == "exhibition_html_1710385814466__10”前轮左") {
- // addPosition2 = { "x" : 0, "y" : -0.25, "z" : 0.3 };
- addPosition2 = { "x" : 0, "y" : 0.05, "z" : 0.3 };
- }
- else if (this.objClickMesh.id == "exhibition_html_1710385814466__10”后轮左") {
- // addPosition2 = { "x" : 0, "y" : -0.25, "z" : 0.3 };
- addPosition2 = { "x" : 0, "y" : 0.05, "z" : 0.3 };
- }
- else if (this.objClickMesh.id == "exhibition_html_1710385814466__10”后轮右") {
-
- // addPosition2 = { "x" : 0, "y" : 0.25, "z" : -0.3 };
- // addPosition2 = { "x" : 0, "y" : 0.55, "z" : -0.3 };
- // addPosition2 = { "x" : 0, "y" : 0.25, "z" : -0.3 };
- addPosition2 = { "x" : 0, "y" : 0.05, "z" : -0.3 };
- rotationQuaternionNew = {
- "x": 1,
- "y": -8.742277657347586e-8,
- "z": -1.910685426890209e-15,
- "w": -2.1855694143368964e-8
- }
- rotationQuaternionList = {
- "exhibition_html_1710385814466__10”后轮右轴" :
- {
- "x": 1,
- "y": -8.742277657347586e-8,
- "z": -1.9106854647700726e-15,
- "w": -2.1855694143368964e-8
- },
- };
-
- }
- else if (this.objClickMesh.id == "exhibition_html_1710385814466__10”前轮右") {
- // addPosition2 = { "x" : 0, "y" : 0.25, "z" : -0.3 };
- // addPosition2 = { "x" : 0, "y" : 0.55, "z" : -0.3 };
- // addPosition2 = { "x" : 0, "y" : 0.25, "z" : -0.3 };
- addPosition2 = { "x" : 0, "y" : 0.05, "z" : -0.3 };
- rotationQuaternionNew = {
- "x": 1,
- "y": -8.742277657347586e-8,
- "z": -1.910685426890209e-15,
- "w": -2.1855694143368964e-8
- }
- rotationQuaternionList = {
- "exhibition_html_1710385814466__10”前轮右轴" :
- {
- "x": 1,
- "y": -8.742277657347586e-8,
- "z": -1.9106854647700726e-15,
- "w": -2.1855694143368964e-8
- },
- };
-
- }
- else if (this.objClickMesh.id == "exhibition_html_1710385814466__6”前轮右") {
- addPosition2 = { "x" : 0, "y" : 0.15, "z" : 0 };
- }
- else if (this.objClickMesh.id == "exhibition_html_1710385814466__6”中轮右") {
- addPosition2 = { "x" : 0, "y" : 0.15, "z" : 0 };
- }
- else if (this.objClickMesh.id == "exhibition_html_1710385814466__6”后轮右") {
- addPosition2 = { "x" : 0, "y" : 0.15, "z" : 0 };
- }
- else if (this.objClickMesh.id == "exhibition_html_1710385814466__6”前轮左") {
- addPosition2 = { "x" : 0, "y" : 0.15, "z" : 0 };
- }
- else if (this.objClickMesh.id == "exhibition_html_1710385814466__6”中轮左") {
- addPosition2 = { "x" : 0, "y" : 0.15, "z" : 0 };
- }
- else if (this.objClickMesh.id == "exhibition_html_1710385814466__6”后轮左") {
- addPosition2 = { "x" : 0, "y" : 0.15, "z" : 0 };
- }
- else if (this.objClickMesh.id == "model_1709892139359安全桩001") {
- addPosition2 = { "x" : 0, "y" : 0.25, "z" : 0 };
- }
- else if (this.objClickMesh.id == "model_1709892139359安全桩004") {
- addPosition2 = { "x" : 0, "y" : 0.25, "z" : 0 };
- }
- else if (this.objClickMesh.id == "model_1709892139359安全桩003") {
- addPosition2 = { "x" : 0, "y" : 0.25, "z" : 0 };
- }
- else if (this.objClickMesh.id == "model_1709892139359安全桩002") {
- addPosition2 = { "x" : 0, "y" : 0.25, "z" : 0 };
- }
- else if (this.objClickMesh.id == "exhibition_html_1710385814466__防撞杆") {
- addPosition2 = { "x" : 0, "y" : 0.1, "z" : 0 };
- }
- else if (this.objClickMesh.id == "exhibition_html_1710385814466__防撞杆锁") {
- addPosition2 = { "x" : 0, "y" : 0.1, "z" : 0 };
- }
- else if (this.objClickMesh.id == "exhibition_html_1710385814466__相机") {
- addPosition2 = { "x" : 0, "y" : 0.25, "z" : 0 };
- }
- else if (this.objClickMesh.id == "exhibition_html_1710385814466__镜头架") {
- addPosition2 = { "x" : 0, "y" : 0.25, "z" : 0 };
- }
- else if (this.objClickMesh.id == "exhibition_html_1710385814466_绕线车-电源线") {
- addPosition2 = { "x" : 0, "y" : 0.2, "z" : 0 };
- }
- else if (this.objClickMesh.id == "exhibition_html_1710385814466__绕线车-纠偏轮") {
- addPosition2 = { "x" : 0, "y" : 0.25, "z" : 0 };
- }
- else if (this.objClickMesh.id == "exhibition_html_1710385814466__锂电池") {
- addPosition2 = { "x" : 0, "y" : 0.25, "z" : 0 };
- }
- else if (this.objClickMesh.id == "exhibition_html_1710385814466__电脑屏幕") {
- addPosition2 = { "x" : 0, "y" : 0.2, "z" : 0 };
- }
- else if (this.objClickMesh.id == "exhibition_html_1710385814466__电脑主机") {
- addPosition2 = { "x" : 0, "y" : 0.2, "z" : 0 };
- }
-
- else if (this.objClickMesh.id == "exhibition_html_1710385814466__手柄") {
- addPosition2 = { "x" : 0, "y" : 0.2, "z" : 0 };
- }
-
- if (this.objClickMesh != null && this.objClickMesh != undefined) {
-
- // 追加的xyz坐标
- let addPosition = {
- "x" : thisMovePosition.x - this.clickPosition.x,
- "y" : thisMovePosition.y - this.clickPosition.y,
- "z" : thisMovePosition.z - this.clickPosition.z,
- };
-
- // console.log(
- // "拖拽物体id",
- // this.objClickMesh.id,
- // // this.objClickMesh._rotationQuaternion,
- // );
-
- // 如果存在旋转,在根据这个来旋转
- if (rotationQuaternionNew != null && rotationQuaternionNew != undefined) {
- this.objClickMesh._rotationQuaternion.x = rotationQuaternionNew.x;
- this.objClickMesh._rotationQuaternion.y = rotationQuaternionNew.y;
- this.objClickMesh._rotationQuaternion.z = rotationQuaternionNew.z;
- this.objClickMesh._rotationQuaternion.w = rotationQuaternionNew.w;
-
- }
- if (rotationQuaternionList != null && rotationQuaternionList != undefined) {
-
- if (this.objClickMesh["parent"] != null && this.objClickMesh["parent"] != undefined) {
- var meshParent = this.objClickMesh["parent"];
- var meshParentId = meshParent.id;
- if (rotationQuaternionList[meshParentId] != null && rotationQuaternionList[meshParentId] != undefined) {
- var thisRotationQuaternionList = rotationQuaternionList[meshParentId];
- meshParent._rotationQuaternion.x = thisRotationQuaternionList.x;
- meshParent._rotationQuaternion.y = thisRotationQuaternionList.y;
- meshParent._rotationQuaternion.z = thisRotationQuaternionList.z;
- meshParent._rotationQuaternion.w = thisRotationQuaternionList.w;
- }
- }
- }
-
- // 一定要用绝对坐标更新,这样才可以解决不同模型轴向,问题导致设置 position 会各种出错
- this.objClickMesh.setAbsolutePosition(
- new this.BABYLON.Vector3(
- this.clickMeshPosition.x + addPosition.x + addPosition2.x,
- this.clickMeshPosition.y + addPosition.y + addPosition2.y,
- this.clickMeshPosition.z + addPosition.z + addPosition2.z
- )
- );
-
- }
- // 另外一个物体一起跟着拖拽
- if (this.objClickMesh2 != null && this.objClickMesh2 != undefined) {
-
- // // 追加的xyz坐标
- // let addPosition = {
- // "x" : thisMovePosition.x - this.clickPosition.x,
- // "y" : thisMovePosition.y - this.clickPosition.y,
- // "z" : thisMovePosition.z - this.clickPosition.z,
- // };
- // 追加的xyz坐标 【 跟着一起追加偏移 】
- let addPosition = {
- "x" : thisMovePosition.x - this.clickPosition.x + addPosition2.x,
- "y" : thisMovePosition.y - this.clickPosition.y + addPosition2.y,
- "z" : thisMovePosition.z - this.clickPosition.z + addPosition2.z,
- };
- // 一定要用绝对坐标更新,这样才可以解决不同模型轴向,问题导致设置 position 会各种出错
- this.objClickMesh2.setAbsolutePosition(
- new this.BABYLON.Vector3(
- parseFloat(this.objClickMesh2["oldAbsolutePosition"].x) + addPosition.x,
- parseFloat(this.objClickMesh2["oldAbsolutePosition"].y) + addPosition.y,
- parseFloat(this.objClickMesh2["oldAbsolutePosition"].z) + addPosition.z
- )
- );
- }
-
- }
- /**
- * 上一步是否显示
- * open true - 显示, false - 隐藏
- */
- public tipsBtnsUpOpenEvent = (open : Boolean) => {
- if (this.tipsBtnsUpOpenEventCallback != null && this.tipsBtnsUpOpenEventCallback != undefined) {
- this.tipsBtnsUpOpenEventCallback(open);
- }
- }
- /**
- * 下一步是否显示
- * open true - 显示, false - 隐藏
- */
- public tipsBtnsDownOpenEvent = (open : Boolean) => {
- if (this.tipsBtnsDownOpenEventCallback != null && this.tipsBtnsDownOpenEventCallback != undefined) {
- this.tipsBtnsDownOpenEventCallback(open);
- }
- }
-
- /**
- * 切换指定按钮的交互逻辑
- * obj 鼠标移动传来的对象
- * statue 当前的步骤状态
- * */
- public threeWorldPointerMove = (obj : any, statue : any) => {
- // 如果不可以触发
- if (this.meshBtnInteractiveBool == false) {
- return;
- }
- // 此时不可触发
- if (this.txtBool == false) {
- return;
- }
- let objMesh = obj.pickedMesh;
- if (objMesh == null || objMesh == undefined) {
- return;
- }
- // console.log(
- // " 鼠标移动传来的对象 threeWorldPointerMove = (obj : any) => { ", objMesh.id
- // );
- this.meshBtnInteractive(objMesh.id);
-
- }
- /**
- * 指定的目标物体id触发交互逻辑
- * objMeshId 被放大的按钮id
- */
- public meshBtnInteractive = (objMeshId : any) => {
-
- let thisObj = this;
- // 当前的时间戳
- let thisTime = new Date().getTime();
- let list = [
- {
- "meshId" : "exhibition_html_1710385814466_检测车文字框05",
- "list" : [ "exhibition_html_1710385814466_检测车文字03" ],
- },
- {
- "meshId" : "exhibition_html_1710385814466_检测车文字03",
- "list" : [ "exhibition_html_1710385814466_检测车文字框05" ],
- },
- {
- "meshId" : "exhibition_html_1710385814466_检测车文字框06",
- "list" : [ "exhibition_html_1710385814466_检测车文字04" ],
- },
- {
- "meshId" : "exhibition_html_1710385814466_检测车文字04",
- "list" : [ "exhibition_html_1710385814466_检测车文字框06" ],
- },
- {
- "meshId" : "exhibition_html_1710385814466_检测车文字框07",
- "list" : [ "exhibition_html_1710385814466_检测车文字07" ],
- },
- {
- "meshId" : "exhibition_html_1710385814466_检测车文字07",
- "list" : [ "exhibition_html_1710385814466_检测车文字框07" ],
- },
- {
- "meshId" : "exhibition_html_1710385814466_检测车文字框08",
- "list" : [ "exhibition_html_1710385814466_检测车文字08" ],
- },
- {
- "meshId" : "exhibition_html_1710385814466_检测车文字08",
- "list" : [ "exhibition_html_1710385814466_检测车文字框08" ],
- },
- {
- "meshId" : "exhibition_html_1710385814466_检测车文字框04",
- "list" : [ "exhibition_html_1710385814466_检测车文字05" ],
- },
- {
- "meshId" : "exhibition_html_1710385814466_检测车文字05",
- "list" : [ "exhibition_html_1710385814466_检测车文字框04" ],
- },
- {
- "meshId" : "exhibition_html_1710385814466_检测车文字框03",
- "list" : [ "exhibition_html_1710385814466_检测车文字06" ],
- },
- {
- "meshId" : "exhibition_html_1710385814466_检测车文字06",
- "list" : [ "exhibition_html_1710385814466_检测车文字框03" ],
- },
- {
- "meshId" : "exhibition_html_1710385814466_检测车文字框02",
- "list" : [ "exhibition_html_1710385814466_检测车文字01" ],
- },
- {
- "meshId" : "exhibition_html_1710385814466_检测车文字01",
- "list" : [ "exhibition_html_1710385814466_检测车文字框02" ],
- },
- {
- "meshId" : "exhibition_html_1710385814466_检测车文字框01",
- "list" : [ "exhibition_html_1710385814466_检测车文字02" ],
- },
- {
- "meshId" : "exhibition_html_1710385814466_检测车文字02",
- "list" : [ "exhibition_html_1710385814466_检测车文字框01" ],
- },
- {
- "meshId" : "exhibition_html_1710385814466_绕线车文字01",
- "list" : [ "exhibition_html_1710385814466_绕线车文字框002" ],
- },
- {
- "meshId" : "exhibition_html_1710385814466_绕线车文字框002",
- "list" : [ "exhibition_html_1710385814466_绕线车文字01" ],
- },
- {
- "meshId" : "exhibition_html_1710385814466_绕线车文字02",
- "list" : [ "exhibition_html_1710385814466_绕线车文字框001" ],
- },
- {
- "meshId" : "exhibition_html_1710385814466_绕线车文字框001",
- "list" : [ "exhibition_html_1710385814466_绕线车文字02" ],
- },
- {
- "meshId" : "exhibition_html_1710385814466_绕线车文字03",
- "list" : [ "exhibition_html_1710385814466_绕线车文字框004" ],
- },
- {
- "meshId" : "exhibition_html_1710385814466_绕线车文字框004",
- "list" : [ "exhibition_html_1710385814466_绕线车文字03" ],
- },
- {
- "meshId" : "exhibition_html_1710385814466_绕线车文字04",
- "list" : [ "exhibition_html_1710385814466_绕线车文字框003" ],
- },
- {
- "meshId" : "exhibition_html_1710385814466_绕线车文字框003",
- "list" : [ "exhibition_html_1710385814466_绕线车文字04" ],
- },
- {
- "meshId" : "exhibition_html_1710385814466_绕线车文字005",
- "list" : [ "exhibition_html_1710385814466_绕线车文字框005" ],
- },
- {
- "meshId" : "exhibition_html_1710385814466_绕线车文字框005",
- "list" : [ "exhibition_html_1710385814466_绕线车文字005" ],
- },
-
- ];
- for (let i = 0; i < list.length; i++) {
- let thisList = list[i];
- let meshId = thisList['meshId'];
- let listFor = thisList['list'];
- listFor.push(meshId);
- // 决定缩放的值
- let scaling = 1;
- // 决定缩放的最大值
- let scalingMax = 2;
- // 切换的颜色值
- let color : any = {
- r : 0,
- g : 102,
- b : 255
- };
- if (objMeshId != null && objMeshId != undefined && objMeshId == meshId) {
- scaling = scalingMax;
- color = {
- r : 255,
- g : 255,
- b : 0
- };
- thisObj.meshBtnInteractiveBool = false;
- setTimeout(function() {
- thisObj.meshBtnInteractiveBool = true;
- }, 200);
- } else {
- }
- // console.log(
- // "触发3d按钮交互逻辑", objMeshId, scaling, listFor
- // );
- for (let listForI = 0; listForI < listFor.length; listForI++) {
- let thisListFor = listFor[listForI];
- // @ts-ignore
- let objMesh = threeWorld().obj.newIframe.objIframe.ChengGuangYuanJing.CommonVal.find().objScene.getMeshById(thisListFor);
- if (objMesh != null && objMesh != undefined && objMesh.material != null && objMesh.material != undefined) {
- // if (objMesh.material != null && objMesh.material != undefined) {
-
- // let newColor = new BABYLON.Color3(
- // parseFloat(color.r) / 255,
- // parseFloat(color.g) / 255,
- // parseFloat(color.b) / 255
- // );
- // objMesh.material.albedoColor = newColor;
- // objMesh.material.emissiveColor = newColor;
- // console.log(
- // "objMesh.material",
- // objMesh.id,
- // objMesh.material.albedoColor
- // );
-
- // }
- // 可以被选中
- objMesh.isPickable = true;
-
- // 记录最后一次缩放的值和时间戳
- if (objMesh["carNewScaling"] == null || objMesh["carNewScaling"] == undefined) {
- objMesh["carNewScaling"] = objMesh.scaling.x;
- }
-
- if (objMesh["carNewScalingTime"] == null || objMesh["carNewScalingTime"] == undefined) {
- objMesh["carNewScalingTime"] = 0;
- }
- if (objMesh["carNewScaling"] != scaling) {
- if (
- // 如果不等于最大值
- scaling != scalingMax
- // 并且大于多少毫秒后
- // && thisTime - objMesh["carNewScalingTime"] >= 1000
- && thisTime - objMesh["carNewScalingTime"] >= 300
- ) {
- objMesh.scaling.x = scaling;
- objMesh.scaling.y = scaling;
- objMesh.scaling.z = scaling;
- objMesh["carNewScaling"] = scaling;
- if (this.highlightLayerMeshListClick.length <= 0) {
- // 去除高光
- this.objHighlightLayerEvent.removeAll();
-
- }
-
- } else if (
- // 最大值
- scaling == scalingMax
- ) {
- // 放大逻辑
- objMesh.scaling.x = scaling;
- objMesh.scaling.y = scaling;
- objMesh.scaling.z = scaling;
- objMesh["carNewScaling"] = scaling;
- objMesh["carNewScalingTime"] = thisTime;
-
- if (thisListFor.indexOf("文字框") < 0) {
- let newList = [ thisListFor ];
- for (
- let highlightLayerMeshListClickI = 0;
- highlightLayerMeshListClickI < this.highlightLayerMeshListClick.length;
- highlightLayerMeshListClickI++
- ) {
- newList.push(this.highlightLayerMeshListClick[highlightLayerMeshListClickI]);
- }
-
- // 高光
- this.objHighlightLayerEvent.meshListAdd(
- // listFor,
- newList,
- null
- );
-
- }
-
- }
- }
-
- }
- }
-
- }
- }
-
- /**
- * 鼠标点击3d后,鼠标弹起触发逻辑
- * obj 鼠标弹起后传来的对象
- * statue 当前的步骤状态
- */
- public threeWorldPointerupEvent = (obj : any, statue : any) => {
- let objMesh = obj.pickedMesh;
- if (objMesh == null || objMesh == undefined) {
- return;
- }
- console.log(
- " 鼠标点击弹起了 threeWorldPointerupEvent = (obj : Object) => { ", objMesh.id
- );
-
- switch (objMesh.id) {
- // 爬行器 - 后置相机
- case 'exhibition_html_1710385814466_检测车文字框05':
- case 'exhibition_html_1710385814466_检测车文字03':
- this.meshEventTxt(1, objMesh.id);
- courseChapter3dShow().show.showStudyRightTitle = "后置相机";
- courseChapter3dShow().show.showStudyRightTxtList = [
- "高清云台摄像机,满足360°轴向旋转,同时具备一定角度的径向旋转,可以满足拍摄管道中各个角度的管道图像,尤其是在拍摄管道接口位置时,可以采集完整的接口位置图像,以提高检测数据的完整性,方便数据分析人员对管道状况进行准确评估。",
- ];
- break;
- // 爬行器 - 检测车身
- case 'exhibition_html_1710385814466_检测车文字框06':
- case 'exhibition_html_1710385814466_检测车文字04':
- this.meshEventTxt(1, objMesh.id);
- courseChapter3dShow().show.showStudyRightTitle = "检测车身";
- courseChapter3dShow().show.showStudyRightTxtList = [
- "机器人底盘,一般包含电机、控制电路系统、信号处理系统等,是机器人的核心部分,目前的检测机器人一般配备了多个电机组,支持差速控制,既能满足机器人前进后退的行走需求,也可以满足机器人原地转弯等特殊操作需求。",
- ];
- break;
- // 爬行器 - 轮子
- case 'exhibition_html_1710385814466_检测车文字框07':
- case 'exhibition_html_1710385814466_检测车文字07':
- this.meshEventTxt(1, objMesh.id);
- courseChapter3dShow().show.showStudyRightTitle = "轮子";
- courseChapter3dShow().show.showStudyRightTxtList = [
- "轮组,由于不同的管道其管径大小不同,所以需要检测时根据不同的管径大小采用不同的轮组,以满足检测的需求。目前的检测机器人一般配备了多种尺寸的轮组,并采用快拆设计,保证更换方便。",
- ];
- break;
- // 爬行器 - 前置相机
- case 'exhibition_html_1710385814466_检测车文字框08':
- case 'exhibition_html_1710385814466_检测车文字08':
- this.meshEventTxt(1, objMesh.id);
- courseChapter3dShow().show.showStudyRightTitle = "前置相机";
- courseChapter3dShow().show.showStudyRightTxtList = [
- "高清云台摄像机,满足360°轴向旋转,同时具备一定角度的径向旋转,可以满足拍摄管道中各个角度的管道图像,尤其是在拍摄管道接口位置时,可以采集完整的接口位置图像,以提高检测数据的完整性,方便数据分析人员对管道状况进行准确评估。",
- ];
- break;
- // 爬行器 - 防撞杆
- case 'exhibition_html_1710385814466_检测车文字框04':
- case 'exhibition_html_1710385814466_检测车文字05':
- this.meshEventTxt(1, objMesh.id);
- courseChapter3dShow().show.showStudyRightTitle = "防撞杆";
- courseChapter3dShow().show.showStudyRightTxtList = [
- "防撞杆可以涉及到多个方面,包括其尺寸公差、抗拉强度、化学成分、表面质量、屈服强度、延伸率、静态弯曲、低温冲击、金相组织分析和机械性能等。这些检测项目可以确保防撞杆的质量和性能符合设计要求和安全标准。",
- "要进行这些检测,可能需要使用各种设备和工具,如测量工具、力学测试设备、化学分析仪器、显微镜等。同时,检测过程需要由专业的技术人员进行,以确保结果的准确性和可靠性。",
- "此外,对于机器人防撞杆的检测,可能还需要考虑其在实际使用中的性能和可靠性。例如,可以通过模拟碰撞测试来评估防撞杆在实际碰撞中的表现,以确保其能够有效地保护机器人和周围环境的安全。",
- "总之,检测机器人防撞杆需要综合考虑多个方面,包括其设计、制造、使用等多个环节,以确保其质量和性能符合相关标准和要求。",
- ];
- break;
- // 爬行器 - LED前灯
- case 'exhibition_html_1710385814466_检测车文字框03':
- case 'exhibition_html_1710385814466_检测车文字06':
- this.meshEventTxt(1, objMesh.id);
- courseChapter3dShow().show.showStudyRightTitle = "LED前灯";
- courseChapter3dShow().show.showStudyRightTxtList = [
- "LED灯光模块,一般包含前置远光灯组、近光灯组以及后视灯组,可以保证云台拍摄时画面的清晰度,同时也可帮助地面控制人员控制机器人行走。",
- ];
- break;
- // 爬行器 - 升降支架
- case 'exhibition_html_1710385814466_检测车文字框02':
- case 'exhibition_html_1710385814466_检测车文字01':
- this.meshEventTxt(1, objMesh.id);
- courseChapter3dShow().show.showStudyRightTitle = "升降支架";
- courseChapter3dShow().show.showStudyRightTxtList = [
- "升降架,根据相关检测标准,检测机器人在管道中进行检测时,云台位置应处于管道的中心位置,以保证检测视频获取完整的非失真的管道图像,为了满足这一要求,-般检测机器人会配备升降机构,从而可以将云台根据不同管径的大小调整到管道的中心位置。",
- ];
- break;
- // 爬行器 - 连接线缆
- case 'exhibition_html_1710385814466_检测车文字框01':
- case 'exhibition_html_1710385814466_检测车文字02':
- this.meshEventTxt(1, objMesh.id);
- courseChapter3dShow().show.showStudyRightTitle = "连接线缆";
- courseChapter3dShow().show.showStudyRightTxtList = [
- "连接线缆同样是一个重要的环节,它涉及到机器人的正常运行和安全性。以下是检测机器人连接线缆时需要考虑的几个方面:",
- "1.外观检查:检查线缆外皮是否有裂纹、老化、变形或损坏等情况。同时,检查线缆的端头是否松动或损坏,以及连接头是否牢固连接。",
- "2.导通性测试:使用万用表等测试工具,检查线缆的导通性是否正常,以确保信号和电流能够顺畅传输。",
- "3.绝缘性能测试:通过绝缘电阻测试仪等设备,测量线缆的绝缘电阻值,以评估线缆的绝缘性能是否符合要求。",
- "4.耐压测试:使用耐压测试仪,对线缆进行耐压测试,以检查线缆在正常工作电压下是否会出现漏电或击穿等情况。",
- "5.温度测试:在机器人运行过程中,检查线缆的温度变化,以确保线缆在工作过程中不会出现过热或烧毁等情况。",
- "需要注意的是,在检测机器人连接线缆时,应先关闭机器人并断开电源,以避免电击等安全风险。同时,检测过程应由专业人员进行,以确保结果的准确性和可靠性。",
- "总之,检测机器人连接线缆是确保机器人正常运行和安全性的重要环节,需要综合考虑外观、导通性、绝缘性能、耐压性和温度等多个方面。",
- ];
- break;
- // 线缆卷盘 - 控制终端
- case 'exhibition_html_1710385814466_绕线车文字01':
- case 'exhibition_html_1710385814466_绕线车文字框002':
- this.meshEventTxt(0, objMesh.id);
- courseChapter3dShow().show.showStudyRightTitle = "控制终端";
- courseChapter3dShow().show.showStudyRightTxtList = [
- "控制终端分为工业控制器和平板电脑两种,各有优缺点,工业控制器屏幕尺寸更大,亮度更高,高温下工作更稳定,可以搭配无线操作盒使用。平板电脑更便携,一般采用无线连接,满足不同使用场景下控制方式的需求",
- ];
- break;
- // 线缆卷盘 - 电源连线
- case 'exhibition_html_1710385814466_绕线车文字02':
- case 'exhibition_html_1710385814466_绕线车文字框001':
- this.meshEventTxt(0, objMesh.id);
- courseChapter3dShow().show.showStudyRightTitle = "电源连线";
- courseChapter3dShow().show.showStudyRightTxtList = [
- "电源连线是确保机器人安全、稳定运行的重要环节。以下是检测机器人电源连线时需要考虑的几个方面:",
- "1.外观检查:检查电源连线外皮是否有破损、老化、裂纹或变形等情况。同时,检查电源插头的完好性和接触是否良好。",
- "2.导通性测试:使用万用表等测试工具,检查电源连线的导通性是否正常。确保电源能够顺畅地传输到机器人中。",
- "3.电压测试:使用电压表等测试工具,测量电源连线的电压值是否符合要求。过高的电压可能导致设备损坏,而过低的电压则可能影响机器人的正常运行。",
- "4.电流测试:通过电流表等测试工具,测量电源连线的电流值是否在正常范围内。过大的电流可能导致线缆过热、烧毁甚至引发火灾。",
- "5.绝缘性能测试:使用绝缘电阻测试仪等设备,测量电源连线的绝缘电阻值,以评估线缆的绝缘性能是否满足要求。",
- "6.温度测试:在机器人运行过程中,检查电源连线的温度变化。过高的温度可能表明线缆存在过载或散热不良等问题。",
- ];
- break;
- // 线缆卷盘 - 锂电池
- case 'exhibition_html_1710385814466_绕线车文字03':
- case 'exhibition_html_1710385814466_绕线车文字框004':
- this.meshEventTxt(0, objMesh.id);
- courseChapter3dShow().show.showStudyRightTitle = "锂电池";
- courseChapter3dShow().show.showStudyRightTxtList = [
- "内置大容量电池,续航时间8h以上",
- ];
- break;
- // 线缆卷盘 - 连接线缆
- case 'exhibition_html_1710385814466_绕线车文字04':
- case 'exhibition_html_1710385814466_绕线车文字框003':
- this.meshEventTxt(0, objMesh.id);
- courseChapter3dShow().show.showStudyRightTitle = "连接线缆";
- courseChapter3dShow().show.showStudyRightTxtList = [
- "一般线缆卷盘采用几种收线方式,手动收线、电动收线、全自动收线。手动收线即通过摇杆等方式将线缆收回;电动收线则通过按动线缆卷盘上收线开关由线缆卷盘内部的电机进行收线或通过控制终端控制收线;全自动收线是收线控制系统根据机器人回退的速度自动调整收线电机的收线速度,从而将线缆自动收回。",
- ];
- break;
- // 线缆卷盘 - 控制手柄
- case 'exhibition_html_1710385814466_绕线车文字005':
- case 'exhibition_html_1710385814466_绕线车文字框005':
- this.meshEventTxt(0, objMesh.id);
- courseChapter3dShow().show.showStudyRightTitle = "控制手柄";
- courseChapter3dShow().show.showStudyRightTxtList = [
- "检测机器人控制手柄是一个关键步骤,它有助于确保机器人系统的正常运行。控制手柄作为操作机器人的重要设备,如果出现故障,将对机器人的操作产生严重影响。",
- ];
- break;
-
- }
-
- }
- /**
- * 根据传来的物体id,和对应配置逻辑触发效果
- * car 0 - 线缆卷盘, 1 - 爬行器模块
- * meshId 传物体的id
- */
- public meshEventTxt = (car : any, meshId : any) : any => {
- if (meshId == null || meshId == undefined) {
- return this;
- }
- // @ts-ignore
- if (threeWorld().obj.meshEventTxt[meshId] == null || threeWorld().obj.meshEventTxt[meshId] == undefined) {
- return this;
- }
- // @ts-ignore
- let json : any = threeWorld().obj.meshEventTxt[meshId];
- if (json["fieldSynchronous"] != null && json["fieldSynchronous"] != undefined) {
- let fieldSynchronous : any = json["fieldSynchronous"];
- return this.meshEventTxt(car, fieldSynchronous);
- }
- // 高亮的物体列表
- let heighLight : any = json["heighLight"];
- // 切换视角
- let cameraVisualAngleGetListNameGpsTo : any = json["cameraVisualAngleGetListNameGpsTo"];
- if (cameraVisualAngleGetListNameGpsTo != null && cameraVisualAngleGetListNameGpsTo != undefined) {
- // @ts-ignore
- threeWorld().obj.newIframe.cameraVisualAngleGetListNameGpsTo(cameraVisualAngleGetListNameGpsTo, false);
- }
- // console.log(
- // " ========= meshEventTxt = (meshId : any) => { ========= ",
- // json,
- // heighLight
- // );
- let meshJson : any = {};
- for (let i = 0; i < heighLight.length; i++) {
- let thisHeighLight = heighLight[i];
- meshJson[thisHeighLight] = thisHeighLight;
- }
- this.retVisibility(car, "update", meshJson);
- return this;
- }
-
- /**
- *
- * 线缆卷盘 和 爬行器模块
- * 恢复 或者 设置可见度,以及显示线框逻辑
- *
- * car 0 - 线缆卷盘, 1 - 爬行器模块
- * type restore - 恢复 , update - 设置可见度和线框
- * meshJson 指定的物体列表,是进行高亮,并且正常可见
- * { "meshId1" : "meshId1", "meshId2" : "meshId2" }
- *
- */
- public retVisibility = (car : any, type : any, meshJson : any) => {
- // console.log(
- // "retVisibility = (car : any, type : any, meshJson : any) => {",
- // car, type, meshJson
- // );
- // 线缆卷盘
- let carMeshId = "exhibition_html_1710385814466_绕线车-侧板01_primitive1";
- if (car == 1) {
- // 爬行器模块
- carMeshId = "exhibition_html_1710385814466_上机_primitive3";
- }
- let objMesh = this.ChengGuangYuanJing.CommonVal.find().objScene.getMeshById(carMeshId);
- // 找到整体模型的对象
- let objMeshAll : any = null;
- if (objMesh != null && objMesh != undefined) {
- if (objMesh["_parentContainer"] != null && objMesh["_parentContainer"] != undefined) {
- objMeshAll = objMesh["_parentContainer"].meshes;
- }
-
- }
-
- for (let i = 0; i < objMeshAll.length; i++) {
- let thisObjMeshAll = objMeshAll[i];
- let thisMeshId = thisObjMeshAll.id;
- // 跳过逻辑
- if (
- thisMeshId.indexOf("检测车文字") >= 0
- || thisMeshId.indexOf("绕线车文字") >= 0
- || thisMeshId.indexOf("标注线") >= 0
- || thisObjMeshAll.visibility <= 0
- ) {
- continue;
- }
- // console.log(
- // "thisObjMeshAll",
- // thisMeshId,
- // thisObjMeshAll.visibility
- // );
- // 是否恢复可见度,和隐藏线框
- let visibilityRetBool = false;
- // 恢复可见度
- if (meshJson[thisMeshId] != null && meshJson[thisMeshId] != undefined) {
- visibilityRetBool = true;
- }
- // 如果是恢复的话
- if (type == "restore") {
- visibilityRetBool = true;
- }
-
- if (
- // 设置可见度和线框
- type == "update"
- // 不需要恢复可见度,和隐藏线框
- && visibilityRetBool == false
- ) {
-
- // 不存在配置的,才进行
- if (thisObjMeshAll["myDragAndDropEventRetVisibility"] == null || thisObjMeshAll["myDragAndDropEventRetVisibility"] == undefined) {
- // 记录更新前的可见度
- thisObjMeshAll["myDragAndDropEventRetVisibility"] = parseFloat("" + thisObjMeshAll.visibility);
- // 更新可见度
- thisObjMeshAll.visibility = 0.5;
- // // 关闭禁用网格边框渲染
- // thisObjMeshAll.disableEdgesRendering();
- // // 启动网格边框渲染
- // thisObjMeshAll.enableEdgesRendering(
- // 1,
- // true,
- // {
- // // /**
- // // * 获取或设置一个布尔值,该布尔值指示在查找边之前应应用细分。如果几何体有点小,则可能需要激活此选项
- // // * 不寻常的,比如一个三角形的顶点在另一个三角形边的两个顶点之间。在使用CSG构造网格时,这种情况经常发生。
- // // */
- // // "applyTessellation" : true,
- // // /**
- // // * 删除退化三角
- // // * 获取或设置一个布尔值,该值指示不应处理退化三角形。
- // // * 退化三角形是指具有2个或3个顶点的三角形,其坐标相同
- // // */
- // // "removeDegeneratedTriangles" : true,
- // // /**
- // // * 获取或设置一个布尔值,该布尔值指示必须使用备用寻边器算法
- // // * 如果未定义,则默认值为true
- // // */
- // // "useAlternateEdgeFinder" : true,
- // // /**
- // // * 获取或设置一个布尔值,该布尔值指示必须使用顶点合并快速处理。
- // // * 如果未定义,则默认值为true。
- // // * 通常情况下,应将其保留为未定义(或设置为true),除非在边渲染中看到一些瑕疵(可能发生在复杂的几何体中)
- // // * useAlternateEdgeFinder = true
- // // */
- // // "useFastVertexMerger" : true,
- // }
- // );
- // // 网格边框渲染宽度
- // thisObjMeshAll.edgesWidth = 0.01;
- // // 网格边框渲染颜色
- // thisObjMeshAll.edgesColor = new this.BABYLON.Color4(1, 1, 0, 0.3);
- // 在排除列表中添加网格,以防止其影响高亮显示层或受到高亮显示层的影响。
- this.objHighlightLayerEvent.objHighlightLayer.addExcludedMesh(thisObjMeshAll);
- }
- }
- // 恢复可见度,和隐藏线框
- if (visibilityRetBool == true) {
-
- if (thisObjMeshAll["myDragAndDropEventRetVisibility"] != null && thisObjMeshAll["myDragAndDropEventRetVisibility"] != undefined) {
- // 恢复可见度
- thisObjMeshAll.visibility = thisObjMeshAll["myDragAndDropEventRetVisibility"];
- // 关闭禁用网格边框渲染
- thisObjMeshAll.disableEdgesRendering();
- // 删除配置项
- thisObjMeshAll["myDragAndDropEventRetVisibility"] = null;
- delete thisObjMeshAll["myDragAndDropEventRetVisibility"];
- // 从排除列表中删除网格,使其影响高亮显示层或受到高亮显示层的影响。
- this.objHighlightLayerEvent.objHighlightLayer.removeExcludedMesh(thisObjMeshAll);
- }
-
- }
-
- }
- // 高亮的物体列表
- let highlightLayerMeshList : any = [];
- for (let key in meshJson) {
- highlightLayerMeshList.push(key);
- }
- this.highlightLayerMeshListClick = highlightLayerMeshList;
- if (highlightLayerMeshList.length <= 0) {
- return this;
- }
- // 触发高亮的效果
- this.objHighlightLayerEvent.meshListAdd(
- highlightLayerMeshList,
- null
- );
-
-
- return this;
- }
-
- }
|