From 4f3a730d6d883dbd95ab83b23ef8173e16d184a0 Mon Sep 17 00:00:00 2001 From: Cristian Luis Duarte Date: Wed, 29 Aug 2018 18:53:14 -0300 Subject: [PATCH 001/436] Android - Handshake implementation - two important notes - IK was disabled on android and this enables it (needs a well thought review) - TouchscreenVirtualPadDevice buttons code does not scale well, it needs a refactor --- .../controllers/touchscreenvirtualpad.json | 4 +- interface/resources/images/handshake.png | Bin 0 -> 20623 bytes .../animation/src/AnimInverseKinematics.cpp | 2 + .../Basic2DWindowOpenGLDisplayPlugin.cpp | 31 +++++++++ .../Basic2DWindowOpenGLDisplayPlugin.h | 3 + .../TouchscreenVirtualPadDevice.cpp | 65 +++++++++++++++++- .../TouchscreenVirtualPadDevice.h | 17 ++++- libraries/ui/src/VirtualPadManager.cpp | 8 +++ libraries/ui/src/VirtualPadManager.h | 3 + scripts/+android/defaultScripts.js | 3 +- 10 files changed, 130 insertions(+), 6 deletions(-) create mode 100644 interface/resources/images/handshake.png diff --git a/interface/resources/controllers/touchscreenvirtualpad.json b/interface/resources/controllers/touchscreenvirtualpad.json index bae1172152..e98fb7ff2f 100644 --- a/interface/resources/controllers/touchscreenvirtualpad.json +++ b/interface/resources/controllers/touchscreenvirtualpad.json @@ -23,7 +23,9 @@ "invert" ], "to": "Actions.Pitch" - } + }, + + { "from": "TouchscreenVirtualPad.RB", "to": "Standard.RB"} ] } diff --git a/interface/resources/images/handshake.png b/interface/resources/images/handshake.png new file mode 100644 index 0000000000000000000000000000000000000000..ae4252e9e5a0293098737349604ae0a60825ab14 GIT binary patch literal 20623 zcmdRVWmHt*_wJz)1Vp4$RJsM}7Eq9GkWfHMx^qTRQBs8=q(!yvz2CFWInM_p105PFHYxxBXdXX$XaWGlz}1J6 z8~}jR&?z(k0IY#pR)MBIF9JiJ`MUt>&OXmwcpiH_b9FIsdFCAEH{hZK07jCJAF7*$ z&h6z;vqIHqH5kBIhg6_lFfUdTQlLj|(oLGnSe`Fu?(opptOizSQr7rf)d!;tIzVCP zFqewc9zne*Y%~^ggx~O&FQ4|{)B>YUeAeYZUxZ*g@Zu$S5J)y!HOzY;z&(WY0l_|! z>zXUH+P>z_ykVYKF|1=7*OWSwatYadnlhp~yuAgjwaJw^xa75FqI>W`&VJl zyhh}&zPvx(>p>s7VR-vvxfDzgFK?=6L54Qy1XR1qQTF0lnvz6n0C4^0e7{(Fp`z7`K8JgH+DFnF zbS!~SUL|jxS!NAy#`iO+0YDFrG^WK|7$s7ayM#Evleg91%sp;Z3u}b@>gh|3)~yM- zYkQSXtqp-$m!x%sm`{D-9ldw9of`89;nAgUr^e3IJOGd{A)Ph6mdYV+d%w}QKyg8{ z-iX(6*uM?S<>j!y{rNvOlpK~qkfhHH0qLrvn7(%uRAK?h568zMMF_1bw+~nQ#Fk#t zr=JQYn--v)J*#_4L1Vm*kIsp&5vwxEJw#S%&h+qT^6-EUX04jTeOvE4A4u7YQjr{R zd{t?_`vG>(3l4kvpqsO4rh}VW6OI4mZ>BSJDc*OPEZmiJ0%_UpUxK+wb68wN)$j5$ zu@jR5J&n(lXZig9+RGsQ>f5t_i0N_{H7-%fSswS)t^6IZ6oNpaf2oIR@Z_cu3qW4< z*S!?tk2Wa}p(ED7C}}9&efZ1sGy<7WjKbnS{7yFY7(@(1kce#?oLTUfCCnXb5=sF4 z{nyDB%%X@8sTeW)+y13C(tN#jjm+)Kwb-Ryq40q9N6}SqRndkpaUF+>X$wlQmD&~o z=Px{K`@?S;%g^NC6U!7_GaL}Km@ClnD45oogc2crJS5Az-1wv!UIW`L%!3S7 z{S0`^0^(odw|=&{)H`f3nghDObdE#^J#9mGuM(1z#j7Jz`f?%{1H5jIjHd-*kAfq! z2S!&>b0<>XlE3@%7F46VmGuJ@1_*&m&Ot8xC_PM-{ka!Nbzg3>d2KDO=9zzXf80d`V z1sd_OrCoev>95|l+wTq-eB7^w<)z?KD~U*ZSU8@2F@0jOVBl1;aBz1b+o@$lHaKH| zpr@D=%>QMfgn6!ee&6TY{^T~a(P>mq5ogf?t4a4<9B$jRJE;sXU;wOLc=kHJykv$# zld}(o7OS|0&@SJ9W5Q~(kc4Sam$HYlp?w%d)1gzr=O4}W0WMi9*pln2Oe6YBD$oym(6h4;ATqNH+qFTi)c<^EH z#^WTLkl-JeKc`lx*FXL^xT~NsFaDWD&TifzDdXKWN&wvDRJr^MX@z6lr09fhr_eGLJUHm)Me<+s%ogge!-kb?D9~0t;(_7|HxC; zr+K`8=pf!lxNCh+4maTc&HHk+YTCo{tuaOz=R<+$Zpt3Ig%sRh&Y?A7j`Kd>DC+qc}4|Wl$p(OARMfiw%II{9@UP!bv~@&JXzUsi!A<3%mV<# zx$K~fz21UeReIBl@bBs|)t{ghmI!eUufv9$Qpw*hnYrks?D9P?1wOPV>r(C&!Cd?C z5C7$0+V^26$a&-A^Ff8!Oh`%$wE|6eFN_NdtGf zRkH)}Npjm~M0q8otSKtgg68ZjnW2b%U@F=XrVEYSJ9Ah3RfjWeCqxmTI>Di-Ql2kfCjhh>Bw+-DWLcEUsR9_lZ1;BJgSKK=h|(&CY5qawP4KXU4z$ z8zzYy)_R46@7%28>Zs4!qplb3XHx?JrO#f+%F#XHUQ_=RcB64q??422(3VYpx#1kncVsP|EkpE{y zfAD*o!qp1gI(GUvuVfJ8X1*l*?ZKIeMf6j@$$`tEg?%_(4D+*{a1!jJ9`!f&#s2=U z_L`ij$4G!l);_4J1!Oh)nFsus|>4>R1t7tM1&zg=szu{fj@ zVfV@o5}wdgge!%Zz${MMB!bbD)hfJqJL$!|y#g08ugl;3MCn+S{A;&CmX27#Jvnn=3qbe`Q; zn65D?>y)qLjXjC2Tmtvr4(^fE<6l%glQvZzp!bm=fv&Ew-HbAM( zK7(#ch$sSS6P9jV1$UzXK<9(9tlWf(~_v!3h#+Tur_J)M?YWVa3B0$S^bZiF{ zD`H>W!rjrkk3|e!au@99ecR{h%biAZ@1MgiIX|4ln&(#^Z;-uvU@DK!x6jk@0TP)1 z5Q7Jt_063rgq5Ep`MsE;+L^48>qKgvg)5(Ac5C8Z$Pr9@@dxJ)Z%$(UdU*Z+HaMlK zNP3XnXt!$qSVL(e_8)#ZH)t4bY=6CoPl7PFPpU*l`|JIS`BM zY8?@K`Aeu}aFRVzs~J!R##*YPTQ1D4p~j4`y;1^mXWa>?=LFl7!?q%xw1<%BHae(398BvxVN0NJ z9-g$c5>+w1bH@Tj-RgP%tF-A6y(lQdjcL29{7s!SbJWaB5+wTZ-gbK-wqd; zj7;uD3zl;URW*lqPdhQ3r&W4<-c~Bp@d|=-toN0j`e9PGPWigyacZ=d%ZW5(BVvFp zp90`xSKTG(THW@sAhN;Loq&u+2xCf!y!$W^|Lj|1&%g&G+{MJ{9Yr^Z#VxJz@0wA` zXxIJgYCsQo%_Ra}WkJZyg^9b$t2P>-b6D#!=I&hOPWZ4L{o{UD?EYTqC=MI6SbDa= z?O4u|c(?R;tN#mPP^B1V`%x4OfIm1hn?GUHAZ*^bg;O;~ru)0J+3oKtVEj2ftp zUhd-fw@(_H+PFkPTX)Kn6s(0H_GQPH_aHv8j9j;`Shw~;=Pd85?k4eU((Ng)Dzy>9 zZENp0-Pr;lLo>47jX2rgmzsI!o{#oICv6UXC|Be%PXV3i44icL`#ib(vGqMvk)slmH7ufD3;) zZ`%{bL55T@VWSH81^rtcjAH-jXni(F2?i>9VcyVIsM2lJOh3X+HO0PcPVTy$t88=5 z2w7uJxr*KXaJfr(1FQ4{eu7Td?xhNLLLgo7v{M15aRH-In>C{$=U~+)yz;bN0}1SC- zc-G`iE_J2%FieM~_+^$KAPzdnw?7Kaqped>aP_{hBe+J|L1&8v0KIn+tJ$C*}(isY~qL zcE!2QT?XHjO`%B!c;cH}e9}FjPes*pS6m8 z23YUZ*Bs-7yd3UD6uu0qcL@grVCmqLNkV5f;i#PBi}6wJS&c6~cZZoAn|SX>Ude;- z9{4*s5Q}4{_gfevi-k3+6^LzI%6+L0^qfAwFaKw>T;?!rn#^`L$oT7}OB0rJWpspq zaPq~^$8N-Pt|SwIBsdSDDh|AkjYRqTG21k1K+m#iT47|FH(Go!SG)wl^u3-qFFEfL z&dqfGIBFA#@a4j;eV0EfkG`h#^E>>^OcfPa=q8 zL%G?KKv1NDM^y+BCBX90lb|acxwt&a;c@m>T=+shk^J&nAr6#=!0ISRg`)_V!Wp&F zja&5K@g?x*o%iYe)ibygk$O@hfJ|Gq(H7^r`wpM+a$lmS%J^`y{si#n>&w11pfwK?@$ovy}|c~>HNUd=eiSBt#gHJki&gj*p5X} zO&U~ZK5>j4NQp-#UzTgmj47XZd*$)ZC%qKpE8W`mOLX{}b!N5LcvO1+8=P(H-vigr z6q3EuSe*U-)M#5-N|B%?N9g)B=+)%Wgx0g`yAxD(5d7C>bb0Jt$AyW=yxx7{NGQhM zb~$q{`gQdHV|~rmnd$&rIFPRzn!UHyE~r{Ict3YkMPLLj3hEQ=PdH3RU~Rc+@}7#N zD=+&D02@O*E87{go2QaRH4vQeQ6|MV=zR~ZlI+J8`qn-@8jCu+kKRKy=hFvs)th;M zd{rBq!$jg`y+nVFf+GTvMksI!!rNcdA0gkUPJMDYzlcdF@W>|xCvZxHi#Di4a zpYA;(5JY!_MmKB|o_8^BU_L^))mOSzi$t;~{-&SyIMd!&Ojq#IwXP2Dt0U?3FO49{ z<&-oaAp%l;}0_h6qh^gf5q) z>Xkf5mkn&|wOIEF2t86D#IBlP1Jz9M`l1kNIBd$<2svm72(%L+e(Xl(l5$?WdYVz93xy#WsyG>V= z`)ct|Gu0YUbezyVMJ96W*~;1US(sUsMTZ>>b!bu+sFMuuc7RP!syT>7__&2h$@%VB zZ7x4=Pcxhj!hPQ3fOg*fg5LP$s#A4F!&X3BD;G9M3V{?Ha>J8t?nB<)#BX+OivbIX zyDl&CRKDE#`4dwPwjvG9b?-EaCo%fN%F1f(S;-jOxf~BNg~YWuxe|=tMTAUGb6VPPb}CctegNCE$|vpQso%1-fp((uT$r0f_=fk+2gWp+VN@4V8;@H->j z;(}z)qI0X~+jRRBJ})@giJ8kE*`P`!G#z&$NFux6>U`oaPg+#;csq+9y2UZ%^mV4S zRN0xU!pQux7G!OQcNwn54}?zj6-NI~TjqhcjGMi&m$o z2wzKOY&x0L9ppiao=LrjeqMQ8#i+zDEo)TMD_Kzlclfw;7q>ZH2Y!NBI*-8TE=9x$ zou|YsJLowrrO)y6tlOG-?Q4MPl|KX>vE{ zt3~Tc_>a*iZ$OV3S~b1!#W$CHww`jOhDn_8JA-zoM^B-^Bl{VmYrWq+n>Iw zLr{fl9^`MgUWrt@tFSfY3ZIj72yu&>7KJ?BGGIGBcxibH4l8TNbmfLhPwk^n*GEA5 zHm{%#-dm=OE*+&aEkaYPYVg7^#5Gb|eKqsjY~kSu ziXS-nF8d(2t+(a;$_yUNv-PE*2)xAwJ11hZKDo4#YqnX#-H%M|EA_fp{aWG7{kCv* zs@-GXy(9+0pr8_M@+;r`M7?ir%HGc(zdH7<{9{&eU|^0f*)4W!4`Ob?cLYjwcoHTV zM)J=7U`l%L+ZtSoOVQ0?>|^7UP<^Wq&VVjZ4IbgUAELKK_Lbw5LT^D?Tyad)-mZk? z>kI%ra^%EqUaQX}^Smp1VnxJ>vNc2QOWYvl$^I1|_$v7tZIfHl&~0(yb^)ETo7SU@ z1}zT^n0*cD68yi3W>R>G#gl_>*!IRqxg;Hj%(DzGnBHX>F^aCz9O|y|jauuo$V;@* zGbRXDjMQ462F=dx-o14&i8!F@lJcO56!Q~A7s{$NTcNfY%)7&{_p=%^?^3niUatS- zR5PWLb?bB~B-DjE-PDXQoa06>!Kw^!EuRdIxmZqFRK(c6%^SlDS zJJ&G;f|Z_KZ&0BTdi#tqJoz&&{}`F>eu7o3jp@KaTz6Nn7=x+dYKscjZMIxCmp}C% zkXZ(zm`3~8v@UDjaKkx7p*=uFKjt9n&@vS?s$vN{mh$RWv1tM{DwMn;b2LGHyUxG0Wn)o%P3E{wQ~Hq;y+3HmMk9Qes5FcGnr!f97!AWT z*}Mm)%~;pa-oR&h1bq-pGUj%CswOMv`iAv-?=7I6rRzpa?O$DeW@qXq>6Wd#z-pPE z^6_;Ysg!+&Ci3bhExH3T!PXy7uc6xX*)PhcuF@5%2|J*W3eCp@uZ&;cvjp++>< zcrs*Zheq3Zp8nnD+Uv1&X=&3@!+0|=%2I9RukK1}!d&Hk);Qa(u@>Amzwk4;`D=(D zt;F{f=zlg7!3teOFn?1a^7yk@sI%MRz`*-rIImc?6M=!}v*UH#M|!G$a`5|^v^|ZM zKf+Nu#fi_*wmzZU2gq!v01P9~*_4*?U-r?XdH1;7SGsJLN>eo@^-hw&+ZKSq*WZG&?)tkW}6|?VzkZ zyBT$`{LF9)d5O1T6AGc*I+;7civ%nJ1f5vSkq;W1Xe>-MFZO+Vsx7s*GG6pL#rMnD zfXqXIw?9*SZ$@a7NUuIfl1g{6Qvj*L!qT%Bt%WM91B-_!2~Q9;acJ(r?yQMp>5`z< zwqxX<(k3RQ+tDRy;~$5G2oB?C;dZHYW&tGvKGzoRpYz31rg=>_w-@7QYWpZ;zy=Eou>PijkhnF&p$Wh+U4)ZpM-O?U%>AN(Q-xYXRvF&A5^K9 zklL}Ppke=L+6eahi;|%d1&U2kpx9TS{noND%v^#S4*1=Su_f<=muWbZ!{^OVOM=FpZ^s)7 zvn45VikUs~CWBO5aJjCO2}v&R-*f#9NqF`#$XKiA&AD@`pf2282jB<){PdR_ca73yF9~+m+*`r(RP*uW+du4 zZlq7+ZsR>=j-d&Yp*x*FZ|6h0gafq<@E3S)ANI zf$b_RWX!&Cx9#VTnLbnWZUZeGtwaRkCC`kKuz#0Dir8H&!qtJm8~3`$>bRfQz?6G@ znbJE)zx)=mbbl~AG;i35%-&M)&iFc&0%R0uG)GwM5wbP55gF$761G68$vFpdfAWpF zcI$>osB=$0VW4+X2HG<+K1i7SngG^+e3WM?xZ98ulsGDyJ|s>H^EW?WKv9X7nh7ax z%R-lWoKBKNxtzbmFpJbvUg%A+xy7ySF+?ub?>tijo@7uOeYag&dvr$0KfS12r5pCl zMqKw@ZM)uPT-ck+tXrK)7&f6@``pWW;kZI21RI=AUX;ZUv*3_~eqIz2D}S+e);W3G zrNuHlC}TDKo{9~B8bRrjR%g=;y-~{O{7#{PTWIyV@#7jt9|>|t4(fHDAXR;$W7foy zK?}A=OeoUEBjgRqL%*;pBNk?*7Em1px-7wgDLZIKdCa9{Lu5bV3kMQk_cIslbiNF2 zQ%FlGoN4U(BSR?yC@ge?(xLichYq-0sOE2U>v zvkCp#^)42OnX0z2i{&ok4JEghEvSlC%_HPCtBQ6M{akMI&b{<09);c*rT#kO`1eC) zEwua#EL-(4!Z9|7U8U6&RW~wBTxwHhw#4-M=53{t_X+OcB+feW)ymk&yVSqMi05c5 zs_N5}Z6JGM`-`~DxPn=1*n3Gsc`gL+fkpdqS2^~q6aRA$t0<2*c&>4-u^$0>*?r@$ ztCWpruJvl49=~?g*(Pj2&~R~Kh&%1F?uXs?m7ZH4kF3TdZwISqjFU(djHuQSzp8^z z4$e2ZusaLlQ?a;|r4AX9{9k5Oe&q~G0b0R@LQ|%YmhM5}lj_hE^d;y(}T8TpEd(J@$wS_z1j0a&Vh-`JVq7y1OD&74uFm-%Kc{dbcrP ziYj7}4)UEClF2WOdp;FM$P*@3Sb%k>L9NddOBvZ;kx$=({frUt-y#xFTZ!>w0J6R% zlDtn()R(l}YS}rVnw4#~=sq4XwN);GPcC}znw@u)wswY&Zr3OGbBuPvf7mOIjs3pK z$31nl5eKB#(e6fIwS!AXE{SJf?wFCPji(acRAg+|bEz3b2I$(LLdRxKAkm_t+@?ZK zt_LpYKWhMo{>Mi=i<0d-IUL=b_-pm>AR(09(vYHiUPDmM1L~x12Woc6wn?E(^Vbv=#g_wO_pBhp=^OHd^Rg&;17H0bQh}22qCX_^%nxzgz>u;*HHmUP zVM4(5of>lkN2-jz_@h8?fuE$MUtWi&wKEY(xJXd?MhdyKa7}*>*N+GRDgBW3PHfsh zT0-zLyxtKnpsY>Ahaw;CIGWlqH3>FE0scdQ%#a=LImAi3w+}5wOgLltba~Qsu=8Ed zT$o}=#_i?T7euq)2W3a4G9K4uJ*B_8*$L1uyQH`z8*~iVU2CBuPgTo6GF1sJb+|=U zz2O|+v#APxd%PuM?Ag?*7$E#^#1!)fUEeY!cEoFKygM6C-_Zqq*Mrq9s!t#JSx3w@ zJ#ZA*pS}wj)e-0>RN-!XqXb9+wPa#P(;~v87uk*MnHuwz+*vnimW1gaqR|wmZCcy( z;ZdD?sGP1Tt&o>>phunx!Q)44w0d};lY8s5H!FUQLk^5un% zQQ##^xcyr;y4t<3#6irLM{`Jjc|uj;%xRZ8Tj=&ln8s8%$Kh*l4rAJGS|<@~>Dy`2 z0%XRaH6S3xa%X7cWAn%Rpt8LL$SsZFzZN0tAi2g7S{h!*S?RJ!Wk&yBqj@e4A$Pk= z;}J*738u4}mr<`@!fp(P7`Z+bIloSnvsR*cdFk%&xv? zCBA@c^8$bck>Rw0ku2uSIJPuUknxvJ>Vh+WscuMs*Jv_%fc1+Ao>*klTDK))e>=s& zC|sw6N;(*ACr8kSB=ZY%qsCDpQe0oiT}ES!qpHPp*ayWvm}szsNGkroOr?VO-MDKW zA0A7bfVUuH%n*u%LZOYesSArAgB>(3eWk=XDfCow6~|{;s#A#A!M$6EhcPm8V{bj0 zN1`5GE`NW47>De;~ zn=26M*4ylVl~mtWN=me$C0>Yk?F zclzllgPXF<5Z$7zAbSEVQ7w_#_^5G^R!Kh$#~0OSiq$nHXq{wf3+Fz$$7p_)p>+`5z?ip$NxR-b+jX>jeqC-SY;rQR&8 zvAKG{y`8U18&>_p2WN85gd1^34-@Y)(4jv8r(SM*nso9_?Rx?9L?WU-LcwfpB9G1m0Yt~m(;&OUP$4nP$mJ7NWW>}8`Lx-ay8<1iK6XlQ}Bp~c@Dl2~7qRVIVGV8Q0G(NDZdaCeENj@`8(I8qpeNNQ9ct8#(V<(X4)_Uz z2k_k`z8xeS+z8){UcVg>axz!Y!L8FkrA%b(DOB876#9@L8OEFcGw9eSs^_`UIjh~B z^qLK4Nge>O@RkWXO2c_J*(k|)KC>Tv(qgyf^?aG`fqB2`^~GKGFpk$Is)eAoXrG`= z*lX@Yn(ozNs(8jQ)l8Bbc11{0l&2R#@cpa0T$J0+OjpTq(4}J5c0>&fud*3*hx{Uu zzsZQn;hX2g*jcEKg^zAJJ#&q@b$ERBq;>S48~Qb^)L=lst)a2SbyOmnw6MH{gU^y;yAO{&cRYmPBwt#gKMVZ3ug**QVK0<^8^f2H%a%9S zUh4o70wPCGqvfG%W@Rb{jKv*W$laOC-y;tWI5XmAqGd&Y-XiMG+=HN(;_rcHOm`yY z?0(C{{YtH~g8gvPGJu_bs^6^-Cu+YDPOUtzwed6ACzrE{YoBKe%mt2)IUor3-Pu7@ z)JNv-?S|um{4l}Yx8Xlvr+ws;@DY^h|-{$50zDB^lzfdaNdl<9okf1RvG z_drc@`9j;PFD1hgMO8PqYahhGe#&W-!ERVFJp=${0C0yAl}Ez-P-P~g8{KysfBcrN z5|U5pu_!aMXq;N}e%kF?J{`;M>gTrVw_|+B)5YI^KIwCCcV0?F*fVzYJs$sSV|Wyq zY{~jp4Ys>zT@{i}KYI7*`e%-=BB_lZfnUzEI3=&D2scdvM8&`YLR>nMg<#4WwK;lc zXq|Dn${r@_*Xz62LIaltBMh$z<1OSI*3S| z7_nj;2uXwIWm3u1JYWVM0Fbg$ntCp-(`CAG=?Xt`UIL$KF(YgL(F6Q#|ZyLx%5l1k2l z<|c<2MAvZQJV}?J!&n!C#n#vpL_BC%viF#pIuiEQTOh+TN6<&-8DsS)u3VEwiCa6I zsZwqw1e4hrp%A2LxM?}nbrKE5Qvuva9r4Z?+FEFcDgLCy{KboP8fYyg02W!Ov|$sn z4ynPkp##h^v8K&NkXVF|A{WNNxg{3kq-0~+5JTc?ln(uB!4al93fJjd`PjMp)+yfh zk~Et2 z%p|6|ddKL4&I@sBC<&Jv$_f+V)ve+|=ICBN!8HxcMK=g-Zv3Q!{fQpMcq>UsN%70! z*WVv_Xx#X7r{g=XT2%x}qm6&LwNys$Uenou|I~^fcxZ~^t_7idDu#rf2n+x$ch0s} zTtJpeAj81kYHo6->ZuBe#oXQ>8Gb8Ar^8Jyh@tNe1*cIT{9F7B_G%Xz2A7yCraknD zmz{3XFx83NC8Y!lzH@DhnRfze%Xxd&)OA;TZV2osTL)=#WR#OQ&?;Z+8+xEds>bz@ zI6IVW<=u-=A>iACgJ}km>Vogp7 zj$U;)_H2|NT?cq3YX-IzU-YWa;cGc&3-1f>udH|%ci>9K-8zeGs_;*{dp%x*fec>r zc4MQJC!<8*1&_NP!(vBncwraCjr|2d4@VK=owN1`VlJ&HI!f>WGm%WTDsaj}%#^NM zL^Cy^YCAt)vx>w;xVdc^6)|g95xu*L4*o2jJ5r1%L$ln)8-| zJ=1!Wc2&MvS*W99Z0V~_scQfQ&2iHGe)}uQ#i@7_QT**vFI$#ev=r|N8$2 zIxXkZGP4KQ>WG^M%&4C|QHz}>Mb03@GI!YvXZFB1D`k|R1wU`yjejnSMEh5|gmL{vX)4v*A6KVP5%g|<#+fWzufoZ(3} z$t3?oB~b}ZWFn9NRg3w)z)8pL9{#(0(cky}DKAb{lNgu%i2C{mxYMUeSm~(tB>0xa z_D|Ams)9Wq{!+UFd`p8=L@<3w#~s5N1_hXa2dXz8?J|x6V13NN5A{FU%z0!o_vm|KK zRGJATi$in~o)}5%7?P7>QAM?n4|{^GSJxi^__axjSEU8c!hJHMp>o^}tL_fj)4WnANtRW}s9IK` zVeTCh_-ER5;Qd&1sP!*7u*T2(*?w=nM*~J`N=(aw{yX+EhX?Bvet|s+?OtU|C}Q=8 zN`({v08l;BPl_Zd!hDnQ;9%!*d67avgco@JRxKO=&!_^om|B+g>S{!2$rlp;}Mk#$VJY%GQP56)}(+pcczc3FPN1134B%PaiXfI_xO_OE5bfRn50(38n0r zWk1SiovK&DEvf_zo?s`I?&D41Nuv1pgW4s)Ilf=zpS>lZB!F?U*;Os1=ouoKB>7La z?|)6hKbo@PmD}Dj%{x&fSNkIIpD6k-WwVBn{RQIsey8pvB(k3c{@(F;dxM;`=k(pD zTENJ0A+>w50GQZmzC|Q))8dA6G!HSL1OGY23V^$gNy@wNRqgv|?_H&R!W$koHfQcD zd~qKv&pHam-LMU@$UQqD$P2+7!}Hr$)e(BVLZ-Xbrpms2e?wUQy}!H{dCv}d#0esH z2lKB~pK|-AbKt!8xi9L9MekidWV=Z=FIe?C>Z&*eO6fkP5Yi?vlPZ5$<{NFN;#m5D z|8#+mx`pGdA#QG4g91(x4ugOiCL!vqYmH2VkD4C1AxU!sh% zAqbw$DTMnV1YA1*iMjF#nRh5aDHA>~eqD}!ArPdmy$kxil)}j@!y>r!mLioq) zg2MoU^|Z$s)}-t-CG?9!#I7oJ6k=LaQ`1vRgb;rbE)@&4f7fPu1%gt|}dutc-p#%e>JqZbXfz%M?)t+BA z;cY!?V?TrGkiU{h!ZkGX;%?Mt7$Iu%EbpGh>S%t81~CATOx324k1#Y0=~4V z9IoojZ5EH4w;uhzW&v_raUI5hw9CvCls$$y97p~Y2$~W#Kl+hGTo4yKQL#Q&Gj_fh z<}et4%p7Xb_7s15cqlQ#eU+7{H_R)U_iSw{rn`i7qM#gvrW_8CO+Wlrt{0+ah9Hvt zZ?ydp@OhT$Ed<>^L)V8%*cx3rNX&uYO@|RI-uNz6 z^BAJ9Uuh1+^&fb+DKZ{@F;|tT{VqGDU2)IubhmB>-J*&1aGZlb>%V0cBz~t+p?uO7 zolb&lPUCz*ln*~De0y(Q?5YmYjTHG&9m>HV<`IzRK0#sj#MyKAY(n6k2G75}%1}$~ zNtqd&{@PX)>&x5EeBV!eTXT4lL`)0-`91522O*vg+s5@?O;Dq44gbmvSO{;4($%6- zO`($qKJ2yFwLMkQga@H|G}n2ZC0B-sLL?=~0N{6Wrm^s&8}v9w4>AA%o(LtrSC77` zqyG|ACj8)01HiR@Z9%GDqMC^iEcDXIVfd{k!3>P&Nb<#c~xQ0Jfi*6|Cy4#|@k zd&?^|=dFxRCKUs&t5!ks#Nt;sho4aZ5+EkJ`hhGM52XU+@j=|O)V zuUBlU&NZh+<0p0s66An@!Hwhan>0=8BP=`5!U2IuKw?Z8@ZY?n-2A$Qg^O#+e*0!U z-4;;>fXE9zS-}!HW|zf#h@X}36myc<(jT(`zZ<+Qa{Tjl zQn^ogfhjcHG_TFxL7Rz~*zx8xKhPt$0>CC0u4(;FU_ZETZhLr3Z)xai~>@AlB+KHmBR6BcGTO0Xdr{<#k5CLd@8;;HVs+mTtf+^ znEcxNsY&IBQM~#tYnW;in_h8PI!Vbn1V8p_lK zWtuw_H{qL*!e+?Mhug2+i_#{z-(LR=u#``G=mmMD>wj}tp;trl@-!^hX#+q)!6#{* zbEj#Byd;y{6$IsLR`j0Z?D2M*>tun!wEWx&bHsHuxeu=d1Fb!-^V0!Nj!8CnkP*78 zQJxT1w||dK<=bd;g4Km9k069k<=b~>N^n@rU4U=xE6{W5i}&ayJPxkifhY!qQ%=|r zMn5@*eh++!%gR;Xs6D+b2~!3bR3Ick90KdoZMqoxaYC_y zqnlg4IcsOC$sEohp0zC$tnk9#;t!*E{;lJ0he6fV0kdl(RH6X+@TJRQDkm{M)PB&z z%fjG&OfU(UC>ZbYeeRO`>pmzDQ}j?dpfa1_R7m7-WQdUaY|gzY-CAwVCCdIW{M2Eb zR3|w5PzQ*a;#|wBv8gI%5=qt_X5l{6Uu^w}J{TE{-!KUpuC+%Ug!@EAm2eT7Q}TBv zU$BKzsP1}xyLI5s0FdVQtLQ(l4SJtLSZRk5K5Z;aa6DxJcjoPUVSZTk9uyNk+QFMs z(SFQa&TQ($9yq>h6XmFm=m~ZXJ+y1jU&O;GMEXfr;i8_PMmo!^Q$&7jLL=S-U;>IjjK)(f1Kc9%HwV84h_P2Y2NkBDEN zs#o1(n{2Ae{Oes@&1mszSzBcgo*`{0yMvu;qM`>K?aovN2^N-D8hEwuK_1L+63d?26ri= zPrd4;zQJV{74xMZt8UPS@8j6&tIUAB^**K*MSU+@@Sm6QO*x&#({6yp3NcF`dYYt- z14g*DDBH5WzlWJ%g2#X8jh>kra$1;Vra4GeMJ4?)#Ra_E8KXY=WfXfra2Sl{pTFm! zwj5!01a_Lptv1MGyko6(IdhQ2 zA(-8+40zendy31ZGxEQeAd6eH6yFI3y6UlH~iTBRm>~|St6Pjens-`B& z5fy_!mF1m=;%)CW{K`#3jVoMpLud50Ci4W4?p8BxQ zRa_$?@Sf7wVc{hwsxLLy0GFmKMSe;5lLoEz;gxI|z+I5;x&1}FKo%&DSxdizsiMG^ z{{h|E8MDhn^qVnukYl6zPXCnxbFd?LYdALdG&v+@j z`c?aBo2uYCwjoP{-`oasY9GePf@=-N0vsG5Zk)d-=ZeE0hI53>_DS6Ieh~r!SogP7ELu=vOeK|JWXV2^CCgwehp`l6#DtJ7%NRrUVP@{fxo_@^dtcr2 z;@&^td0zZ}&ztA>`F*}+rd4dGTyW&0yabLe+qZfbc(P)Z091?ew_d!6(x2&1EEj{K z7_ree>%)~%NqJJkrBu7dun;B!h{$%w?I7pp+qs7PDAtG)%Ah@5G{ zy%*HZkmXmh4P%aSfkbl5tDboJEX7{$GmTZQcUTG@I9|L4EHA1;YKQZvpTH^b(t&kk z5s@8aa#^i1VD11$z1qj?CgMhNb`RHahT}QRi(Pm|bem@Cj`o@c1TLV4-~c?|!9qjZ zO=Z-fl%X@Q0oQD8-d@S!u}3)L?orWIW5b#zFJQdhU$Zn4W_(TB-+!mZmP;1RXS}~2 z#%XM?wl48U>r`X$!NSHe5}OO(ZxGZxyZ4#TPu(NIY?7|nPkS8BIFmOMVC}DL9}`4b zX$fub+a&gz@qc=pAA$@A#3ZiN?ng?e6W2t_eN#$z9xE2vEty}$e|1<~bB&cNY~*Bj zkvvI^e6w1J61h}ae(_}?Kf}#u7I@fHX|>6V%_kW;sUYo3(TcXbQ?ZCO3gOEc!;O}g zP$d#}AuDia$J7uDGu18n?2p z*7&EI{ic=<%)91DPLS6iYBhxiD^z&vZ0i0~^6B&XtFUXsk)-KYAMN(3Q4h{oG2YQ| zuXVfF&;t@qG3dOX9I5g6gIJ+Vpy!rj*sTf+jXEoksqoh2A-EqrUmQpa%1w8TE7_Ww zn1FX=y#E{}{Hdbv_qdGpnftpvCkILxU2n&TEcDt%okGNYG_FS0z|S@fCg?IBFmU&t zZ7&szwA{H{)>*bZ!FlT+!9m;cyd!>CkX7F;JU9_aY1P=|8P=uB#d9zrmD;U|oks=U zT$w!G28z4T>+Gre>^fG6e{u)62rkT_uoE{? zKFP-&sS==#$cxU<%t(4`LpL0E41<|4y1-kxA|c++w!9I$eB(kQ8ADswCoI-0Lv zq!|*hVLAPII?F#-E$N#j$%VQ|n}chy8}n8pUHW%Ugopw#AzE$Qg;(rcqT}d~S^>>g z)8fyMF17ISQ(Z;EjrmRmyWq3W{1FND31RiVvH<0<>TSf#mCcn7^w6-G?9-RF7AK9( zXs|P750r!~O!8L_#^F0&B6e>WKkw(@#;#8;MJkV^gZNkhx+nnSIuTj8g(5ziW)-?@ zh@BCXR}(Gz_S3zVbM=kn7`wqn<cvobHGdqzLybU(sA1v0U2*77Xt z*w7$sEGkRW{&|h_rPA5?O`g;*WwmmCI6Sv{9avQ+%f$}V5!fAsvD8~n008+=6Z7RT z*GtEXT6PHeGA>U99_qSXCfF32G%&Ooc14Tpzu9EPS$Bcc!v?`FXN~VBI>+~hOQuiZ zLAmrRvC>I_Hpkk`O)%QtMH;6dr^mhPtl8tk!~Sd5^?=Xiei?08-Qg#f$hqq<4WML$ zLhYo6_gwH7qmq_7EfzK90T2?SteVO<-X6u_dMfA@vdono78dz}Nvc$}LGWzdqO1Vs zl<$3mY`2+pqztbDnq5p}s3Uep!xem$MNyEbCIbq_x%|o~oRi zS64M7E9?9~KnmcXq;!A@Nm3~2`qnQrn|zEWoDql0qfhyX(SO_$Y-**|Jw&w$W;cHK zf8!dZs=2!GaA}`EMlI*#t|=WnPj$6ZSyN>7HVI%<0KZEec|51s@F7}M8x#sCp5A4y za}Evl4f8aI1TX+hb8|n|?CWj4q-4<=tB=3<%f09Um+-SSWGOZ_s(V$I&U+FH8pftj zc8`Y52mPZFyJD=}Dx~&5hkpnR6?otB*f2|nr31;* zTa}*#1p||h^~VnQF*?WO6Z>!6-|OIzmY+dXoulKgKcu)Xe7`6$Yqgx&{3o-(SZ@hl ziS&5oF(w0u4y5M^{IJ4CG$qyFzIsQ%bl4Xhhy(_OIYgAqR{APnb+cHMG?-Z@KL`y( zu`0O_rc8o*$s6n{et=s>U+{ysSF|7V1tXH;`|fMyH(Gqlx6~ z$JA7ulT5gLsA{pkdT9Wd?-waka>hm&8VLUNYuo#r1P4f zmJq1f&F`rqP58nFE+Byn<)S=F8NlpKmH5)*`v7}P0a*blonI@+LQTzQH%0F+WQx4r z?lX4`6{>#2lCg#oCFk)b=UQyYBe*202Co)S%c${hQ3#Bo-JHS~kTXaj#Ox zo~JHb{YA#obkYkxRU!WsoD{g3ufH7pd*z!QQecw=^fHsCh<@$$o)rXL%+?MtzG4hA zb}$;~)2q*TzeWPVp}m;K)nFvmYYDdN+2Q7{^7V*;rx`q7uV?)aQ^W90r*CP9rskw2`lV>#uJg#bs@~Pz_)F}Px!;!AJLK>i zPb-b4dEa)nBUN8wy{I=!xza3j>PLQVFDj4GJ?Z`KYwb}0KvQl>6BC!t!9pTHOK#&X zcGQxY*|02$PoT^DPO z?acW+=x$BkV1E`996>F1`r4r~WZ!)>osLA@o~tYy>7>!Gm24N6eYr!(RSwMS74T7F z0^9fEsXu@o2lk?*y=d*fp{4EZ`1fG5e~H2VZiLwXEA8w*N%i*_@IS9gdlO$w7x3zQ Vmwd$pZg5YHt5$ZGh!#E%{{ft?yA=Qc literal 0 HcmV?d00001 diff --git a/libraries/animation/src/AnimInverseKinematics.cpp b/libraries/animation/src/AnimInverseKinematics.cpp index 71094cc6e1..037bac52e2 100644 --- a/libraries/animation/src/AnimInverseKinematics.cpp +++ b/libraries/animation/src/AnimInverseKinematics.cpp @@ -851,10 +851,12 @@ const AnimPoseVec& AnimInverseKinematics::evaluate(const AnimVariantMap& animVar //virtual const AnimPoseVec& AnimInverseKinematics::overlay(const AnimVariantMap& animVars, const AnimContext& context, float dt, AnimVariantMap& triggersOut, const AnimPoseVec& underPoses) { +/* We need this working so body parts can move #ifdef Q_OS_ANDROID // disable IK on android return underPoses; #endif +*/ // allows solutionSource to be overridden by an animVar auto solutionSource = animVars.lookup(_solutionSourceVar, (int)_solutionSource); diff --git a/libraries/display-plugins/src/display-plugins/Basic2DWindowOpenGLDisplayPlugin.cpp b/libraries/display-plugins/src/display-plugins/Basic2DWindowOpenGLDisplayPlugin.cpp index d8b8cbd54a..ea5e854712 100644 --- a/libraries/display-plugins/src/display-plugins/Basic2DWindowOpenGLDisplayPlugin.cpp +++ b/libraries/display-plugins/src/display-plugins/Basic2DWindowOpenGLDisplayPlugin.cpp @@ -99,6 +99,31 @@ void Basic2DWindowOpenGLDisplayPlugin::customizeContext() { _virtualPadJumpBtnTexture->setAutoGenerateMips(true); } } + + _virtualPadRbBtnPixelSize = dpi * VirtualPad::Manager::JUMP_BTN_FULL_PIXELS / VirtualPad::Manager::DPI; + if (!_virtualPadRbBtnTexture) { + auto iconPath = PathUtils::resourcesPath() + "images/handshake.png"; + auto image = QImage(iconPath); + if (image.format() != QImage::Format_ARGB32) { + image = image.convertToFormat(QImage::Format_ARGB32); + } + if ((image.width() > 0) && (image.height() > 0)) { + image = image.scaled(_virtualPadRbBtnPixelSize, _virtualPadRbBtnPixelSize, Qt::KeepAspectRatio); + image = image.mirrored(); + + _virtualPadRbBtnTexture = gpu::Texture::createStrict( + gpu::Element(gpu::VEC4, gpu::NUINT8, gpu::RGBA), + image.width(), image.height(), + gpu::Texture::MAX_NUM_MIPS, + gpu::Sampler(gpu::Sampler::FILTER_MIN_MAG_MIP_LINEAR)); + _virtualPadRbBtnTexture->setSource("virtualPad handshake"); + auto usage = gpu::Texture::Usage::Builder().withColor().withAlpha(); + _virtualPadRbBtnTexture->setUsage(usage.build()); + _virtualPadRbBtnTexture->setStoredMipFormat(gpu::Element(gpu::VEC4, gpu::NUINT8, gpu::RGBA)); + _virtualPadRbBtnTexture->assignStoredMip(0, image.byteCount(), image.constBits()); + _virtualPadRbBtnTexture->setAutoGenerateMips(true); + } + } #endif Parent::customizeContext(); } @@ -135,6 +160,8 @@ void Basic2DWindowOpenGLDisplayPlugin::compositeExtra() { _virtualPadPixelSize, _virtualPadPixelSize); auto jumpTransform = DependencyManager::get()->getPoint2DTransform(virtualPadManager.getJumpButtonPosition(), _virtualPadJumpBtnPixelSize, _virtualPadJumpBtnPixelSize); + auto rbTransform = DependencyManager::get()->getPoint2DTransform(virtualPadManager.getRbButtonPosition(), + _virtualPadRbBtnPixelSize, _virtualPadRbBtnPixelSize); render([&](gpu::Batch& batch) { batch.enableStereo(false); @@ -154,6 +181,10 @@ void Basic2DWindowOpenGLDisplayPlugin::compositeExtra() { batch.setResourceTexture(0, _virtualPadJumpBtnTexture); batch.setModelTransform(jumpTransform); batch.draw(gpu::TRIANGLE_STRIP, 4); + + batch.setResourceTexture(0, _virtualPadRbBtnTexture); + batch.setModelTransform(rbTransform); + batch.draw(gpu::TRIANGLE_STRIP, 4); }); } #endif diff --git a/libraries/display-plugins/src/display-plugins/Basic2DWindowOpenGLDisplayPlugin.h b/libraries/display-plugins/src/display-plugins/Basic2DWindowOpenGLDisplayPlugin.h index a061a4c923..955a816799 100644 --- a/libraries/display-plugins/src/display-plugins/Basic2DWindowOpenGLDisplayPlugin.h +++ b/libraries/display-plugins/src/display-plugins/Basic2DWindowOpenGLDisplayPlugin.h @@ -49,5 +49,8 @@ private: gpu::TexturePointer _virtualPadJumpBtnTexture; qreal _virtualPadJumpBtnPixelSize; + + gpu::TexturePointer _virtualPadRbBtnTexture; + qreal _virtualPadRbBtnPixelSize; #endif }; diff --git a/libraries/input-plugins/src/input-plugins/TouchscreenVirtualPadDevice.cpp b/libraries/input-plugins/src/input-plugins/TouchscreenVirtualPadDevice.cpp index 32194e1b84..48d2555626 100644 --- a/libraries/input-plugins/src/input-plugins/TouchscreenVirtualPadDevice.cpp +++ b/libraries/input-plugins/src/input-plugins/TouchscreenVirtualPadDevice.cpp @@ -67,6 +67,7 @@ void TouchscreenVirtualPadDevice::resize() { _fixedRadiusForCalc = _fixedRadius - _screenDPI * VirtualPad::Manager::STICK_RADIUS_PIXELS / VirtualPad::Manager::DPI; _jumpButtonRadius = _screenDPI * VirtualPad::Manager::JUMP_BTN_TRIMMED_RADIUS_PIXELS / VirtualPad::Manager::DPI; + _rbButtonRadius = _jumpButtonRadius; } auto& virtualPadManager = VirtualPad::Manager::instance(); @@ -91,6 +92,10 @@ void TouchscreenVirtualPadDevice::setupControlsPositions(VirtualPad::Manager& vi float bottomMargin = _screenDPI * VirtualPad::Manager::JUMP_BTN_BOTTOM_MARGIN_PIXELS/ VirtualPad::Manager::DPI; _jumpButtonPosition = glm::vec2( eventScreen->availableSize().width() - rightMargin - jumpBtnPixelSize, eventScreen->availableSize().height() - bottomMargin - _jumpButtonRadius - _extraBottomMargin); virtualPadManager.setJumpButtonPosition(_jumpButtonPosition); + + // RB button (use same size as jump) + _rbButtonPosition = glm::vec2( eventScreen->availableSize().width() - rightMargin - jumpBtnPixelSize, eventScreen->availableSize().height() - 2 * bottomMargin - 3 * _rbButtonRadius - _extraBottomMargin); + virtualPadManager.setRbButtonPosition(_rbButtonPosition); } float clip(float n, float lower, float upper) { @@ -236,6 +241,7 @@ void TouchscreenVirtualPadDevice::touchEndEvent(const QTouchEvent* event) { moveTouchEnd(); viewTouchEnd(); jumpTouchEnd(); + rbTouchEnd(); return; } // touch end here is a big reset -> resets both pads @@ -245,6 +251,7 @@ void TouchscreenVirtualPadDevice::touchEndEvent(const QTouchEvent* event) { moveTouchEnd(); viewTouchEnd(); jumpTouchEnd(); + rbTouchEnd(); _inputDevice->_axisStateMap.clear(); _inputDevice->_buttonPressedMap.clear(); } @@ -281,10 +288,12 @@ void TouchscreenVirtualPadDevice::touchUpdateEvent(const QTouchEvent* event) { bool moveTouchFound = false; bool viewTouchFound = false; bool jumpTouchFound = false; + bool rbTouchFound = false; int idxMoveStartingPointCandidate = -1; int idxViewStartingPointCandidate = -1; int idxJumpStartingPointCandidate = -1; + int idxRbStartingPointCandidate = -1; glm::vec2 thisPoint; int thisPointId; @@ -316,6 +325,13 @@ void TouchscreenVirtualPadDevice::touchUpdateEvent(const QTouchEvent* event) { continue; } + if (!rbTouchFound && _rbHasValidTouch && _rbCurrentTouchId == thisPointId) { + // valid if it's an ongoing touch + rbTouchFound = true; + rbTouchUpdate(thisPoint); + continue; + } + if (!moveTouchFound && idxMoveStartingPointCandidate == -1 && moveTouchBeginIsValid(thisPoint) && (!_unusedTouches.count(thisPointId) || _unusedTouches[thisPointId] == MOVE )) { idxMoveStartingPointCandidate = i; @@ -334,12 +350,20 @@ void TouchscreenVirtualPadDevice::touchUpdateEvent(const QTouchEvent* event) { continue; } + if (!rbTouchFound && idxRbStartingPointCandidate == -1 && rbTouchBeginIsValid(thisPoint) && + (!_unusedTouches.count(thisPointId) || _unusedTouches[thisPointId] == RB_BUTTON )) { + idxRbStartingPointCandidate = i; + continue; + } + if (moveTouchBeginIsValid(thisPoint)) { unusedTouchesInEvent[thisPointId] = MOVE; } else if (jumpTouchBeginIsValid(thisPoint)) { unusedTouchesInEvent[thisPointId] = JUMP; } else if (viewTouchBeginIsValid(thisPoint)) { unusedTouchesInEvent[thisPointId] = VIEW; + } else if (rbTouchBeginIsValid(thisPoint)) { + unusedTouchesInEvent[thisPointId] = RB_BUTTON; } } @@ -381,11 +405,24 @@ void TouchscreenVirtualPadDevice::touchUpdateEvent(const QTouchEvent* event) { } } } + if (!rbTouchFound) { + if (idxRbStartingPointCandidate != -1) { + _rbCurrentTouchId = tPoints[idxRbStartingPointCandidate].id(); + _unusedTouches.erase(_rbCurrentTouchId); + thisPoint.x = tPoints[idxRbStartingPointCandidate].pos().x(); + thisPoint.y = tPoints[idxRbStartingPointCandidate].pos().y(); + rbTouchBegin(thisPoint); + } else { + if (_rbHasValidTouch) { + rbTouchEnd(); + } + } + } } bool TouchscreenVirtualPadDevice::viewTouchBeginIsValid(glm::vec2 touchPoint) { - return !moveTouchBeginIsValid(touchPoint) && !jumpTouchBeginIsValid(touchPoint); + return !moveTouchBeginIsValid(touchPoint) && !jumpTouchBeginIsValid(touchPoint) && !rbTouchBeginIsValid(touchPoint); } bool TouchscreenVirtualPadDevice::moveTouchBeginIsValid(glm::vec2 touchPoint) { @@ -419,6 +456,29 @@ void TouchscreenVirtualPadDevice::jumpTouchEnd() { _jumpHasValidTouch = false; _inputDevice->_buttonPressedMap.erase(TouchButtonChannel::JUMP_BUTTON_PRESS); + } +} + +bool TouchscreenVirtualPadDevice::rbTouchBeginIsValid(glm::vec2 touchPoint) { + return glm::distance2(touchPoint, _rbButtonPosition) < _rbButtonRadius * _rbButtonRadius; +} + +void TouchscreenVirtualPadDevice::rbTouchBegin(glm::vec2 touchPoint) { + auto& virtualPadManager = VirtualPad::Manager::instance(); + if (virtualPadManager.isEnabled() && !virtualPadManager.isHidden()) { + _rbHasValidTouch = true; + + _inputDevice->_buttonPressedMap.insert(TouchButtonChannel::RB); + } +} + +void TouchscreenVirtualPadDevice::rbTouchUpdate(glm::vec2 touchPoint) {} + +void TouchscreenVirtualPadDevice::rbTouchEnd() { + if (_rbHasValidTouch) { + _rbHasValidTouch = false; + + _inputDevice->_buttonPressedMap.erase(TouchButtonChannel::RB); } } @@ -496,7 +556,8 @@ controller::Input::NamedVector TouchscreenVirtualPadDevice::InputDevice::getAvai Input::NamedPair(makeInput(TouchAxisChannel::LY), "LY"), Input::NamedPair(makeInput(TouchAxisChannel::RX), "RX"), Input::NamedPair(makeInput(TouchAxisChannel::RY), "RY"), - Input::NamedPair(makeInput(TouchButtonChannel::JUMP_BUTTON_PRESS), "JUMP_BUTTON_PRESS") + Input::NamedPair(makeInput(TouchButtonChannel::JUMP_BUTTON_PRESS), "JUMP_BUTTON_PRESS"), + Input::NamedPair(makeInput(TouchButtonChannel::RB), "RB") }; return availableInputs; } diff --git a/libraries/input-plugins/src/input-plugins/TouchscreenVirtualPadDevice.h b/libraries/input-plugins/src/input-plugins/TouchscreenVirtualPadDevice.h index ef1e7a4d89..9ee3568be3 100644 --- a/libraries/input-plugins/src/input-plugins/TouchscreenVirtualPadDevice.h +++ b/libraries/input-plugins/src/input-plugins/TouchscreenVirtualPadDevice.h @@ -51,7 +51,8 @@ public: }; enum TouchButtonChannel { - JUMP_BUTTON_PRESS + JUMP_BUTTON_PRESS, + RB }; protected: @@ -82,7 +83,8 @@ protected: enum TouchType { MOVE = 1, VIEW, - JUMP + JUMP, + RB_BUTTON }; float _lastPinchScale; @@ -104,6 +106,9 @@ protected: bool _jumpHasValidTouch; int _jumpCurrentTouchId; + bool _rbHasValidTouch; + int _rbCurrentTouchId; + std::map _unusedTouches; int _touchPointCount; @@ -119,6 +124,9 @@ protected: glm::vec2 _jumpButtonPosition; float _jumpButtonRadius; + glm::vec2 _rbButtonPosition; + float _rbButtonRadius; + void moveTouchBegin(glm::vec2 touchPoint); void moveTouchUpdate(glm::vec2 touchPoint); void moveTouchEnd(); @@ -134,6 +142,11 @@ protected: void jumpTouchEnd(); bool jumpTouchBeginIsValid(glm::vec2 touchPoint); + void rbTouchBegin(glm::vec2 touchPoint); + void rbTouchUpdate(glm::vec2 touchPoint); + void rbTouchEnd(); + bool rbTouchBeginIsValid(glm::vec2 touchPoint); + void setupControlsPositions(VirtualPad::Manager& virtualPadManager, bool force = false); void processInputDeviceForMove(VirtualPad::Manager& virtualPadManager); diff --git a/libraries/ui/src/VirtualPadManager.cpp b/libraries/ui/src/VirtualPadManager.cpp index ef2b8670cc..e2e44fda81 100644 --- a/libraries/ui/src/VirtualPadManager.cpp +++ b/libraries/ui/src/VirtualPadManager.cpp @@ -84,6 +84,14 @@ namespace VirtualPad { _jumpButtonPosition = point; } + glm::vec2 Manager::getRbButtonPosition() { + return _rbButtonPosition; + } + + void Manager::setRbButtonPosition(glm::vec2 point) { + _rbButtonPosition = point; + } + void Manager::requestHapticFeedback(int duration) { emit hapticFeedbackRequested(duration); } diff --git a/libraries/ui/src/VirtualPadManager.h b/libraries/ui/src/VirtualPadManager.h index 3c3aa9ec9f..3832be6ed2 100644 --- a/libraries/ui/src/VirtualPadManager.h +++ b/libraries/ui/src/VirtualPadManager.h @@ -46,6 +46,8 @@ namespace VirtualPad { void setExtraBottomMargin(int margin); glm::vec2 getJumpButtonPosition(); void setJumpButtonPosition(glm::vec2 point); + glm::vec2 getRbButtonPosition(); + void setRbButtonPosition(glm::vec2 point); void requestHapticFeedback(int duration); static const float DPI; @@ -65,6 +67,7 @@ namespace VirtualPad { bool _enabled {true}; bool _hidden; glm::vec2 _jumpButtonPosition; + glm::vec2 _rbButtonPosition; int _extraBottomMargin {0}; }; } diff --git a/scripts/+android/defaultScripts.js b/scripts/+android/defaultScripts.js index 8950af808d..fbd03352de 100644 --- a/scripts/+android/defaultScripts.js +++ b/scripts/+android/defaultScripts.js @@ -16,7 +16,8 @@ var DEFAULT_SCRIPTS_COMBINED = [ "system/+android/touchscreenvirtualpad.js", "system/+android/actionbar.js", "system/+android/audio.js" , - "system/+android/modes.js"/*, + "system/+android/modes.js", + "system/makeUserConnection.js"/*, "system/away.js", "system/controllers/controllerDisplayManager.js", "system/controllers/handControllerGrabAndroid.js", From a6c1f3e8ffdc36c9591dac7651303de446bdd86a Mon Sep 17 00:00:00 2001 From: Cristian Luis Duarte Date: Fri, 31 Aug 2018 23:02:38 -0300 Subject: [PATCH 002/436] Android - Handshake - Generic button manager + RB using it --- .../TouchscreenVirtualPadDevice.cpp | 220 ++++++++++++++---- .../TouchscreenVirtualPadDevice.h | 63 ++++- 2 files changed, 226 insertions(+), 57 deletions(-) diff --git a/libraries/input-plugins/src/input-plugins/TouchscreenVirtualPadDevice.cpp b/libraries/input-plugins/src/input-plugins/TouchscreenVirtualPadDevice.cpp index 48d2555626..eeaa463159 100644 --- a/libraries/input-plugins/src/input-plugins/TouchscreenVirtualPadDevice.cpp +++ b/libraries/input-plugins/src/input-plugins/TouchscreenVirtualPadDevice.cpp @@ -96,6 +96,13 @@ void TouchscreenVirtualPadDevice::setupControlsPositions(VirtualPad::Manager& vi // RB button (use same size as jump) _rbButtonPosition = glm::vec2( eventScreen->availableSize().width() - rightMargin - jumpBtnPixelSize, eventScreen->availableSize().height() - 2 * bottomMargin - 3 * _rbButtonRadius - _extraBottomMargin); virtualPadManager.setRbButtonPosition(_rbButtonPosition); + + // Avoid generating buttons in portrait mode + if ( eventScreen->availableSize().width() > eventScreen->availableSize().height() && _buttonsManager.buttonsCount() == 0) { + //_buttonsManager.addButton(TouchscreenButton(JUMP_BUTTON_PRESS, JUMP, _jumpButtonRadius, _jumpButtonPosition, _inputDevice )); + _buttonsManager.addButton(TouchscreenButton(RB, RB_BUTTON, _rbButtonRadius, _rbButtonPosition, _inputDevice )); + } + } float clip(float n, float lower, float upper) { @@ -241,7 +248,7 @@ void TouchscreenVirtualPadDevice::touchEndEvent(const QTouchEvent* event) { moveTouchEnd(); viewTouchEnd(); jumpTouchEnd(); - rbTouchEnd(); + _buttonsManager.endTouchForAll(); return; } // touch end here is a big reset -> resets both pads @@ -251,7 +258,7 @@ void TouchscreenVirtualPadDevice::touchEndEvent(const QTouchEvent* event) { moveTouchEnd(); viewTouchEnd(); jumpTouchEnd(); - rbTouchEnd(); + _buttonsManager.endTouchForAll(); _inputDevice->_axisStateMap.clear(); _inputDevice->_buttonPressedMap.clear(); } @@ -288,13 +295,14 @@ void TouchscreenVirtualPadDevice::touchUpdateEvent(const QTouchEvent* event) { bool moveTouchFound = false; bool viewTouchFound = false; bool jumpTouchFound = false; - bool rbTouchFound = false; int idxMoveStartingPointCandidate = -1; int idxViewStartingPointCandidate = -1; int idxJumpStartingPointCandidate = -1; int idxRbStartingPointCandidate = -1; + _buttonsManager.resetEventValues(); + glm::vec2 thisPoint; int thisPointId; std::map unusedTouchesInEvent; @@ -325,10 +333,7 @@ void TouchscreenVirtualPadDevice::touchUpdateEvent(const QTouchEvent* event) { continue; } - if (!rbTouchFound && _rbHasValidTouch && _rbCurrentTouchId == thisPointId) { - // valid if it's an ongoing touch - rbTouchFound = true; - rbTouchUpdate(thisPoint); + if (_buttonsManager.processOngoingTouch(thisPoint, thisPointId)) { continue; } @@ -350,9 +355,7 @@ void TouchscreenVirtualPadDevice::touchUpdateEvent(const QTouchEvent* event) { continue; } - if (!rbTouchFound && idxRbStartingPointCandidate == -1 && rbTouchBeginIsValid(thisPoint) && - (!_unusedTouches.count(thisPointId) || _unusedTouches[thisPointId] == RB_BUTTON )) { - idxRbStartingPointCandidate = i; + if (_buttonsManager.findStartingTouchPointCandidate(thisPoint, thisPointId, i, _unusedTouches)) { continue; } @@ -362,8 +365,8 @@ void TouchscreenVirtualPadDevice::touchUpdateEvent(const QTouchEvent* event) { unusedTouchesInEvent[thisPointId] = JUMP; } else if (viewTouchBeginIsValid(thisPoint)) { unusedTouchesInEvent[thisPointId] = VIEW; - } else if (rbTouchBeginIsValid(thisPoint)) { - unusedTouchesInEvent[thisPointId] = RB_BUTTON; + } else { + _buttonsManager.saveUnusedTouches(unusedTouchesInEvent, thisPoint, thisPointId); } } @@ -405,24 +408,13 @@ void TouchscreenVirtualPadDevice::touchUpdateEvent(const QTouchEvent* event) { } } } - if (!rbTouchFound) { - if (idxRbStartingPointCandidate != -1) { - _rbCurrentTouchId = tPoints[idxRbStartingPointCandidate].id(); - _unusedTouches.erase(_rbCurrentTouchId); - thisPoint.x = tPoints[idxRbStartingPointCandidate].pos().x(); - thisPoint.y = tPoints[idxRbStartingPointCandidate].pos().y(); - rbTouchBegin(thisPoint); - } else { - if (_rbHasValidTouch) { - rbTouchEnd(); - } - } - } + + _buttonsManager.processBeginOrEnd(thisPoint, tPoints, _unusedTouches); } bool TouchscreenVirtualPadDevice::viewTouchBeginIsValid(glm::vec2 touchPoint) { - return !moveTouchBeginIsValid(touchPoint) && !jumpTouchBeginIsValid(touchPoint) && !rbTouchBeginIsValid(touchPoint); + return !moveTouchBeginIsValid(touchPoint) && !jumpTouchBeginIsValid(touchPoint) && _buttonsManager.touchBeginInvalidForAllButtons(touchPoint); } bool TouchscreenVirtualPadDevice::moveTouchBeginIsValid(glm::vec2 touchPoint) { @@ -459,29 +451,6 @@ void TouchscreenVirtualPadDevice::jumpTouchEnd() { } } -bool TouchscreenVirtualPadDevice::rbTouchBeginIsValid(glm::vec2 touchPoint) { - return glm::distance2(touchPoint, _rbButtonPosition) < _rbButtonRadius * _rbButtonRadius; -} - -void TouchscreenVirtualPadDevice::rbTouchBegin(glm::vec2 touchPoint) { - auto& virtualPadManager = VirtualPad::Manager::instance(); - if (virtualPadManager.isEnabled() && !virtualPadManager.isHidden()) { - _rbHasValidTouch = true; - - _inputDevice->_buttonPressedMap.insert(TouchButtonChannel::RB); - } -} - -void TouchscreenVirtualPadDevice::rbTouchUpdate(glm::vec2 touchPoint) {} - -void TouchscreenVirtualPadDevice::rbTouchEnd() { - if (_rbHasValidTouch) { - _rbHasValidTouch = false; - - _inputDevice->_buttonPressedMap.erase(TouchButtonChannel::RB); - } -} - void TouchscreenVirtualPadDevice::moveTouchBegin(glm::vec2 touchPoint) { auto& virtualPadManager = VirtualPad::Manager::instance(); if (virtualPadManager.isEnabled() && !virtualPadManager.isHidden()) { @@ -566,3 +535,156 @@ QString TouchscreenVirtualPadDevice::InputDevice::getDefaultMappingConfig() cons static const QString MAPPING_JSON = PathUtils::resourcesPath() + "/controllers/touchscreenvirtualpad.json"; return MAPPING_JSON; } + +TouchscreenVirtualPadDevice::TouchscreenButton::TouchscreenButton( + TouchscreenVirtualPadDevice::TouchButtonChannel channelIn, + TouchscreenVirtualPadDevice::TouchType touchTypeIn, float buttonRadiusIn, + glm::vec2 buttonPositionIn, std::shared_ptr inputDeviceIn) : + channel(channelIn), + touchType(touchTypeIn), + buttonRadius(buttonRadiusIn), + buttonPosition(buttonPositionIn), + _inputDevice(inputDeviceIn) +{ +} + +void TouchscreenVirtualPadDevice::TouchscreenButton::touchBegin(glm::vec2 touchPoint) { + auto& virtualPadManager = VirtualPad::Manager::instance(); + if (virtualPadManager.isEnabled() && !virtualPadManager.isHidden()) { + hasValidTouch = true; + + _inputDevice->_buttonPressedMap.insert(channel); + } +} + +void TouchscreenVirtualPadDevice::TouchscreenButton::touchUpdate(glm::vec2 touchPoint) { + +} + +void TouchscreenVirtualPadDevice::TouchscreenButton::touchEnd() { + if (hasValidTouch) { + hasValidTouch = false; + + _inputDevice->_buttonPressedMap.erase(channel); + } +} + +bool TouchscreenVirtualPadDevice::TouchscreenButton::touchBeginIsValid(glm::vec2 touchPoint) { + qDebug() << "[HANDSHAKE] isValid " << (glm::distance2(touchPoint, buttonPosition) < buttonRadius * buttonRadius) << + " dist2 " << glm::distance2(touchPoint, buttonPosition) << " vs " << buttonRadius * buttonRadius; + return glm::distance2(touchPoint, buttonPosition) < buttonRadius * buttonRadius; +} + +void TouchscreenVirtualPadDevice::TouchscreenButton::resetEventValues() { + _candidatePointIdx = -1; + _found = false; +} + +TouchscreenVirtualPadDevice::TouchscreenButtonsManager::TouchscreenButtonsManager() {} + +void TouchscreenVirtualPadDevice::TouchscreenButtonsManager::addButton( + TouchscreenVirtualPadDevice::TouchscreenButton button) { + buttons.push_back(button); +} + +void TouchscreenVirtualPadDevice::TouchscreenButtonsManager::resetEventValues() { + for(int i = 0; i < buttons.size(); i++) { + TouchscreenButton &button = buttons[i]; + button.resetEventValues(); + } +} + +bool +TouchscreenVirtualPadDevice::TouchscreenButtonsManager::processOngoingTouch(glm::vec2 thisPoint, + int thisPointId) { + for(int i = 0; i < buttons.size(); i++) { + TouchscreenButton &button = buttons[i]; + + if (!button._found && button.hasValidTouch && button.currentTouchId == thisPointId) { + // valid if it's an ongoing touch + button._found = true; + button.touchUpdate(thisPoint); + return true; + } + } + return false; + +} + +bool TouchscreenVirtualPadDevice::TouchscreenButtonsManager::findStartingTouchPointCandidate( + glm::vec2 thisPoint, int thisPointId, int thisPointIdx, std::map &globalUnusedTouches) { + + for(int i = 0; i < buttons.size(); i++) { + TouchscreenButton &button = buttons[i]; + qDebug() << "[HANDSHAKE] !button._found && button._candidatePointIdx == -1 " << (!button._found && button._candidatePointIdx == -1); + qDebug() << "[HANDSHAKE] button.touchBeginIsValid(thisPoint) " << (button.touchBeginIsValid(thisPoint)); + qDebug() << "[HANDSHAKE] !globalUnusedTouches.count(thisPointId) " << (!globalUnusedTouches.count(thisPointId)); + if (globalUnusedTouches.count(thisPointId)) { + qDebug() << "[HANDSHAKE] globalUnusedTouches[thisPointId] == button.touchType " << (globalUnusedTouches[thisPointId] == button.touchType); + } + if (!button._found && button._candidatePointIdx == -1 && button.touchBeginIsValid(thisPoint)) { + qDebug() << "[HANDSHAKE] CHECK AGAIN !globalUnusedTouches.count(thisPointId) " << (!globalUnusedTouches.count(thisPointId)); + qDebug() << "[HANDSHAKE] CHECK AGAIN double-check !globalUnusedTouches.count(thisPointId) " << (!globalUnusedTouches.count(thisPointId)); + if (!globalUnusedTouches.count(thisPointId) ) { + button._candidatePointIdx = thisPointIdx; + return true; + } else if (globalUnusedTouches[thisPointId] == button.touchType) { + button._candidatePointIdx = thisPointIdx; + return true; + } + } + } + return false; + +} + +void TouchscreenVirtualPadDevice::TouchscreenButtonsManager::saveUnusedTouches( + std::map &unusedTouchesInEvent, glm::vec2 thisPoint, + int thisPointId) { + for(int i = 0; i < buttons.size(); i++) { + TouchscreenButton &button = buttons[i]; + if (button.touchBeginIsValid(thisPoint)) { + unusedTouchesInEvent[thisPointId] = button.touchType; + return; + } + } + +} + +void TouchscreenVirtualPadDevice::TouchscreenButtonsManager::processBeginOrEnd( + glm::vec2 thisPoint, const QList &tPoints, std::map globalUnusedTouches) { + for(int i = 0; i < buttons.size(); i++) { + TouchscreenButton &button = buttons[i]; + if (!button._found) { + if (button._candidatePointIdx != -1) { + button.currentTouchId = tPoints[button._candidatePointIdx].id(); + globalUnusedTouches.erase(button.currentTouchId); + thisPoint.x = tPoints[button._candidatePointIdx].pos().x(); + thisPoint.y = tPoints[button._candidatePointIdx].pos().y(); + button.touchBegin(thisPoint); + } else { + if (button.hasValidTouch) { + button.touchEnd(); + } + } + } + } + +} + +void TouchscreenVirtualPadDevice::TouchscreenButtonsManager::endTouchForAll() { + for(int i = 0; i < buttons.size(); i++) { + TouchscreenButton &button = buttons[i]; + button.touchEnd(); + } +} + +bool TouchscreenVirtualPadDevice::TouchscreenButtonsManager::touchBeginInvalidForAllButtons(glm::vec2 touchPoint) { + for(int i = 0; i < buttons.size(); i++) { + TouchscreenButton &button = buttons[i]; + if (button.touchBeginIsValid(touchPoint)) { + return false; + } + } + return true; +} diff --git a/libraries/input-plugins/src/input-plugins/TouchscreenVirtualPadDevice.h b/libraries/input-plugins/src/input-plugins/TouchscreenVirtualPadDevice.h index 9ee3568be3..6ce4a1d412 100644 --- a/libraries/input-plugins/src/input-plugins/TouchscreenVirtualPadDevice.h +++ b/libraries/input-plugins/src/input-plugins/TouchscreenVirtualPadDevice.h @@ -15,6 +15,7 @@ #include #include "InputPlugin.h" #include +#include #include "VirtualPadManager.h" class QTouchEvent; @@ -87,6 +88,58 @@ protected: RB_BUTTON }; + class TouchscreenButton { + public: + + TouchscreenButton() {}; + + TouchscreenButton(TouchButtonChannel channelIn, TouchType touchTypeIn, float buttonRadiusIn, glm::vec2 buttonPositionIn, + std::shared_ptr inputDeviceIn); + + void touchBegin(glm::vec2 touchPoint); + void touchUpdate(glm::vec2 touchPoint); + void touchEnd(); + bool touchBeginIsValid(glm::vec2 touchPoint); + + bool hasValidTouch { false }; + int currentTouchId; + + // per event tmp values + int _candidatePointIdx { -1 }; + bool _found { false }; + void resetEventValues(); + + glm::vec2 buttonPosition; + float buttonRadius; + TouchType touchType; + TouchButtonChannel channel; + + std::shared_ptr _inputDevice; + + }; + + class TouchscreenButtonsManager { + public: + + TouchscreenButtonsManager(); + + QVector buttons; + + void addButton(TouchscreenButton button); + int buttonsCount() { + return buttons.size(); + } + + void resetEventValues(); + bool processOngoingTouch(glm::vec2 thisPoint, int thisPointId); + bool findStartingTouchPointCandidate(glm::vec2 thisPoint, int thisPointId, int thisPointIdx, std::map &globalUnusedTouches); + void saveUnusedTouches(std::map &unusedTouchesInEvent, glm::vec2 thisPoint, int thisPointId); + void processBeginOrEnd(glm::vec2 thisPoint, const QList& tPoints, std::map globalUnusedTouches); + + void endTouchForAll(); + bool touchBeginInvalidForAllButtons(glm::vec2 touchPoint); + }; + float _lastPinchScale; float _pinchScale; float _screenDPI; @@ -106,9 +159,6 @@ protected: bool _jumpHasValidTouch; int _jumpCurrentTouchId; - bool _rbHasValidTouch; - int _rbCurrentTouchId; - std::map _unusedTouches; int _touchPointCount; @@ -127,6 +177,8 @@ protected: glm::vec2 _rbButtonPosition; float _rbButtonRadius; + TouchscreenButtonsManager _buttonsManager; + void moveTouchBegin(glm::vec2 touchPoint); void moveTouchUpdate(glm::vec2 touchPoint); void moveTouchEnd(); @@ -142,11 +194,6 @@ protected: void jumpTouchEnd(); bool jumpTouchBeginIsValid(glm::vec2 touchPoint); - void rbTouchBegin(glm::vec2 touchPoint); - void rbTouchUpdate(glm::vec2 touchPoint); - void rbTouchEnd(); - bool rbTouchBeginIsValid(glm::vec2 touchPoint); - void setupControlsPositions(VirtualPad::Manager& virtualPadManager, bool force = false); void processInputDeviceForMove(VirtualPad::Manager& virtualPadManager); From 2e43912e923c807c26b094dd0cde6fedd619a91e Mon Sep 17 00:00:00 2001 From: Cristian Luis Duarte Date: Sat, 1 Sep 2018 02:31:36 -0300 Subject: [PATCH 003/436] Android - Handshake - Make the Jump button use buttonsManager code --- .../TouchscreenVirtualPadDevice.cpp | 66 ++----------------- .../TouchscreenVirtualPadDevice.h | 8 --- 2 files changed, 5 insertions(+), 69 deletions(-) diff --git a/libraries/input-plugins/src/input-plugins/TouchscreenVirtualPadDevice.cpp b/libraries/input-plugins/src/input-plugins/TouchscreenVirtualPadDevice.cpp index eeaa463159..aa4955427b 100644 --- a/libraries/input-plugins/src/input-plugins/TouchscreenVirtualPadDevice.cpp +++ b/libraries/input-plugins/src/input-plugins/TouchscreenVirtualPadDevice.cpp @@ -91,16 +91,17 @@ void TouchscreenVirtualPadDevice::setupControlsPositions(VirtualPad::Manager& vi float rightMargin = _screenDPI * VirtualPad::Manager::JUMP_BTN_RIGHT_MARGIN_PIXELS / VirtualPad::Manager::DPI; float bottomMargin = _screenDPI * VirtualPad::Manager::JUMP_BTN_BOTTOM_MARGIN_PIXELS/ VirtualPad::Manager::DPI; _jumpButtonPosition = glm::vec2( eventScreen->availableSize().width() - rightMargin - jumpBtnPixelSize, eventScreen->availableSize().height() - bottomMargin - _jumpButtonRadius - _extraBottomMargin); - virtualPadManager.setJumpButtonPosition(_jumpButtonPosition); // RB button (use same size as jump) _rbButtonPosition = glm::vec2( eventScreen->availableSize().width() - rightMargin - jumpBtnPixelSize, eventScreen->availableSize().height() - 2 * bottomMargin - 3 * _rbButtonRadius - _extraBottomMargin); - virtualPadManager.setRbButtonPosition(_rbButtonPosition); // Avoid generating buttons in portrait mode if ( eventScreen->availableSize().width() > eventScreen->availableSize().height() && _buttonsManager.buttonsCount() == 0) { - //_buttonsManager.addButton(TouchscreenButton(JUMP_BUTTON_PRESS, JUMP, _jumpButtonRadius, _jumpButtonPosition, _inputDevice )); + _buttonsManager.addButton(TouchscreenButton(JUMP_BUTTON_PRESS, JUMP, _jumpButtonRadius, _jumpButtonPosition, _inputDevice )); _buttonsManager.addButton(TouchscreenButton(RB, RB_BUTTON, _rbButtonRadius, _rbButtonPosition, _inputDevice )); + + virtualPadManager.setJumpButtonPosition(_jumpButtonPosition); + virtualPadManager.setRbButtonPosition(_rbButtonPosition); } } @@ -247,7 +248,6 @@ void TouchscreenVirtualPadDevice::touchEndEvent(const QTouchEvent* event) { if (!virtualPadManager.isEnabled() && !virtualPadManager.isHidden()) { moveTouchEnd(); viewTouchEnd(); - jumpTouchEnd(); _buttonsManager.endTouchForAll(); return; } @@ -257,7 +257,6 @@ void TouchscreenVirtualPadDevice::touchEndEvent(const QTouchEvent* event) { debugPoints(event, " END ----------------"); moveTouchEnd(); viewTouchEnd(); - jumpTouchEnd(); _buttonsManager.endTouchForAll(); _inputDevice->_axisStateMap.clear(); _inputDevice->_buttonPressedMap.clear(); @@ -294,12 +293,9 @@ void TouchscreenVirtualPadDevice::touchUpdateEvent(const QTouchEvent* event) { const QList& tPoints = event->touchPoints(); bool moveTouchFound = false; bool viewTouchFound = false; - bool jumpTouchFound = false; int idxMoveStartingPointCandidate = -1; int idxViewStartingPointCandidate = -1; - int idxJumpStartingPointCandidate = -1; - int idxRbStartingPointCandidate = -1; _buttonsManager.resetEventValues(); @@ -326,13 +322,6 @@ void TouchscreenVirtualPadDevice::touchUpdateEvent(const QTouchEvent* event) { continue; } - if (!jumpTouchFound && _jumpHasValidTouch && _jumpCurrentTouchId == thisPointId) { - // valid if it's an ongoing touch - jumpTouchFound = true; - jumpTouchUpdate(thisPoint); - continue; - } - if (_buttonsManager.processOngoingTouch(thisPoint, thisPointId)) { continue; } @@ -349,20 +338,12 @@ void TouchscreenVirtualPadDevice::touchUpdateEvent(const QTouchEvent* event) { continue; } - if (!jumpTouchFound && idxJumpStartingPointCandidate == -1 && jumpTouchBeginIsValid(thisPoint) && - (!_unusedTouches.count(thisPointId) || _unusedTouches[thisPointId] == JUMP )) { - idxJumpStartingPointCandidate = i; - continue; - } - if (_buttonsManager.findStartingTouchPointCandidate(thisPoint, thisPointId, i, _unusedTouches)) { continue; } if (moveTouchBeginIsValid(thisPoint)) { unusedTouchesInEvent[thisPointId] = MOVE; - } else if (jumpTouchBeginIsValid(thisPoint)) { - unusedTouchesInEvent[thisPointId] = JUMP; } else if (viewTouchBeginIsValid(thisPoint)) { unusedTouchesInEvent[thisPointId] = VIEW; } else { @@ -395,26 +376,13 @@ void TouchscreenVirtualPadDevice::touchUpdateEvent(const QTouchEvent* event) { viewTouchEnd(); } } - if (!jumpTouchFound) { - if (idxJumpStartingPointCandidate != -1) { - _jumpCurrentTouchId = tPoints[idxJumpStartingPointCandidate].id(); - _unusedTouches.erase(_jumpCurrentTouchId); - thisPoint.x = tPoints[idxJumpStartingPointCandidate].pos().x(); - thisPoint.y = tPoints[idxJumpStartingPointCandidate].pos().y(); - jumpTouchBegin(thisPoint); - } else { - if (_jumpHasValidTouch) { - jumpTouchEnd(); - } - } - } _buttonsManager.processBeginOrEnd(thisPoint, tPoints, _unusedTouches); } bool TouchscreenVirtualPadDevice::viewTouchBeginIsValid(glm::vec2 touchPoint) { - return !moveTouchBeginIsValid(touchPoint) && !jumpTouchBeginIsValid(touchPoint) && _buttonsManager.touchBeginInvalidForAllButtons(touchPoint); + return !moveTouchBeginIsValid(touchPoint) && _buttonsManager.touchBeginInvalidForAllButtons(touchPoint); } bool TouchscreenVirtualPadDevice::moveTouchBeginIsValid(glm::vec2 touchPoint) { @@ -427,30 +395,6 @@ bool TouchscreenVirtualPadDevice::moveTouchBeginIsValid(glm::vec2 touchPoint) { } } -bool TouchscreenVirtualPadDevice::jumpTouchBeginIsValid(glm::vec2 touchPoint) { - // position of button and boundaries - return glm::distance2(touchPoint, _jumpButtonPosition) < _jumpButtonRadius * _jumpButtonRadius; -} - -void TouchscreenVirtualPadDevice::jumpTouchBegin(glm::vec2 touchPoint) { - auto& virtualPadManager = VirtualPad::Manager::instance(); - if (virtualPadManager.isEnabled() && !virtualPadManager.isHidden()) { - _jumpHasValidTouch = true; - - _inputDevice->_buttonPressedMap.insert(TouchButtonChannel::JUMP_BUTTON_PRESS); - } -} - -void TouchscreenVirtualPadDevice::jumpTouchUpdate(glm::vec2 touchPoint) {} - -void TouchscreenVirtualPadDevice::jumpTouchEnd() { - if (_jumpHasValidTouch) { - _jumpHasValidTouch = false; - - _inputDevice->_buttonPressedMap.erase(TouchButtonChannel::JUMP_BUTTON_PRESS); - } -} - void TouchscreenVirtualPadDevice::moveTouchBegin(glm::vec2 touchPoint) { auto& virtualPadManager = VirtualPad::Manager::instance(); if (virtualPadManager.isEnabled() && !virtualPadManager.isHidden()) { diff --git a/libraries/input-plugins/src/input-plugins/TouchscreenVirtualPadDevice.h b/libraries/input-plugins/src/input-plugins/TouchscreenVirtualPadDevice.h index 6ce4a1d412..4f8d03fb5f 100644 --- a/libraries/input-plugins/src/input-plugins/TouchscreenVirtualPadDevice.h +++ b/libraries/input-plugins/src/input-plugins/TouchscreenVirtualPadDevice.h @@ -156,9 +156,6 @@ protected: glm::vec2 _viewCurrentTouchPoint; int _viewCurrentTouchId; - bool _jumpHasValidTouch; - int _jumpCurrentTouchId; - std::map _unusedTouches; int _touchPointCount; @@ -189,11 +186,6 @@ protected: void viewTouchEnd(); bool viewTouchBeginIsValid(glm::vec2 touchPoint); - void jumpTouchBegin(glm::vec2 touchPoint); - void jumpTouchUpdate(glm::vec2 touchPoint); - void jumpTouchEnd(); - bool jumpTouchBeginIsValid(glm::vec2 touchPoint); - void setupControlsPositions(VirtualPad::Manager& virtualPadManager, bool force = false); void processInputDeviceForMove(VirtualPad::Manager& virtualPadManager); From 1891b0fd8123ebed2c65c4925cab5fe367bbde8b Mon Sep 17 00:00:00 2001 From: Cristian Luis Duarte Date: Mon, 3 Sep 2018 19:19:55 -0300 Subject: [PATCH 004/436] Android - Virtual Pad - Refactor in Basic2D..Plugin code for multiple buttons --- .../Basic2DWindowOpenGLDisplayPlugin.cpp | 116 +++++++++--------- .../Basic2DWindowOpenGLDisplayPlugin.h | 19 +++ .../TouchscreenVirtualPadDevice.cpp | 33 ++--- .../TouchscreenVirtualPadDevice.h | 6 +- libraries/ui/src/VirtualPadManager.cpp | 27 ++-- libraries/ui/src/VirtualPadManager.h | 14 ++- 6 files changed, 107 insertions(+), 108 deletions(-) diff --git a/libraries/display-plugins/src/display-plugins/Basic2DWindowOpenGLDisplayPlugin.cpp b/libraries/display-plugins/src/display-plugins/Basic2DWindowOpenGLDisplayPlugin.cpp index ea5e854712..928ccc5d78 100644 --- a/libraries/display-plugins/src/display-plugins/Basic2DWindowOpenGLDisplayPlugin.cpp +++ b/libraries/display-plugins/src/display-plugins/Basic2DWindowOpenGLDisplayPlugin.cpp @@ -74,55 +74,15 @@ void Basic2DWindowOpenGLDisplayPlugin::customizeContext() { } } - - _virtualPadJumpBtnPixelSize = dpi * VirtualPad::Manager::JUMP_BTN_FULL_PIXELS / VirtualPad::Manager::DPI; - if (!_virtualPadJumpBtnTexture) { - auto iconPath = PathUtils::resourcesPath() + "images/fly.png"; - auto image = QImage(iconPath); - if (image.format() != QImage::Format_ARGB32) { - image = image.convertToFormat(QImage::Format_ARGB32); - } - if ((image.width() > 0) && (image.height() > 0)) { - image = image.scaled(_virtualPadJumpBtnPixelSize, _virtualPadJumpBtnPixelSize, Qt::KeepAspectRatio); - image = image.mirrored(); - - _virtualPadJumpBtnTexture = gpu::Texture::createStrict( - gpu::Element(gpu::VEC4, gpu::NUINT8, gpu::RGBA), - image.width(), image.height(), - gpu::Texture::MAX_NUM_MIPS, - gpu::Sampler(gpu::Sampler::FILTER_MIN_MAG_MIP_LINEAR)); - _virtualPadJumpBtnTexture->setSource("virtualPad jump"); - auto usage = gpu::Texture::Usage::Builder().withColor().withAlpha(); - _virtualPadJumpBtnTexture->setUsage(usage.build()); - _virtualPadJumpBtnTexture->setStoredMipFormat(gpu::Element(gpu::VEC4, gpu::NUINT8, gpu::RGBA)); - _virtualPadJumpBtnTexture->assignStoredMip(0, image.byteCount(), image.constBits()); - _virtualPadJumpBtnTexture->setAutoGenerateMips(true); - } - } - - _virtualPadRbBtnPixelSize = dpi * VirtualPad::Manager::JUMP_BTN_FULL_PIXELS / VirtualPad::Manager::DPI; - if (!_virtualPadRbBtnTexture) { - auto iconPath = PathUtils::resourcesPath() + "images/handshake.png"; - auto image = QImage(iconPath); - if (image.format() != QImage::Format_ARGB32) { - image = image.convertToFormat(QImage::Format_ARGB32); - } - if ((image.width() > 0) && (image.height() > 0)) { - image = image.scaled(_virtualPadRbBtnPixelSize, _virtualPadRbBtnPixelSize, Qt::KeepAspectRatio); - image = image.mirrored(); - - _virtualPadRbBtnTexture = gpu::Texture::createStrict( - gpu::Element(gpu::VEC4, gpu::NUINT8, gpu::RGBA), - image.width(), image.height(), - gpu::Texture::MAX_NUM_MIPS, - gpu::Sampler(gpu::Sampler::FILTER_MIN_MAG_MIP_LINEAR)); - _virtualPadRbBtnTexture->setSource("virtualPad handshake"); - auto usage = gpu::Texture::Usage::Builder().withColor().withAlpha(); - _virtualPadRbBtnTexture->setUsage(usage.build()); - _virtualPadRbBtnTexture->setStoredMipFormat(gpu::Element(gpu::VEC4, gpu::NUINT8, gpu::RGBA)); - _virtualPadRbBtnTexture->assignStoredMip(0, image.byteCount(), image.constBits()); - _virtualPadRbBtnTexture->setAutoGenerateMips(true); - } + if (_virtualPadButtons.size() == 0) { + _virtualPadButtons.append(VirtualPadButton( + dpi * VirtualPad::Manager::JUMP_BTN_FULL_PIXELS / VirtualPad::Manager::DPI, + PathUtils::resourcesPath() + "images/fly.png", + VirtualPad::Manager::Button::JUMP)); + _virtualPadButtons.append(VirtualPadButton( + dpi * VirtualPad::Manager::JUMP_BTN_FULL_PIXELS / VirtualPad::Manager::DPI, + PathUtils::resourcesPath() + "images/handshake.png", + VirtualPad::Manager::Button::HANDSHAKE)); } #endif Parent::customizeContext(); @@ -158,10 +118,6 @@ void Basic2DWindowOpenGLDisplayPlugin::compositeExtra() { _virtualPadPixelSize, _virtualPadPixelSize); auto stickTransform = DependencyManager::get()->getPoint2DTransform(virtualPadManager.getLeftVirtualPad()->getCurrentTouch(), _virtualPadPixelSize, _virtualPadPixelSize); - auto jumpTransform = DependencyManager::get()->getPoint2DTransform(virtualPadManager.getJumpButtonPosition(), - _virtualPadJumpBtnPixelSize, _virtualPadJumpBtnPixelSize); - auto rbTransform = DependencyManager::get()->getPoint2DTransform(virtualPadManager.getRbButtonPosition(), - _virtualPadRbBtnPixelSize, _virtualPadRbBtnPixelSize); render([&](gpu::Batch& batch) { batch.enableStereo(false); @@ -178,13 +134,9 @@ void Basic2DWindowOpenGLDisplayPlugin::compositeExtra() { batch.setModelTransform(stickTransform); batch.draw(gpu::TRIANGLE_STRIP, 4); - batch.setResourceTexture(0, _virtualPadJumpBtnTexture); - batch.setModelTransform(jumpTransform); - batch.draw(gpu::TRIANGLE_STRIP, 4); - - batch.setResourceTexture(0, _virtualPadRbBtnTexture); - batch.setModelTransform(rbTransform); - batch.draw(gpu::TRIANGLE_STRIP, 4); + foreach(VirtualPadButton virtualPadButton, _virtualPadButtons) { + virtualPadButton.draw(batch, virtualPadManager.getButtonPosition(virtualPadButton._button)); + } }); } #endif @@ -209,3 +161,47 @@ bool Basic2DWindowOpenGLDisplayPlugin::isThrottled() const { QScreen* Basic2DWindowOpenGLDisplayPlugin::getFullscreenTarget() { return qApp->primaryScreen(); } + +#if defined(Q_OS_ANDROID) + +Basic2DWindowOpenGLDisplayPlugin::VirtualPadButton::VirtualPadButton(qreal pixelSize, + QString iconPath, + VirtualPad::Manager::Button button) : + _pixelSize { pixelSize }, + _button { button } +{ + if (!_texture) { + auto image = QImage(iconPath); + if (image.format() != QImage::Format_ARGB32) { + image = image.convertToFormat(QImage::Format_ARGB32); + } + if ((image.width() > 0) && (image.height() > 0)) { + image = image.scaled(_pixelSize, _pixelSize, Qt::KeepAspectRatio); + image = image.mirrored(); + + _texture = gpu::Texture::createStrict( + gpu::Element(gpu::VEC4, gpu::NUINT8, gpu::RGBA), + image.width(), image.height(), + gpu::Texture::MAX_NUM_MIPS, + gpu::Sampler(gpu::Sampler::FILTER_MIN_MAG_MIP_LINEAR)); + _texture->setSource(iconPath.toStdString()); + auto usage = gpu::Texture::Usage::Builder().withColor().withAlpha(); + _texture->setUsage(usage.build()); + _texture->setStoredMipFormat(gpu::Element(gpu::VEC4, gpu::NUINT8, gpu::RGBA)); + _texture->assignStoredMip(0, image.byteCount(), image.constBits()); + _texture->setAutoGenerateMips(true); + } + } +} + +void Basic2DWindowOpenGLDisplayPlugin::VirtualPadButton::draw(gpu::Batch &batch, + glm::vec2 buttonPosition) { + auto transform = DependencyManager::get()->getPoint2DTransform( + buttonPosition, + _pixelSize, _pixelSize); + batch.setResourceTexture(0, _texture); + batch.setModelTransform(transform); + batch.draw(gpu::TRIANGLE_STRIP, 4); +} + +#endif \ No newline at end of file diff --git a/libraries/display-plugins/src/display-plugins/Basic2DWindowOpenGLDisplayPlugin.h b/libraries/display-plugins/src/display-plugins/Basic2DWindowOpenGLDisplayPlugin.h index 955a816799..d6b1242a47 100644 --- a/libraries/display-plugins/src/display-plugins/Basic2DWindowOpenGLDisplayPlugin.h +++ b/libraries/display-plugins/src/display-plugins/Basic2DWindowOpenGLDisplayPlugin.h @@ -9,6 +9,10 @@ #include "OpenGLDisplayPlugin.h" +#if defined(Q_OS_ANDROID) +#include "VirtualPadManager.h" +#endif + const float TARGET_FRAMERATE_Basic2DWindowOpenGL = 60.0f; class QScreen; @@ -52,5 +56,20 @@ private: gpu::TexturePointer _virtualPadRbBtnTexture; qreal _virtualPadRbBtnPixelSize; + + class VirtualPadButton { + public: + + VirtualPadButton() {} + VirtualPadButton(qreal pixelSize, QString iconPath, VirtualPad::Manager::Button button); + + void draw(gpu::Batch& batch, glm::vec2 buttonPosition); + + gpu::TexturePointer _texture; + qreal _pixelSize; + VirtualPad::Manager::Button _button; + }; + QVector _virtualPadButtons; + #endif }; diff --git a/libraries/input-plugins/src/input-plugins/TouchscreenVirtualPadDevice.cpp b/libraries/input-plugins/src/input-plugins/TouchscreenVirtualPadDevice.cpp index aa4955427b..bf9dbb8604 100644 --- a/libraries/input-plugins/src/input-plugins/TouchscreenVirtualPadDevice.cpp +++ b/libraries/input-plugins/src/input-plugins/TouchscreenVirtualPadDevice.cpp @@ -66,8 +66,7 @@ void TouchscreenVirtualPadDevice::resize() { _fixedRadius = _screenDPI * 0.5f * VirtualPad::Manager::BASE_DIAMETER_PIXELS / VirtualPad::Manager::DPI; _fixedRadiusForCalc = _fixedRadius - _screenDPI * VirtualPad::Manager::STICK_RADIUS_PIXELS / VirtualPad::Manager::DPI; - _jumpButtonRadius = _screenDPI * VirtualPad::Manager::JUMP_BTN_TRIMMED_RADIUS_PIXELS / VirtualPad::Manager::DPI; - _rbButtonRadius = _jumpButtonRadius; + _buttonRadius = _screenDPI * VirtualPad::Manager::JUMP_BTN_TRIMMED_RADIUS_PIXELS / VirtualPad::Manager::DPI; } auto& virtualPadManager = VirtualPad::Manager::instance(); @@ -90,18 +89,16 @@ void TouchscreenVirtualPadDevice::setupControlsPositions(VirtualPad::Manager& vi float jumpBtnPixelSize = _screenDPI * VirtualPad::Manager::JUMP_BTN_FULL_PIXELS / VirtualPad::Manager::DPI; float rightMargin = _screenDPI * VirtualPad::Manager::JUMP_BTN_RIGHT_MARGIN_PIXELS / VirtualPad::Manager::DPI; float bottomMargin = _screenDPI * VirtualPad::Manager::JUMP_BTN_BOTTOM_MARGIN_PIXELS/ VirtualPad::Manager::DPI; - _jumpButtonPosition = glm::vec2( eventScreen->availableSize().width() - rightMargin - jumpBtnPixelSize, eventScreen->availableSize().height() - bottomMargin - _jumpButtonRadius - _extraBottomMargin); - - // RB button (use same size as jump) - _rbButtonPosition = glm::vec2( eventScreen->availableSize().width() - rightMargin - jumpBtnPixelSize, eventScreen->availableSize().height() - 2 * bottomMargin - 3 * _rbButtonRadius - _extraBottomMargin); + glm::vec2 jumpButtonPosition = glm::vec2( eventScreen->availableSize().width() - rightMargin - jumpBtnPixelSize, eventScreen->availableSize().height() - bottomMargin - _buttonRadius - _extraBottomMargin); + glm::vec2 rbButtonPosition = glm::vec2( eventScreen->availableSize().width() - rightMargin - jumpBtnPixelSize, eventScreen->availableSize().height() - 2 * bottomMargin - 3 * _buttonRadius - _extraBottomMargin); // Avoid generating buttons in portrait mode if ( eventScreen->availableSize().width() > eventScreen->availableSize().height() && _buttonsManager.buttonsCount() == 0) { - _buttonsManager.addButton(TouchscreenButton(JUMP_BUTTON_PRESS, JUMP, _jumpButtonRadius, _jumpButtonPosition, _inputDevice )); - _buttonsManager.addButton(TouchscreenButton(RB, RB_BUTTON, _rbButtonRadius, _rbButtonPosition, _inputDevice )); + _buttonsManager.addButton(TouchscreenButton(JUMP_BUTTON_PRESS, JUMP, _buttonRadius, jumpButtonPosition, _inputDevice )); + _buttonsManager.addButton(TouchscreenButton(RB, RB_BUTTON, _buttonRadius, rbButtonPosition, _inputDevice )); - virtualPadManager.setJumpButtonPosition(_jumpButtonPosition); - virtualPadManager.setRbButtonPosition(_rbButtonPosition); + virtualPadManager.setButtonPosition(VirtualPad::Manager::Button::JUMP, jumpButtonPosition); + virtualPadManager.setButtonPosition(VirtualPad::Manager::Button::HANDSHAKE, rbButtonPosition); } } @@ -484,10 +481,10 @@ TouchscreenVirtualPadDevice::TouchscreenButton::TouchscreenButton( TouchscreenVirtualPadDevice::TouchButtonChannel channelIn, TouchscreenVirtualPadDevice::TouchType touchTypeIn, float buttonRadiusIn, glm::vec2 buttonPositionIn, std::shared_ptr inputDeviceIn) : - channel(channelIn), - touchType(touchTypeIn), - buttonRadius(buttonRadiusIn), buttonPosition(buttonPositionIn), + buttonRadius(buttonRadiusIn), + touchType(touchTypeIn), + channel(channelIn), _inputDevice(inputDeviceIn) { } @@ -514,8 +511,6 @@ void TouchscreenVirtualPadDevice::TouchscreenButton::touchEnd() { } bool TouchscreenVirtualPadDevice::TouchscreenButton::touchBeginIsValid(glm::vec2 touchPoint) { - qDebug() << "[HANDSHAKE] isValid " << (glm::distance2(touchPoint, buttonPosition) < buttonRadius * buttonRadius) << - " dist2 " << glm::distance2(touchPoint, buttonPosition) << " vs " << buttonRadius * buttonRadius; return glm::distance2(touchPoint, buttonPosition) < buttonRadius * buttonRadius; } @@ -560,15 +555,7 @@ bool TouchscreenVirtualPadDevice::TouchscreenButtonsManager::findStartingTouchPo for(int i = 0; i < buttons.size(); i++) { TouchscreenButton &button = buttons[i]; - qDebug() << "[HANDSHAKE] !button._found && button._candidatePointIdx == -1 " << (!button._found && button._candidatePointIdx == -1); - qDebug() << "[HANDSHAKE] button.touchBeginIsValid(thisPoint) " << (button.touchBeginIsValid(thisPoint)); - qDebug() << "[HANDSHAKE] !globalUnusedTouches.count(thisPointId) " << (!globalUnusedTouches.count(thisPointId)); - if (globalUnusedTouches.count(thisPointId)) { - qDebug() << "[HANDSHAKE] globalUnusedTouches[thisPointId] == button.touchType " << (globalUnusedTouches[thisPointId] == button.touchType); - } if (!button._found && button._candidatePointIdx == -1 && button.touchBeginIsValid(thisPoint)) { - qDebug() << "[HANDSHAKE] CHECK AGAIN !globalUnusedTouches.count(thisPointId) " << (!globalUnusedTouches.count(thisPointId)); - qDebug() << "[HANDSHAKE] CHECK AGAIN double-check !globalUnusedTouches.count(thisPointId) " << (!globalUnusedTouches.count(thisPointId)); if (!globalUnusedTouches.count(thisPointId) ) { button._candidatePointIdx = thisPointIdx; return true; diff --git a/libraries/input-plugins/src/input-plugins/TouchscreenVirtualPadDevice.h b/libraries/input-plugins/src/input-plugins/TouchscreenVirtualPadDevice.h index 4f8d03fb5f..3c79901483 100644 --- a/libraries/input-plugins/src/input-plugins/TouchscreenVirtualPadDevice.h +++ b/libraries/input-plugins/src/input-plugins/TouchscreenVirtualPadDevice.h @@ -168,11 +168,7 @@ protected: float _fixedRadiusForCalc; int _extraBottomMargin {0}; - glm::vec2 _jumpButtonPosition; - float _jumpButtonRadius; - - glm::vec2 _rbButtonPosition; - float _rbButtonRadius; + float _buttonRadius; TouchscreenButtonsManager _buttonsManager; diff --git a/libraries/ui/src/VirtualPadManager.cpp b/libraries/ui/src/VirtualPadManager.cpp index e2e44fda81..a592549201 100644 --- a/libraries/ui/src/VirtualPadManager.cpp +++ b/libraries/ui/src/VirtualPadManager.cpp @@ -76,22 +76,6 @@ namespace VirtualPad { _extraBottomMargin = margin; } - glm::vec2 Manager::getJumpButtonPosition() { - return _jumpButtonPosition; - } - - void Manager::setJumpButtonPosition(glm::vec2 point) { - _jumpButtonPosition = point; - } - - glm::vec2 Manager::getRbButtonPosition() { - return _rbButtonPosition; - } - - void Manager::setRbButtonPosition(glm::vec2 point) { - _rbButtonPosition = point; - } - void Manager::requestHapticFeedback(int duration) { emit hapticFeedbackRequested(duration); } @@ -100,6 +84,17 @@ namespace VirtualPad { return &_leftVPadInstance; } + glm::vec2 Manager::getButtonPosition(Manager::Button button) { + if (_buttonsPositions.count(button)) { + return _buttonsPositions.at(button); + } + return glm::vec2(); + } + + void Manager::setButtonPosition(Manager::Button button, glm::vec2 point) { + _buttonsPositions[button] = point; + } + bool Instance::isShown() { return _shown; } diff --git a/libraries/ui/src/VirtualPadManager.h b/libraries/ui/src/VirtualPadManager.h index 3832be6ed2..4938c1ceb3 100644 --- a/libraries/ui/src/VirtualPadManager.h +++ b/libraries/ui/src/VirtualPadManager.h @@ -44,10 +44,15 @@ namespace VirtualPad { void hide(bool hide); int extraBottomMargin(); void setExtraBottomMargin(int margin); - glm::vec2 getJumpButtonPosition(); - void setJumpButtonPosition(glm::vec2 point); - glm::vec2 getRbButtonPosition(); - void setRbButtonPosition(glm::vec2 point); + + enum Button { + JUMP, + HANDSHAKE + }; + + glm::vec2 getButtonPosition(Button button); + void setButtonPosition(Button button, glm::vec2 point); + void requestHapticFeedback(int duration); static const float DPI; @@ -69,6 +74,7 @@ namespace VirtualPad { glm::vec2 _jumpButtonPosition; glm::vec2 _rbButtonPosition; int _extraBottomMargin {0}; + std::map _buttonsPositions; }; } From 8839a3b027fcbfaff74656722d7151cd014c5934 Mon Sep 17 00:00:00 2001 From: Cristian Luis Duarte Date: Mon, 3 Sep 2018 20:07:30 -0300 Subject: [PATCH 005/436] Android - Virtual Pad - make jump button references generic --- .../Basic2DWindowOpenGLDisplayPlugin.cpp | 4 ++-- .../TouchscreenVirtualPadDevice.cpp | 16 ++++++++-------- .../input-plugins/TouchscreenVirtualPadDevice.h | 4 ++-- libraries/ui/src/VirtualPadManager.cpp | 8 ++++---- libraries/ui/src/VirtualPadManager.h | 14 ++++++-------- 5 files changed, 22 insertions(+), 24 deletions(-) diff --git a/libraries/display-plugins/src/display-plugins/Basic2DWindowOpenGLDisplayPlugin.cpp b/libraries/display-plugins/src/display-plugins/Basic2DWindowOpenGLDisplayPlugin.cpp index 928ccc5d78..9828a8beda 100644 --- a/libraries/display-plugins/src/display-plugins/Basic2DWindowOpenGLDisplayPlugin.cpp +++ b/libraries/display-plugins/src/display-plugins/Basic2DWindowOpenGLDisplayPlugin.cpp @@ -76,11 +76,11 @@ void Basic2DWindowOpenGLDisplayPlugin::customizeContext() { if (_virtualPadButtons.size() == 0) { _virtualPadButtons.append(VirtualPadButton( - dpi * VirtualPad::Manager::JUMP_BTN_FULL_PIXELS / VirtualPad::Manager::DPI, + dpi * VirtualPad::Manager::BTN_FULL_PIXELS / VirtualPad::Manager::DPI, PathUtils::resourcesPath() + "images/fly.png", VirtualPad::Manager::Button::JUMP)); _virtualPadButtons.append(VirtualPadButton( - dpi * VirtualPad::Manager::JUMP_BTN_FULL_PIXELS / VirtualPad::Manager::DPI, + dpi * VirtualPad::Manager::BTN_FULL_PIXELS / VirtualPad::Manager::DPI, PathUtils::resourcesPath() + "images/handshake.png", VirtualPad::Manager::Button::HANDSHAKE)); } diff --git a/libraries/input-plugins/src/input-plugins/TouchscreenVirtualPadDevice.cpp b/libraries/input-plugins/src/input-plugins/TouchscreenVirtualPadDevice.cpp index bf9dbb8604..d368bf4d61 100644 --- a/libraries/input-plugins/src/input-plugins/TouchscreenVirtualPadDevice.cpp +++ b/libraries/input-plugins/src/input-plugins/TouchscreenVirtualPadDevice.cpp @@ -66,7 +66,7 @@ void TouchscreenVirtualPadDevice::resize() { _fixedRadius = _screenDPI * 0.5f * VirtualPad::Manager::BASE_DIAMETER_PIXELS / VirtualPad::Manager::DPI; _fixedRadiusForCalc = _fixedRadius - _screenDPI * VirtualPad::Manager::STICK_RADIUS_PIXELS / VirtualPad::Manager::DPI; - _buttonRadius = _screenDPI * VirtualPad::Manager::JUMP_BTN_TRIMMED_RADIUS_PIXELS / VirtualPad::Manager::DPI; + _buttonRadius = _screenDPI * VirtualPad::Manager::BTN_TRIMMED_RADIUS_PIXELS / VirtualPad::Manager::DPI; } auto& virtualPadManager = VirtualPad::Manager::instance(); @@ -86,15 +86,15 @@ void TouchscreenVirtualPadDevice::setupControlsPositions(VirtualPad::Manager& vi virtualPadManager.getLeftVirtualPad()->setFirstTouch(_moveRefTouchPoint); // Jump button - float jumpBtnPixelSize = _screenDPI * VirtualPad::Manager::JUMP_BTN_FULL_PIXELS / VirtualPad::Manager::DPI; - float rightMargin = _screenDPI * VirtualPad::Manager::JUMP_BTN_RIGHT_MARGIN_PIXELS / VirtualPad::Manager::DPI; - float bottomMargin = _screenDPI * VirtualPad::Manager::JUMP_BTN_BOTTOM_MARGIN_PIXELS/ VirtualPad::Manager::DPI; - glm::vec2 jumpButtonPosition = glm::vec2( eventScreen->availableSize().width() - rightMargin - jumpBtnPixelSize, eventScreen->availableSize().height() - bottomMargin - _buttonRadius - _extraBottomMargin); - glm::vec2 rbButtonPosition = glm::vec2( eventScreen->availableSize().width() - rightMargin - jumpBtnPixelSize, eventScreen->availableSize().height() - 2 * bottomMargin - 3 * _buttonRadius - _extraBottomMargin); + float btnPixelSize = _screenDPI * VirtualPad::Manager::BTN_FULL_PIXELS / VirtualPad::Manager::DPI; + float rightMargin = _screenDPI * VirtualPad::Manager::BTN_RIGHT_MARGIN_PIXELS / VirtualPad::Manager::DPI; + float bottomMargin = _screenDPI * VirtualPad::Manager::BTN_BOTTOM_MARGIN_PIXELS/ VirtualPad::Manager::DPI; + glm::vec2 jumpButtonPosition = glm::vec2( eventScreen->availableSize().width() - rightMargin - btnPixelSize, eventScreen->availableSize().height() - bottomMargin - _buttonRadius - _extraBottomMargin); + glm::vec2 rbButtonPosition = glm::vec2( eventScreen->availableSize().width() - rightMargin - btnPixelSize, eventScreen->availableSize().height() - 2 * bottomMargin - 3 * _buttonRadius - _extraBottomMargin); // Avoid generating buttons in portrait mode if ( eventScreen->availableSize().width() > eventScreen->availableSize().height() && _buttonsManager.buttonsCount() == 0) { - _buttonsManager.addButton(TouchscreenButton(JUMP_BUTTON_PRESS, JUMP, _buttonRadius, jumpButtonPosition, _inputDevice )); + _buttonsManager.addButton(TouchscreenButton(JUMP, JUMP_BUTTON, _buttonRadius, jumpButtonPosition, _inputDevice )); _buttonsManager.addButton(TouchscreenButton(RB, RB_BUTTON, _buttonRadius, rbButtonPosition, _inputDevice )); virtualPadManager.setButtonPosition(VirtualPad::Manager::Button::JUMP, jumpButtonPosition); @@ -466,7 +466,7 @@ controller::Input::NamedVector TouchscreenVirtualPadDevice::InputDevice::getAvai Input::NamedPair(makeInput(TouchAxisChannel::LY), "LY"), Input::NamedPair(makeInput(TouchAxisChannel::RX), "RX"), Input::NamedPair(makeInput(TouchAxisChannel::RY), "RY"), - Input::NamedPair(makeInput(TouchButtonChannel::JUMP_BUTTON_PRESS), "JUMP_BUTTON_PRESS"), + Input::NamedPair(makeInput(TouchButtonChannel::JUMP), "JUMP_BUTTON_PRESS"), Input::NamedPair(makeInput(TouchButtonChannel::RB), "RB") }; return availableInputs; diff --git a/libraries/input-plugins/src/input-plugins/TouchscreenVirtualPadDevice.h b/libraries/input-plugins/src/input-plugins/TouchscreenVirtualPadDevice.h index 3c79901483..4ef1dbd4f6 100644 --- a/libraries/input-plugins/src/input-plugins/TouchscreenVirtualPadDevice.h +++ b/libraries/input-plugins/src/input-plugins/TouchscreenVirtualPadDevice.h @@ -52,7 +52,7 @@ public: }; enum TouchButtonChannel { - JUMP_BUTTON_PRESS, + JUMP, RB }; @@ -84,7 +84,7 @@ protected: enum TouchType { MOVE = 1, VIEW, - JUMP, + JUMP_BUTTON, RB_BUTTON }; diff --git a/libraries/ui/src/VirtualPadManager.cpp b/libraries/ui/src/VirtualPadManager.cpp index a592549201..bf325a0bd6 100644 --- a/libraries/ui/src/VirtualPadManager.cpp +++ b/libraries/ui/src/VirtualPadManager.cpp @@ -38,10 +38,10 @@ namespace VirtualPad { const float Manager::BASE_DIAMETER_PIXELS = 512.0f; const float Manager::BASE_MARGIN_PIXELS = 59.0f; const float Manager::STICK_RADIUS_PIXELS = 105.0f; - const float Manager::JUMP_BTN_TRIMMED_RADIUS_PIXELS = 67.0f; - const float Manager::JUMP_BTN_FULL_PIXELS = 164.0f; - const float Manager::JUMP_BTN_BOTTOM_MARGIN_PIXELS = 80.0f; - const float Manager::JUMP_BTN_RIGHT_MARGIN_PIXELS = 13.0f; + const float Manager::BTN_TRIMMED_RADIUS_PIXELS = 67.0f; + const float Manager::BTN_FULL_PIXELS = 164.0f; + const float Manager::BTN_BOTTOM_MARGIN_PIXELS = 80.0f; + const float Manager::BTN_RIGHT_MARGIN_PIXELS = 13.0f; Manager::Manager() { diff --git a/libraries/ui/src/VirtualPadManager.h b/libraries/ui/src/VirtualPadManager.h index 4938c1ceb3..a1f2e17597 100644 --- a/libraries/ui/src/VirtualPadManager.h +++ b/libraries/ui/src/VirtualPadManager.h @@ -59,21 +59,19 @@ namespace VirtualPad { static const float BASE_DIAMETER_PIXELS; static const float BASE_MARGIN_PIXELS; static const float STICK_RADIUS_PIXELS; - static const float JUMP_BTN_TRIMMED_RADIUS_PIXELS; - static const float JUMP_BTN_FULL_PIXELS; - static const float JUMP_BTN_BOTTOM_MARGIN_PIXELS; - static const float JUMP_BTN_RIGHT_MARGIN_PIXELS; + static const float BTN_TRIMMED_RADIUS_PIXELS; + static const float BTN_FULL_PIXELS; + static const float BTN_BOTTOM_MARGIN_PIXELS; + static const float BTN_RIGHT_MARGIN_PIXELS; signals: void hapticFeedbackRequested(int duration); private: Instance _leftVPadInstance; - bool _enabled {true}; + bool _enabled { true }; bool _hidden; - glm::vec2 _jumpButtonPosition; - glm::vec2 _rbButtonPosition; - int _extraBottomMargin {0}; + int _extraBottomMargin { 0 }; std::map _buttonsPositions; }; } From 4fd80ff6bc7bb2f31671164aaa86b701f39023db Mon Sep 17 00:00:00 2001 From: amantley Date: Tue, 8 Jan 2019 15:26:46 -0800 Subject: [PATCH 006/436] implementing the spline ik for the spline as an anim node --- libraries/animation/src/AnimContext.h | 1 + libraries/animation/src/AnimNodeLoader.cpp | 22 +++++++ libraries/animation/src/AnimSplineIK.cpp | 77 ++++++++++++++++++++++ libraries/animation/src/AnimSplineIK.h | 76 +++++++++++++++++++++ 4 files changed, 176 insertions(+) create mode 100644 libraries/animation/src/AnimSplineIK.cpp create mode 100644 libraries/animation/src/AnimSplineIK.h diff --git a/libraries/animation/src/AnimContext.h b/libraries/animation/src/AnimContext.h index c455dd9c8f..e3ab5d9788 100644 --- a/libraries/animation/src/AnimContext.h +++ b/libraries/animation/src/AnimContext.h @@ -28,6 +28,7 @@ enum class AnimNodeType { InverseKinematics, DefaultPose, TwoBoneIK, + SplineIK, PoleVectorConstraint, NumTypes }; diff --git a/libraries/animation/src/AnimNodeLoader.cpp b/libraries/animation/src/AnimNodeLoader.cpp index dfa61e9fea..562a614b4a 100644 --- a/libraries/animation/src/AnimNodeLoader.cpp +++ b/libraries/animation/src/AnimNodeLoader.cpp @@ -26,6 +26,7 @@ #include "AnimInverseKinematics.h" #include "AnimDefaultPose.h" #include "AnimTwoBoneIK.h" +#include "AnimSplineIK.h" #include "AnimPoleVectorConstraint.h" using NodeLoaderFunc = AnimNode::Pointer (*)(const QJsonObject& jsonObj, const QString& id, const QUrl& jsonUrl); @@ -41,6 +42,7 @@ static AnimNode::Pointer loadManipulatorNode(const QJsonObject& jsonObj, const Q static AnimNode::Pointer loadInverseKinematicsNode(const QJsonObject& jsonObj, const QString& id, const QUrl& jsonUrl); static AnimNode::Pointer loadDefaultPoseNode(const QJsonObject& jsonObj, const QString& id, const QUrl& jsonUrl); static AnimNode::Pointer loadTwoBoneIKNode(const QJsonObject& jsonObj, const QString& id, const QUrl& jsonUrl); +static AnimNode::Pointer loadSplineIKNode(const QJsonObject& jsonObj, const QString& id, const QUrl& jsonUrl); static AnimNode::Pointer loadPoleVectorConstraintNode(const QJsonObject& jsonObj, const QString& id, const QUrl& jsonUrl); static const float ANIM_GRAPH_LOAD_PRIORITY = 10.0f; @@ -123,6 +125,7 @@ static NodeLoaderFunc animNodeTypeToLoaderFunc(AnimNode::Type type) { case AnimNode::Type::InverseKinematics: return loadInverseKinematicsNode; case AnimNode::Type::DefaultPose: return loadDefaultPoseNode; case AnimNode::Type::TwoBoneIK: return loadTwoBoneIKNode; + case AnimNode::Type::SplineIK: return loadSplineIKNode; case AnimNode::Type::PoleVectorConstraint: return loadPoleVectorConstraintNode; case AnimNode::Type::NumTypes: return nullptr; }; @@ -140,6 +143,7 @@ static NodeProcessFunc animNodeTypeToProcessFunc(AnimNode::Type type) { case AnimNode::Type::InverseKinematics: return processDoNothing; case AnimNode::Type::DefaultPose: return processDoNothing; case AnimNode::Type::TwoBoneIK: return processDoNothing; + case AnimNode::Type::SplineIK: return processDoNothing; case AnimNode::Type::PoleVectorConstraint: return processDoNothing; case AnimNode::Type::NumTypes: return nullptr; }; @@ -574,6 +578,24 @@ static AnimNode::Pointer loadDefaultPoseNode(const QJsonObject& jsonObj, const Q return node; } +static AnimNode::Pointer loadSplineIKNode(const QJsonObject& jsonObj, const QString& id, const QUrl& jsonUrl) { + READ_FLOAT(alpha, jsonObj, id, jsonUrl, nullptr); + READ_BOOL(enabled, jsonObj, id, jsonUrl, nullptr); + READ_FLOAT(interpDuration, jsonObj, id, jsonUrl, nullptr); + READ_STRING(baseJointName, jsonObj, id, jsonUrl, nullptr); + READ_STRING(tipJointName, jsonObj, id, jsonUrl, nullptr); + READ_STRING(alphaVar, jsonObj, id, jsonUrl, nullptr); + READ_STRING(enabledVar, jsonObj, id, jsonUrl, nullptr); + READ_STRING(endEffectorRotationVarVar, jsonObj, id, jsonUrl, nullptr); + READ_STRING(endEffectorPositionVarVar, jsonObj, id, jsonUrl, nullptr); + + auto node = std::make_shared(id, alpha, enabled, interpDuration, + baseJointName, tipJointName, + alphaVar, enabledVar, + endEffectorRotationVarVar, endEffectorPositionVarVar); + return node; +} + static AnimNode::Pointer loadTwoBoneIKNode(const QJsonObject& jsonObj, const QString& id, const QUrl& jsonUrl) { READ_FLOAT(alpha, jsonObj, id, jsonUrl, nullptr); READ_BOOL(enabled, jsonObj, id, jsonUrl, nullptr); diff --git a/libraries/animation/src/AnimSplineIK.cpp b/libraries/animation/src/AnimSplineIK.cpp new file mode 100644 index 0000000000..db6b6864b1 --- /dev/null +++ b/libraries/animation/src/AnimSplineIK.cpp @@ -0,0 +1,77 @@ +// +// AnimSplineIK.cpp +// +// Created by Angus Antley on 1/7/19. +// Copyright (c) 2019 High Fidelity, Inc. All rights reserved. +// +// Distributed under the Apache License, Version 2.0. +// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html +// + +#include "AnimSplineIK.h" +#include "AnimationLogging.h" +#include "CubicHermiteSpline.h" +#include +#include "AnimUtil.h" + +AnimSplineIK::AnimSplineIK(const QString& id, float alpha, bool enabled, float interpDuration, + const QString& baseJointName, + const QString& tipJointName, + const QString& alphaVar, const QString& enabledVar, + const QString& endEffectorRotationVarVar, const QString& endEffectorPositionVarVar) : + AnimNode(AnimNode::Type::SplineIK, id), + _alpha(alpha), + _enabled(enabled), + _interpDuration(interpDuration), + _baseJointName(baseJointName), + _tipJointName(tipJointName), + _alphaVar(alphaVar), + _enabledVar(enabledVar), + _endEffectorRotationVarVar(endEffectorRotationVarVar), + _endEffectorPositionVarVar(endEffectorPositionVarVar), + _prevEndEffectorRotationVar(), + _prevEndEffectorPositionVar() { + +} + +AnimSplineIK::~AnimSplineIK() { + +} + +const AnimPoseVec& AnimSplineIK::evaluate(const AnimVariantMap& animVars, const AnimContext& context, float dt, AnimVariantMap& triggersOut) { + qCDebug(animation) << "evaluating the spline function"; + assert(_children.size() == 1); + if (_children.size() != 1) { + return _poses; + } + + // evalute underPoses + AnimPoseVec underPoses = _children[0]->evaluate(animVars, context, dt, triggersOut); + _poses = underPoses; + return _poses; +} + +void AnimSplineIK::lookUpIndices() { + assert(_skeleton); + + // look up bone indices by name + std::vector indices = _skeleton->lookUpJointIndices({ _baseJointName, _tipJointName }); + + // cache the results + _baseJointIndex = indices[0]; + _tipJointIndex = indices[1]; + + if (_baseJointIndex != -1) { + _baseParentJointIndex = _skeleton->getParentIndex(_baseJointIndex); + } +} + +// for AnimDebugDraw rendering +const AnimPoseVec& AnimSplineIK::getPosesInternal() const { + return _poses; +} + +void AnimSplineIK::setSkeletonInternal(AnimSkeleton::ConstPointer skeleton) { + AnimNode::setSkeletonInternal(skeleton); + lookUpIndices(); +} \ No newline at end of file diff --git a/libraries/animation/src/AnimSplineIK.h b/libraries/animation/src/AnimSplineIK.h new file mode 100644 index 0000000000..36a29971a0 --- /dev/null +++ b/libraries/animation/src/AnimSplineIK.h @@ -0,0 +1,76 @@ +// +// AnimSplineIK.h +// +// Created by Angus Antley on 1/7/19. +// Copyright (c) 2019 High Fidelity, Inc. All rights reserved. +// +// Distributed under the Apache License, Version 2.0. +// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html +// + +#ifndef hifi_AnimSplineIK_h +#define hifi_AnimSplineIK_h + +#include "AnimNode.h" +#include "AnimChain.h" + +// Spline IK for the spine +class AnimSplineIK : public AnimNode { +public: + AnimSplineIK(const QString& id, float alpha, bool enabled, float interpDuration, + const QString& baseJointName, const QString& tipJointName, + const QString& alphaVar, const QString& enabledVar, + const QString& endEffectorRotationVarVar, const QString& endEffectorPositionVarVar); + + virtual ~AnimSplineIK() override; + virtual const AnimPoseVec& evaluate(const AnimVariantMap& animVars, const AnimContext& context, float dt, AnimVariantMap& triggersOut) override; + +protected: + + enum class InterpType { + None = 0, + SnapshotToUnderPoses, + SnapshotToSolve, + NumTypes + }; + + // for AnimDebugDraw rendering + virtual const AnimPoseVec& getPosesInternal() const override; + virtual void setSkeletonInternal(AnimSkeleton::ConstPointer skeleton) override; + + void lookUpIndices(); + + AnimPoseVec _poses; + + float _alpha; + bool _enabled; + float _interpDuration; + QString _baseJointName; + QString _tipJointName; + + int _baseParentJointIndex{ -1 }; + int _baseJointIndex{ -1 }; + int _tipJointIndex{ -1 }; + + QString _alphaVar; // float - (0, 1) 0 means underPoses only, 1 means IK only. + QString _enabledVar; // bool + QString _endEffectorRotationVarVar; // string + QString _endEffectorPositionVarVar; // string + + QString _prevEndEffectorRotationVar; + QString _prevEndEffectorPositionVar; + + InterpType _interpType{ InterpType::None }; + float _interpAlphaVel{ 0.0f }; + float _interpAlpha{ 0.0f }; + + AnimChain _snapshotChain; + + bool _lastEnableDebugDrawIKTargets{ false }; + + // no copies + AnimSplineIK(const AnimSplineIK&) = delete; + AnimSplineIK& operator=(const AnimSplineIK&) = delete; + +}; +#endif // hifi_AnimSplineIK_h From 3b5d8db650287d18985a00ad4e9c11bd6880b505 Mon Sep 17 00:00:00 2001 From: amantley Date: Tue, 8 Jan 2019 17:33:14 -0800 Subject: [PATCH 007/436] updated the json to have a spline node at the root --- .../resources/avatar/avatar-animation.json | 3072 ++++++++++------- libraries/animation/src/AnimNodeLoader.cpp | 1 + libraries/animation/src/AnimStateMachine.cpp | 2 +- libraries/animation/src/AnimTwoBoneIK.cpp | 3 + 4 files changed, 1847 insertions(+), 1231 deletions(-) diff --git a/interface/resources/avatar/avatar-animation.json b/interface/resources/avatar/avatar-animation.json index 50fe5019f9..88ee1ff06b 100644 --- a/interface/resources/avatar/avatar-animation.json +++ b/interface/resources/avatar/avatar-animation.json @@ -38,419 +38,274 @@ "children": [ { "id": "userAnimNone", - "type": "poleVectorConstraint", + "type": "splineIK", "data": { + "alpha": 1.0, "enabled": false, - "referenceVector": [0, 0, 1], - "baseJointName": "RightUpLeg", - "midJointName": "RightLeg", - "tipJointName": "RightFoot", - "enabledVar": "rightFootPoleVectorEnabled", - "poleVectorVar": "rightFootPoleVector" + "interpDuration": 15, + "baseJointName": "Hips", + "tipJointName": "Head", + "alphaVar": "splineIKAlpha", + "enabledVar": "splineIKEnabled", + "endEffectorRotationVarVar": "splineIKRotationVar", + "endEffectorPositionVarVar": "splineIKPositionVar" }, "children": [ { - "id": "rightFootIK", - "type": "twoBoneIK", + "id": "rightFootPoleVector", + "type": "poleVectorConstraint", "data": { - "alpha": 1.0, "enabled": false, - "interpDuration": 15, + "referenceVector": [ 0, 0, 1 ], "baseJointName": "RightUpLeg", "midJointName": "RightLeg", "tipJointName": "RightFoot", - "midHingeAxis": [-1, 0, 0], - "alphaVar": "rightFootIKAlpha", - "enabledVar": "rightFootIKEnabled", - "endEffectorRotationVarVar": "rightFootIKRotationVar", - "endEffectorPositionVarVar": "rightFootIKPositionVar" + "enabledVar": "rightFootPoleVectorEnabled", + "poleVectorVar": "rightFootPoleVector" }, "children": [ { - "id": "leftFootPoleVector", - "type": "poleVectorConstraint", + "id": "rightFootIK", + "type": "twoBoneIK", "data": { + "alpha": 1.0, "enabled": false, - "referenceVector": [0, 0, 1], - "baseJointName": "LeftUpLeg", - "midJointName": "LeftLeg", - "tipJointName": "LeftFoot", - "enabledVar": "leftFootPoleVectorEnabled", - "poleVectorVar": "leftFootPoleVector" + "interpDuration": 15, + "baseJointName": "RightUpLeg", + "midJointName": "RightLeg", + "tipJointName": "RightFoot", + "midHingeAxis": [ -1, 0, 0 ], + "alphaVar": "rightFootIKAlpha", + "enabledVar": "rightFootIKEnabled", + "endEffectorRotationVarVar": "rightFootIKRotationVar", + "endEffectorPositionVarVar": "rightFootIKPositionVar" }, "children": [ { - "id": "leftFootIK", - "type": "twoBoneIK", + "id": "leftFootPoleVector", + "type": "poleVectorConstraint", "data": { - "alpha": 1.0, "enabled": false, - "interpDuration": 15, + "referenceVector": [ 0, 0, 1 ], "baseJointName": "LeftUpLeg", "midJointName": "LeftLeg", "tipJointName": "LeftFoot", - "midHingeAxis": [-1, 0, 0], - "alphaVar": "leftFootIKAlpha", - "enabledVar": "leftFootIKEnabled", - "endEffectorRotationVarVar": "leftFootIKRotationVar", - "endEffectorPositionVarVar": "leftFootIKPositionVar" + "enabledVar": "leftFootPoleVectorEnabled", + "poleVectorVar": "leftFootPoleVector" }, "children": [ { - "id": "ikOverlay", - "type": "overlay", + "id": "leftFootIK", + "type": "twoBoneIK", "data": { "alpha": 1.0, - "alphaVar": "ikOverlayAlpha", - "boneSet": "fullBody" + "enabled": false, + "interpDuration": 15, + "baseJointName": "LeftUpLeg", + "midJointName": "LeftLeg", + "tipJointName": "LeftFoot", + "midHingeAxis": [ -1, 0, 0 ], + "alphaVar": "leftFootIKAlpha", + "enabledVar": "leftFootIKEnabled", + "endEffectorRotationVarVar": "leftFootIKRotationVar", + "endEffectorPositionVarVar": "leftFootIKPositionVar" }, "children": [ { - "id": "ik", - "type": "inverseKinematics", - "data": { - "solutionSource": "relaxToUnderPoses", - "solutionSourceVar": "solutionSource", - "targets": [ - { - "jointName": "Hips", - "positionVar": "hipsPosition", - "rotationVar": "hipsRotation", - "typeVar": "hipsType", - "weightVar": "hipsWeight", - "weight": 1.0, - "flexCoefficients": [1] - }, - { - "jointName": "RightHand", - "positionVar": "rightHandPosition", - "rotationVar": "rightHandRotation", - "typeVar": "rightHandType", - "weightVar": "rightHandWeight", - "weight": 1.0, - "flexCoefficients": [1, 0.5, 0.5, 0.2, 0.01, 0.005, 0.001, 0.0, 0.0], - "poleVectorEnabledVar": "rightHandPoleVectorEnabled", - "poleReferenceVectorVar": "rightHandPoleReferenceVector", - "poleVectorVar": "rightHandPoleVector" - }, - { - "jointName": "LeftHand", - "positionVar": "leftHandPosition", - "rotationVar": "leftHandRotation", - "typeVar": "leftHandType", - "weightVar": "leftHandWeight", - "weight": 1.0, - "flexCoefficients": [1, 0.5, 0.5, 0.2, 0.01, 0.005, 0.001, 0.0, 0.0], - "poleVectorEnabledVar": "leftHandPoleVectorEnabled", - "poleReferenceVectorVar": "leftHandPoleReferenceVector", - "poleVectorVar": "leftHandPoleVector" - }, - { - "jointName": "Spine2", - "positionVar": "spine2Position", - "rotationVar": "spine2Rotation", - "typeVar": "spine2Type", - "weightVar": "spine2Weight", - "weight": 2.0, - "flexCoefficients": [1.0, 0.5, 0.25] - }, - { - "jointName": "Head", - "positionVar": "headPosition", - "rotationVar": "headRotation", - "typeVar": "headType", - "weightVar": "headWeight", - "weight": 4.0, - "flexCoefficients": [1, 0.5, 0.25, 0.2, 0.1] - } - ] - }, - "children": [] - }, - { - "id": "defaultPoseOverlay", + "id": "ikOverlay", "type": "overlay", "data": { - "alpha": 0.0, - "alphaVar": "defaultPoseOverlayAlpha", - "boneSet": "fullBody", - "boneSetVar": "defaultPoseOverlayBoneSet" + "alpha": 1.0, + "alphaVar": "ikOverlayAlpha", + "boneSet": "fullBody" }, "children": [ { - "id": "defaultPose", - "type": "defaultPose", + "id": "ik", + "type": "inverseKinematics", "data": { + "solutionSource": "relaxToUnderPoses", + "solutionSourceVar": "solutionSource", + "targets": [ + { + "jointName": "Hips", + "positionVar": "hipsPosition", + "rotationVar": "hipsRotation", + "typeVar": "hipsType", + "weightVar": "hipsWeight", + "weight": 1.0, + "flexCoefficients": [ 1 ] + }, + { + "jointName": "RightHand", + "positionVar": "rightHandPosition", + "rotationVar": "rightHandRotation", + "typeVar": "rightHandType", + "weightVar": "rightHandWeight", + "weight": 1.0, + "flexCoefficients": [ 1, 0.5, 0.5, 0.2, 0.01, 0.005, 0.001, 0.0, 0.0 ], + "poleVectorEnabledVar": "rightHandPoleVectorEnabled", + "poleReferenceVectorVar": "rightHandPoleReferenceVector", + "poleVectorVar": "rightHandPoleVector" + }, + { + "jointName": "LeftHand", + "positionVar": "leftHandPosition", + "rotationVar": "leftHandRotation", + "typeVar": "leftHandType", + "weightVar": "leftHandWeight", + "weight": 1.0, + "flexCoefficients": [ 1, 0.5, 0.5, 0.2, 0.01, 0.005, 0.001, 0.0, 0.0 ], + "poleVectorEnabledVar": "leftHandPoleVectorEnabled", + "poleReferenceVectorVar": "leftHandPoleReferenceVector", + "poleVectorVar": "leftHandPoleVector" + }, + { + "jointName": "Spine2", + "positionVar": "spine2Position", + "rotationVar": "spine2Rotation", + "typeVar": "spine2Type", + "weightVar": "spine2Weight", + "weight": 2.0, + "flexCoefficients": [ 1.0, 0.5, 0.25 ] + }, + { + "jointName": "Head", + "positionVar": "headPosition", + "rotationVar": "headRotation", + "typeVar": "headType", + "weightVar": "headWeight", + "weight": 4.0, + "flexCoefficients": [ 1, 0.5, 0.25, 0.2, 0.1 ] + } + ] }, "children": [] }, { - "id": "rightHandOverlay", + "id": "defaultPoseOverlay", "type": "overlay", "data": { "alpha": 0.0, - "boneSet": "rightHand", - "alphaVar": "rightHandOverlayAlpha" + "alphaVar": "defaultPoseOverlayAlpha", + "boneSet": "fullBody", + "boneSetVar": "defaultPoseOverlayBoneSet" }, "children": [ { - "id": "rightHandStateMachine", - "type": "stateMachine", + "id": "defaultPose", + "type": "defaultPose", "data": { - "currentState": "rightHandGrasp", - "states": [ - { - "id": "rightHandGrasp", - "interpTarget": 3, - "interpDuration": 3, - "transitions": [ - { "var": "isRightIndexPoint", "state": "rightIndexPoint" }, - { "var": "isRightThumbRaise", "state": "rightThumbRaise" }, - { "var": "isRightIndexPointAndThumbRaise", "state": "rightIndexPointAndThumbRaise" } - ] - }, - { - "id": "rightIndexPoint", - "interpTarget": 15, - "interpDuration": 3, - "transitions": [ - { "var": "isRightHandGrasp", "state": "rightHandGrasp" }, - { "var": "isRightThumbRaise", "state": "rightThumbRaise" }, - { "var": "isRightIndexPointAndThumbRaise", "state": "rightIndexPointAndThumbRaise" } - ] - }, - { - "id": "rightThumbRaise", - "interpTarget": 15, - "interpDuration": 3, - "transitions": [ - { "var": "isRightHandGrasp", "state": "rightHandGrasp" }, - { "var": "isRightIndexPoint", "state": "rightIndexPoint" }, - { "var": "isRightIndexPointAndThumbRaise", "state": "rightIndexPointAndThumbRaise" } - ] - }, - { - "id": "rightIndexPointAndThumbRaise", - "interpTarget": 15, - "interpDuration": 3, - "transitions": [ - { "var": "isRightHandGrasp", "state": "rightHandGrasp" }, - { "var": "isRightIndexPoint", "state": "rightIndexPoint" }, - { "var": "isRightThumbRaise", "state": "rightThumbRaise" } - ] - } - ] }, - "children": [ - { - "id": "rightHandGrasp", - "type": "blendLinear", - "data": { - "alpha": 0.0, - "alphaVar": "rightHandGraspAlpha" - }, - "children": [ - { - "id": "rightHandGraspOpen", - "type": "clip", - "data": { - "url": "qrc:///avatar/animations/hydra_pose_open_right.fbx", - "startFrame": 0.0, - "endFrame": 0.0, - "timeScale": 1.0, - "loopFlag": true - }, - "children": [] - }, - { - "id": "rightHandGraspClosed", - "type": "clip", - "data": { - "url": "qrc:///avatar/animations/hydra_pose_closed_right.fbx", - "startFrame": 0.0, - "endFrame": 0.0, - "timeScale": 1.0, - "loopFlag": true - }, - "children": [] - } - ] - }, - { - "id": "rightIndexPoint", - "type": "blendLinear", - "data": { - "alpha": 0.0, - "alphaVar": "rightHandGraspAlpha" - }, - "children": [ - { - "id": "rightIndexPointOpen", - "type": "clip", - "data": { - "url": "qrc:///avatar/animations/touch_point_open_right.fbx", - "startFrame": 15.0, - "endFrame": 15.0, - "timeScale": 1.0, - "loopFlag": true - }, - "children": [] - }, - { - "id": "rightIndexPointClosed", - "type": "clip", - "data": { - "url": "qrc:///avatar/animations/touch_point_closed_right.fbx", - "startFrame": 15.0, - "endFrame": 15.0, - "timeScale": 1.0, - "loopFlag": true - }, - "children": [] - } - ] - }, - { - "id": "rightThumbRaise", - "type": "blendLinear", - "data": { - "alpha": 0.0, - "alphaVar": "rightHandGraspAlpha" - }, - "children": [ - { - "id": "rightThumbRaiseOpen", - "type": "clip", - "data": { - "url": "qrc:///avatar/animations/touch_thumb_open_right.fbx", - "startFrame": 15.0, - "endFrame": 15.0, - "timeScale": 1.0, - "loopFlag": true - }, - "children": [] - }, - { - "id": "rightThumbRaiseClosed", - "type": "clip", - "data": { - "url": "qrc:///avatar/animations/touch_thumb_closed_right.fbx", - "startFrame": 15.0, - "endFrame": 15.0, - "timeScale": 1.0, - "loopFlag": true - }, - "children": [] - } - ] - }, - { - "id": "rightIndexPointAndThumbRaise", - "type": "blendLinear", - "data": { - "alpha": 0.0, - "alphaVar": "rightHandGraspAlpha" - }, - "children": [ - { - "id": "rightIndexPointAndThumbRaiseOpen", - "type": "clip", - "data": { - "url": "qrc:///avatar/animations/touch_thumb_point_open_right.fbx", - "startFrame": 15.0, - "endFrame": 15.0, - "timeScale": 1.0, - "loopFlag": true - }, - "children": [] - }, - { - "id": "rightIndexPointAndThumbRaiseClosed", - "type": "clip", - "data": { - "url": "qrc:///avatar/animations/touch_thumb_point_closed_right.fbx", - "startFrame": 15.0, - "endFrame": 15.0, - "timeScale": 1.0, - "loopFlag": true - }, - "children": [] - } - ] - } - ] + "children": [] }, { - "id": "leftHandOverlay", + "id": "rightHandOverlay", "type": "overlay", "data": { "alpha": 0.0, - "boneSet": "leftHand", - "alphaVar": "leftHandOverlayAlpha" + "boneSet": "rightHand", + "alphaVar": "rightHandOverlayAlpha" }, "children": [ { - "id": "leftHandStateMachine", + "id": "rightHandStateMachine", "type": "stateMachine", "data": { - "currentState": "leftHandGrasp", + "currentState": "rightHandGrasp", "states": [ { - "id": "leftHandGrasp", + "id": "rightHandGrasp", "interpTarget": 3, "interpDuration": 3, "transitions": [ - { "var": "isLeftIndexPoint", "state": "leftIndexPoint" }, - { "var": "isLeftThumbRaise", "state": "leftThumbRaise" }, - { "var": "isLeftIndexPointAndThumbRaise", "state": "leftIndexPointAndThumbRaise" } + { + "var": "isRightIndexPoint", + "state": "rightIndexPoint" + }, + { + "var": "isRightThumbRaise", + "state": "rightThumbRaise" + }, + { + "var": "isRightIndexPointAndThumbRaise", + "state": "rightIndexPointAndThumbRaise" + } ] }, { - "id": "leftIndexPoint", + "id": "rightIndexPoint", "interpTarget": 15, "interpDuration": 3, "transitions": [ - { "var": "isLeftHandGrasp", "state": "leftHandGrasp" }, - { "var": "isLeftThumbRaise", "state": "leftThumbRaise" }, - { "var": "isLeftIndexPointAndThumbRaise", "state": "leftIndexPointAndThumbRaise" } + { + "var": "isRightHandGrasp", + "state": "rightHandGrasp" + }, + { + "var": "isRightThumbRaise", + "state": "rightThumbRaise" + }, + { + "var": "isRightIndexPointAndThumbRaise", + "state": "rightIndexPointAndThumbRaise" + } ] }, { - "id": "leftThumbRaise", + "id": "rightThumbRaise", "interpTarget": 15, "interpDuration": 3, "transitions": [ - { "var": "isLeftHandGrasp", "state": "leftHandGrasp" }, - { "var": "isLeftIndexPoint", "state": "leftIndexPoint" }, - { "var": "isLeftIndexPointAndThumbRaise", "state": "leftIndexPointAndThumbRaise" } + { + "var": "isRightHandGrasp", + "state": "rightHandGrasp" + }, + { + "var": "isRightIndexPoint", + "state": "rightIndexPoint" + }, + { + "var": "isRightIndexPointAndThumbRaise", + "state": "rightIndexPointAndThumbRaise" + } ] }, { - "id": "leftIndexPointAndThumbRaise", + "id": "rightIndexPointAndThumbRaise", "interpTarget": 15, "interpDuration": 3, "transitions": [ - { "var": "isLeftHandGrasp", "state": "leftHandGrasp" }, - { "var": "isLeftIndexPoint", "state": "leftIndexPoint" }, - { "var": "isLeftThumbRaise", "state": "leftThumbRaise" } + { + "var": "isRightHandGrasp", + "state": "rightHandGrasp" + }, + { + "var": "isRightIndexPoint", + "state": "rightIndexPoint" + }, + { + "var": "isRightThumbRaise", + "state": "rightThumbRaise" + } ] } ] }, "children": [ { - "id": "leftHandGrasp", + "id": "rightHandGrasp", "type": "blendLinear", "data": { "alpha": 0.0, - "alphaVar": "leftHandGraspAlpha" + "alphaVar": "rightHandGraspAlpha" }, "children": [ { - "id": "leftHandGraspOpen", + "id": "rightHandGraspOpen", "type": "clip", "data": { - "url": "qrc:///avatar/animations/hydra_pose_open_left.fbx", + "url": "qrc:///avatar/animations/hydra_pose_open_right.fbx", "startFrame": 0.0, "endFrame": 0.0, "timeScale": 1.0, @@ -459,12 +314,12 @@ "children": [] }, { - "id": "leftHandGraspClosed", + "id": "rightHandGraspClosed", "type": "clip", "data": { - "url": "qrc:///avatar/animations/hydra_pose_closed_left.fbx", - "startFrame": 10.0, - "endFrame": 10.0, + "url": "qrc:///avatar/animations/hydra_pose_closed_right.fbx", + "startFrame": 0.0, + "endFrame": 0.0, "timeScale": 1.0, "loopFlag": true }, @@ -473,18 +328,18 @@ ] }, { - "id": "leftIndexPoint", + "id": "rightIndexPoint", "type": "blendLinear", - "data": { + "data": { "alpha": 0.0, - "alphaVar": "leftHandGraspAlpha" + "alphaVar": "rightHandGraspAlpha" }, "children": [ { - "id": "leftIndexPointOpen", + "id": "rightIndexPointOpen", "type": "clip", "data": { - "url": "qrc:///avatar/animations/touch_point_open_left.fbx", + "url": "qrc:///avatar/animations/touch_point_open_right.fbx", "startFrame": 15.0, "endFrame": 15.0, "timeScale": 1.0, @@ -493,10 +348,10 @@ "children": [] }, { - "id": "leftIndexPointClosed", + "id": "rightIndexPointClosed", "type": "clip", "data": { - "url": "qrc:///avatar/animations/touch_point_closed_left.fbx", + "url": "qrc:///avatar/animations/touch_point_closed_right.fbx", "startFrame": 15.0, "endFrame": 15.0, "timeScale": 1.0, @@ -507,18 +362,18 @@ ] }, { - "id": "leftThumbRaise", + "id": "rightThumbRaise", "type": "blendLinear", - "data": { + "data": { "alpha": 0.0, - "alphaVar": "leftHandGraspAlpha" + "alphaVar": "rightHandGraspAlpha" }, "children": [ { - "id": "leftThumbRaiseOpen", + "id": "rightThumbRaiseOpen", "type": "clip", "data": { - "url": "qrc:///avatar/animations/touch_thumb_open_left.fbx", + "url": "qrc:///avatar/animations/touch_thumb_open_right.fbx", "startFrame": 15.0, "endFrame": 15.0, "timeScale": 1.0, @@ -527,10 +382,10 @@ "children": [] }, { - "id": "leftThumbRaiseClosed", + "id": "rightThumbRaiseClosed", "type": "clip", "data": { - "url": "qrc:///avatar/animations/touch_thumb_closed_left.fbx", + "url": "qrc:///avatar/animations/touch_thumb_closed_right.fbx", "startFrame": 15.0, "endFrame": 15.0, "timeScale": 1.0, @@ -541,18 +396,18 @@ ] }, { - "id": "leftIndexPointAndThumbRaise", + "id": "rightIndexPointAndThumbRaise", "type": "blendLinear", - "data": { + "data": { "alpha": 0.0, - "alphaVar": "leftHandGraspAlpha" + "alphaVar": "rightHandGraspAlpha" }, "children": [ { - "id": "leftIndexPointAndThumbRaiseOpen", + "id": "rightIndexPointAndThumbRaiseOpen", "type": "clip", "data": { - "url": "qrc:///avatar/animations/touch_thumb_point_open_left.fbx", + "url": "qrc:///avatar/animations/touch_thumb_point_open_right.fbx", "startFrame": 15.0, "endFrame": 15.0, "timeScale": 1.0, @@ -561,10 +416,10 @@ "children": [] }, { - "id": "leftIndexPointAndThumbRaiseClosed", + "id": "rightIndexPointAndThumbRaiseClosed", "type": "clip", "data": { - "url": "qrc:///avatar/animations/touch_thumb_point_closed_left.fbx", + "url": "qrc:///avatar/animations/touch_thumb_point_closed_right.fbx", "startFrame": 15.0, "endFrame": 15.0, "timeScale": 1.0, @@ -577,911 +432,1588 @@ ] }, { - "id": "mainStateMachine", - "type": "stateMachine", + "id": "leftHandOverlay", + "type": "overlay", "data": { - "outputJoints": ["LeftFoot", "RightFoot"], - "currentState": "idle", - "states": [ - { - "id": "idle", - "interpTarget": 20, - "interpDuration": 8, - "interpType": "snapshotPrev", - "transitions": [ - { "var": "isMovingForward", "state": "WALKFWD" }, - { "var": "isMovingBackward", "state": "WALKBWD" }, - { "var": "isMovingRight", "state": "STRAFERIGHT" }, - { "var": "isMovingLeft", "state": "STRAFELEFT" }, - { "var": "isTurningRight", "state": "turnRight" }, - { "var": "isTurningLeft", "state": "turnLeft" }, - { "var": "isFlying", "state": "fly" }, - { "var": "isTakeoffStand", "state": "takeoffStand" }, - { "var": "isTakeoffRun", "state": "TAKEOFFRUN" }, - { "var": "isInAirStand", "state": "inAirStand" }, - { "var": "isInAirRun", "state": "INAIRRUN" }, - { "var": "isMovingRightHmd", "state": "strafeRightHmd" }, - { "var": "isMovingLeftHmd", "state": "strafeLeftHmd" } - ] - }, - { - "id": "idleToWalkFwd", - "interpTarget": 12, - "interpDuration": 8, - "transitions": [ - { "var": "idleToWalkFwdOnDone", "state": "WALKFWD" }, - { "var": "isNotMoving", "state": "idle" }, - { "var": "isMovingBackward", "state": "WALKBWD" }, - { "var": "isMovingRight", "state": "STRAFERIGHT" }, - { "var": "isMovingLeft", "state": "STRAFELEFT" }, - { "var": "isTurningRight", "state": "turnRight" }, - { "var": "isTurningLeft", "state": "turnLeft" }, - { "var": "isFlying", "state": "fly" }, - { "var": "isTakeoffStand", "state": "takeoffStand" }, - { "var": "isTakeoffRun", "state": "TAKEOFFRUN" }, - { "var": "isInAirStand", "state": "inAirStand" }, - { "var": "isInAirRun", "state": "INAIRRUN" }, - { "var": "isMovingRightHmd", "state": "strafeRightHmd" }, - { "var": "isMovingLeftHmd", "state": "strafeLeftHmd" } - ] - }, - { - "id": "idleSettle", - "interpTarget": 15, - "interpDuration": 8, - "interpType": "snapshotPrev", - "transitions": [ - {"var": "idleSettleOnDone", "state": "idle" }, - {"var": "isMovingForward", "state": "WALKFWD" }, - { "var": "isMovingBackward", "state": "WALKBWD" }, - { "var": "isMovingRight", "state": "STRAFERIGHT" }, - { "var": "isMovingLeft", "state": "STRAFELEFT" }, - { "var": "isMovingRightHmd", "state": "strafeRightHmd" }, - { "var": "isMovingLeftHmd", "state": "strafeLeftHmd" }, - { "var": "isTurningRight", "state": "turnRight" }, - { "var": "isTurningLeft", "state": "turnLeft" }, - { "var": "isFlying", "state": "fly" }, - { "var": "isTakeoffStand", "state": "takeoffStand" }, - { "var": "isTakeoffRun", "state": "TAKEOFFRUN" }, - { "var": "isInAirStand", "state": "inAirStand" }, - { "var": "isInAirRun", "state": "INAIRRUN" } - ] - }, - { - "id": "WALKFWD", - "interpTarget": 35, - "interpDuration": 10, - "interpType": "snapshotPrev", - "transitions": [ - { "var": "isNotMoving", "state": "idleSettle" }, - { "var": "isMovingBackward", "state": "WALKBWD" }, - { "var": "isMovingRight", "state": "STRAFERIGHT" }, - { "var": "isMovingLeft", "state": "STRAFELEFT" }, - { "var": "isTurningRight", "state": "turnRight" }, - { "var": "isTurningLeft", "state": "turnLeft" }, - { "var": "isFlying", "state": "fly" }, - { "var": "isTakeoffStand", "state": "takeoffStand" }, - { "var": "isTakeoffRun", "state": "TAKEOFFRUN" }, - { "var": "isInAirStand", "state": "inAirStand" }, - { "var": "isInAirRun", "state": "INAIRRUN" }, - { "var": "isMovingRightHmd", "state": "strafeRightHmd" }, - { "var": "isMovingLeftHmd", "state": "strafeLeftHmd" } - ] - }, - { - "id": "WALKBWD", - "interpTarget": 35, - "interpDuration": 10, - "interpType": "snapshotPrev", - "transitions": [ - { "var": "isNotMoving", "state": "idleSettle" }, - { "var": "isMovingForward", "state": "WALKFWD" }, - { "var": "isMovingRight", "state": "STRAFERIGHT" }, - { "var": "isMovingLeft", "state": "STRAFELEFT" }, - { "var": "isTurningRight", "state": "turnRight" }, - { "var": "isTurningLeft", "state": "turnLeft" }, - { "var": "isFlying", "state": "fly" }, - { "var": "isTakeoffStand", "state": "takeoffStand" }, - { "var": "isTakeoffRun", "state": "TAKEOFFRUN" }, - { "var": "isInAirStand", "state": "inAirStand" }, - { "var": "isInAirRun", "state": "INAIRRUN" }, - { "var": "isMovingRightHmd", "state": "strafeRightHmd" }, - { "var": "isMovingLeftHmd", "state": "strafeLeftHmd" } - ] - }, - { - "id": "STRAFERIGHT", - "interpTarget": 25, - "interpDuration": 8, - "interpType": "snapshotPrev", - "transitions": [ - { "var": "isNotMoving", "state": "idleSettle" }, - { "var": "isMovingForward", "state": "WALKFWD" }, - { "var": "isMovingBackward", "state": "WALKBWD" }, - { "var": "isMovingLeft", "state": "STRAFELEFT" }, - { "var": "isTurningRight", "state": "turnRight" }, - { "var": "isTurningLeft", "state": "turnLeft" }, - { "var": "isFlying", "state": "fly" }, - { "var": "isTakeoffStand", "state": "takeoffStand" }, - { "var": "isTakeoffRun", "state": "TAKEOFFRUN" }, - { "var": "isInAirStand", "state": "inAirStand" }, - { "var": "isInAirRun", "state": "INAIRRUN" }, - { "var": "isMovingRightHmd", "state": "strafeRightHmd" }, - { "var": "isMovingLeftHmd", "state": "strafeLeftHmd" } - ] - }, - { - "id": "STRAFELEFT", - "interpTarget": 25, - "interpDuration": 8, - "interpType": "snapshotPrev", - "transitions": [ - { "var": "isNotMoving", "state": "idleSettle" }, - { "var": "isMovingForward", "state": "WALKFWD" }, - { "var": "isMovingBackward", "state": "WALKBWD" }, - { "var": "isMovingRight", "state": "STRAFERIGHT" }, - { "var": "isTurningRight", "state": "turnRight" }, - { "var": "isTurningLeft", "state": "turnLeft" }, - { "var": "isFlying", "state": "fly" }, - { "var": "isTakeoffStand", "state": "takeoffStand" }, - { "var": "isTakeoffRun", "state": "TAKEOFFRUN" }, - { "var": "isInAirStand", "state": "inAirStand" }, - { "var": "isInAirRun", "state": "INAIRRUN" }, - { "var": "isMovingRightHmd", "state": "strafeRightHmd" }, - { "var": "isMovingLeftHmd", "state": "strafeLeftHmd" } - ] - }, - { - "id": "turnRight", - "interpTarget": 6, - "interpDuration": 8, - "transitions": [ - { "var": "isNotTurning", "state": "idle" }, - { "var": "isMovingForward", "state": "WALKFWD" }, - { "var": "isMovingBackward", "state": "WALKBWD" }, - { "var": "isMovingRight", "state": "STRAFERIGHT" }, - { "var": "isMovingLeft", "state": "STRAFELEFT" }, - { "var": "isTurningLeft", "state": "turnLeft" }, - { "var": "isFlying", "state": "fly" }, - { "var": "isTakeoffStand", "state": "takeoffStand" }, - { "var": "isTakeoffRun", "state": "TAKEOFFRUN" }, - { "var": "isInAirStand", "state": "inAirStand" }, - { "var": "isInAirRun", "state": "INAIRRUN" }, - { "var": "isMovingRightHmd", "state": "strafeRightHmd" }, - { "var": "isMovingLeftHmd", "state": "strafeLeftHmd" } - ] - }, - { - "id": "turnLeft", - "interpTarget": 6, - "interpDuration": 8, - "transitions": [ - { "var": "isNotTurning", "state": "idle" }, - { "var": "isMovingForward", "state": "WALKFWD" }, - { "var": "isMovingBackward", "state": "WALKBWD" }, - { "var": "isMovingRight", "state": "STRAFERIGHT" }, - { "var": "isMovingLeft", "state": "STRAFELEFT" }, - { "var": "isTurningRight", "state": "turnRight" }, - { "var": "isFlying", "state": "fly" }, - { "var": "isTakeoffStand", "state": "takeoffStand" }, - { "var": "isTakeoffRun", "state": "TAKEOFFRUN" }, - { "var": "isInAirStand", "state": "inAirStand" }, - { "var": "isInAirRun", "state": "INAIRRUN" }, - { "var": "isMovingRightHmd", "state": "strafeRightHmd" }, - { "var": "isMovingLeftHmd", "state": "strafeLeftHmd" } - ] - }, - { - "id": "strafeRightHmd", - "interpTarget": 5, - "interpDuration": 8, - "interpType": "snapshotPrev", - "transitions": [ - { "var": "isNotMoving", "state": "idleSettle" }, - { "var": "isMovingForward", "state": "WALKFWD" }, - { "var": "isMovingBackward", "state": "WALKBWD" }, - { "var": "isMovingLeftHmd", "state": "strafeLeftHmd" }, - { "var": "isMovingRight", "state": "STRAFERIGHT" }, - { "var": "isMovingLeft", "state": "STRAFELEFT" }, - { "var": "isTurningRight", "state": "turnRight" }, - { "var": "isTurningLeft", "state": "turnLeft" }, - { "var": "isFlying", "state": "fly" }, - { "var": "isTakeoffStand", "state": "takeoffStand" }, - { "var": "isTakeoffRun", "state": "TAKEOFFRUN" }, - { "var": "isInAirStand", "state": "inAirStand" }, - { "var": "isInAirRun", "state": "INAIRRUN" } - ] - }, - { - "id": "strafeLeftHmd", - "interpTarget": 5, - "interpDuration": 8, - "interpType": "snapshotPrev", - "transitions": [ - { "var": "isNotMoving", "state": "idleSettle" }, - { "var": "isMovingForward", "state": "WALKFWD" }, - { "var": "isMovingBackward", "state": "WALKBWD" }, - { "var": "isMovingRightHmd", "state": "strafeRightHmd" }, - { "var": "isMovingRight", "state": "STRAFERIGHT" }, - { "var": "isMovingLeft", "state": "STRAFELEFT" }, - { "var": "isTurningRight", "state": "turnRight" }, - { "var": "isTurningLeft", "state": "turnLeft" }, - { "var": "isFlying", "state": "fly" }, - { "var": "isTakeoffStand", "state": "takeoffStand" }, - { "var": "isTakeoffRun", "state": "TAKEOFFRUN" }, - { "var": "isInAirStand", "state": "inAirStand" }, - { "var": "isInAirRun", "state": "INAIRRUN" } - ] - }, - { - "id": "fly", - "interpTarget": 6, - "interpDuration": 6, - "transitions": [ - { "var": "isNotFlying", "state": "idleSettle" } - ] - }, - { - "id": "takeoffStand", - "interpTarget": 2, - "interpDuration": 2, - "transitions": [ - { "var": "isNotTakeoff", "state": "inAirStand" } - ] - }, - { - "id": "TAKEOFFRUN", - "interpTarget": 2, - "interpDuration": 2, - "transitions": [ - { "var": "isNotTakeoff", "state": "INAIRRUN" } - ] - }, - { - "id": "inAirStand", - "interpTarget": 3, - "interpDuration": 3, - "interpType": "snapshotPrev", - "transitions": [ - { "var": "isNotInAir", "state": "landStandImpact" } - ] - }, - { - "id": "INAIRRUN", - "interpTarget": 3, - "interpDuration": 3, - "interpType": "snapshotPrev", - "transitions": [ - { "var": "isNotInAir", "state": "WALKFWD" } - ] - }, - { - "id": "landStandImpact", - "interpTarget": 1, - "interpDuration": 1, - "transitions": [ - { "var": "isFlying", "state": "fly" }, - { "var": "isTakeoffStand", "state": "takeoffStand" }, - { "var": "isTakeoffRun", "state": "TAKEOFFRUN" }, - { "var": "landStandImpactOnDone", "state": "landStand" } - ] - }, - { - "id": "landStand", - "interpTarget": 1, - "interpDuration": 1, - "transitions": [ - { "var": "isMovingForward", "state": "WALKFWD" }, - { "var": "isMovingBackward", "state": "WALKBWD" }, - { "var": "isMovingRight", "state": "STRAFERIGHT" }, - { "var": "isMovingLeft", "state": "STRAFELEFT" }, - { "var": "isTurningRight", "state": "turnRight" }, - { "var": "isTurningLeft", "state": "turnLeft" }, - { "var": "isFlying", "state": "fly" }, - { "var": "isTakeoffStand", "state": "takeoffStand" }, - { "var": "isTakeoffRun", "state": "TAKEOFFRUN" }, - { "var": "isInAirStand", "state": "inAirStand" }, - { "var": "isInAirRun", "state": "INAIRRUN" }, - { "var": "landStandOnDone", "state": "idle" }, - { "var": "isMovingRightHmd", "state": "strafeRightHmd" }, - { "var": "isMovingLeftHmd", "state": "strafeLeftHmd" } - ] - }, - { - "id": "LANDRUN", - "interpTarget": 2, - "interpDuration": 2, - "transitions": [ - { "var": "isFlying", "state": "fly" }, - { "var": "isTakeoffStand", "state": "takeoffStand" }, - { "var": "isTakeoffRun", "state": "TAKEOFFRUN" }, - { "var": "landRunOnDone", "state": "WALKFWD" } - ] - } - ] + "alpha": 0.0, + "boneSet": "leftHand", + "alphaVar": "leftHandOverlayAlpha" }, "children": [ { - "id": "idle", + "id": "leftHandStateMachine", "type": "stateMachine", "data": { - "currentState": "idleStand", + "currentState": "leftHandGrasp", "states": [ { - "id": "idleStand", - "interpTarget": 6, - "interpDuration": 10, + "id": "leftHandGrasp", + "interpTarget": 3, + "interpDuration": 3, "transitions": [ - { "var": "isTalking", "state": "idleTalk" } + { + "var": "isLeftIndexPoint", + "state": "leftIndexPoint" + }, + { + "var": "isLeftThumbRaise", + "state": "leftThumbRaise" + }, + { + "var": "isLeftIndexPointAndThumbRaise", + "state": "leftIndexPointAndThumbRaise" + } ] }, { - "id": "idleTalk", - "interpTarget": 6, - "interpDuration": 10, + "id": "leftIndexPoint", + "interpTarget": 15, + "interpDuration": 3, "transitions": [ - { "var": "notIsTalking", "state": "idleStand" } + { + "var": "isLeftHandGrasp", + "state": "leftHandGrasp" + }, + { + "var": "isLeftThumbRaise", + "state": "leftThumbRaise" + }, + { + "var": "isLeftIndexPointAndThumbRaise", + "state": "leftIndexPointAndThumbRaise" + } + ] + }, + { + "id": "leftThumbRaise", + "interpTarget": 15, + "interpDuration": 3, + "transitions": [ + { + "var": "isLeftHandGrasp", + "state": "leftHandGrasp" + }, + { + "var": "isLeftIndexPoint", + "state": "leftIndexPoint" + }, + { + "var": "isLeftIndexPointAndThumbRaise", + "state": "leftIndexPointAndThumbRaise" + } + ] + }, + { + "id": "leftIndexPointAndThumbRaise", + "interpTarget": 15, + "interpDuration": 3, + "transitions": [ + { + "var": "isLeftHandGrasp", + "state": "leftHandGrasp" + }, + { + "var": "isLeftIndexPoint", + "state": "leftIndexPoint" + }, + { + "var": "isLeftThumbRaise", + "state": "leftThumbRaise" + } ] } ] }, "children": [ { - "id": "idleStand", - "type": "clip", + "id": "leftHandGrasp", + "type": "blendLinear", "data": { - "url": "qrc:///avatar/animations/idle.fbx", - "startFrame": 0.0, - "endFrame": 300.0, - "timeScale": 1.0, - "loopFlag": true + "alpha": 0.0, + "alphaVar": "leftHandGraspAlpha" }, - "children": [] + "children": [ + { + "id": "leftHandGraspOpen", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/hydra_pose_open_left.fbx", + "startFrame": 0.0, + "endFrame": 0.0, + "timeScale": 1.0, + "loopFlag": true + }, + "children": [] + }, + { + "id": "leftHandGraspClosed", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/hydra_pose_closed_left.fbx", + "startFrame": 10.0, + "endFrame": 10.0, + "timeScale": 1.0, + "loopFlag": true + }, + "children": [] + } + ] }, { - "id": "idleTalk", - "type": "clip", + "id": "leftIndexPoint", + "type": "blendLinear", "data": { - "url": "qrc:///avatar/animations/talk.fbx", - "startFrame": 0.0, - "endFrame": 800.0, - "timeScale": 1.0, - "loopFlag": true + "alpha": 0.0, + "alphaVar": "leftHandGraspAlpha" }, - "children": [] + "children": [ + { + "id": "leftIndexPointOpen", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/touch_point_open_left.fbx", + "startFrame": 15.0, + "endFrame": 15.0, + "timeScale": 1.0, + "loopFlag": true + }, + "children": [] + }, + { + "id": "leftIndexPointClosed", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/touch_point_closed_left.fbx", + "startFrame": 15.0, + "endFrame": 15.0, + "timeScale": 1.0, + "loopFlag": true + }, + "children": [] + } + ] + }, + { + "id": "leftThumbRaise", + "type": "blendLinear", + "data": { + "alpha": 0.0, + "alphaVar": "leftHandGraspAlpha" + }, + "children": [ + { + "id": "leftThumbRaiseOpen", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/touch_thumb_open_left.fbx", + "startFrame": 15.0, + "endFrame": 15.0, + "timeScale": 1.0, + "loopFlag": true + }, + "children": [] + }, + { + "id": "leftThumbRaiseClosed", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/touch_thumb_closed_left.fbx", + "startFrame": 15.0, + "endFrame": 15.0, + "timeScale": 1.0, + "loopFlag": true + }, + "children": [] + } + ] + }, + { + "id": "leftIndexPointAndThumbRaise", + "type": "blendLinear", + "data": { + "alpha": 0.0, + "alphaVar": "leftHandGraspAlpha" + }, + "children": [ + { + "id": "leftIndexPointAndThumbRaiseOpen", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/touch_thumb_point_open_left.fbx", + "startFrame": 15.0, + "endFrame": 15.0, + "timeScale": 1.0, + "loopFlag": true + }, + "children": [] + }, + { + "id": "leftIndexPointAndThumbRaiseClosed", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/touch_thumb_point_closed_left.fbx", + "startFrame": 15.0, + "endFrame": 15.0, + "timeScale": 1.0, + "loopFlag": true + }, + "children": [] + } + ] } ] }, { - "id": "WALKFWD", - "type": "blendLinearMove", + "id": "mainStateMachine", + "type": "stateMachine", "data": { - "alpha": 0.0, - "desiredSpeed": 1.4, - "characteristicSpeeds": [0.5, 1.8, 2.3, 3.2, 4.5], - "alphaVar": "moveForwardAlpha", - "desiredSpeedVar": "moveForwardSpeed" + "outputJoints": [ "LeftFoot", "RightFoot" ], + "currentState": "idle", + "states": [ + { + "id": "idle", + "interpTarget": 20, + "interpDuration": 8, + "interpType": "snapshotPrev", + "transitions": [ + { + "var": "isMovingForward", + "state": "WALKFWD" + }, + { + "var": "isMovingBackward", + "state": "WALKBWD" + }, + { + "var": "isMovingRight", + "state": "STRAFERIGHT" + }, + { + "var": "isMovingLeft", + "state": "STRAFELEFT" + }, + { + "var": "isTurningRight", + "state": "turnRight" + }, + { + "var": "isTurningLeft", + "state": "turnLeft" + }, + { + "var": "isFlying", + "state": "fly" + }, + { + "var": "isTakeoffStand", + "state": "takeoffStand" + }, + { + "var": "isTakeoffRun", + "state": "TAKEOFFRUN" + }, + { + "var": "isInAirStand", + "state": "inAirStand" + }, + { + "var": "isInAirRun", + "state": "INAIRRUN" + }, + { + "var": "isMovingRightHmd", + "state": "strafeRightHmd" + }, + { + "var": "isMovingLeftHmd", + "state": "strafeLeftHmd" + } + ] + }, + { + "id": "idleToWalkFwd", + "interpTarget": 12, + "interpDuration": 8, + "transitions": [ + { + "var": "idleToWalkFwdOnDone", + "state": "WALKFWD" + }, + { + "var": "isNotMoving", + "state": "idle" + }, + { + "var": "isMovingBackward", + "state": "WALKBWD" + }, + { + "var": "isMovingRight", + "state": "STRAFERIGHT" + }, + { + "var": "isMovingLeft", + "state": "STRAFELEFT" + }, + { + "var": "isTurningRight", + "state": "turnRight" + }, + { + "var": "isTurningLeft", + "state": "turnLeft" + }, + { + "var": "isFlying", + "state": "fly" + }, + { + "var": "isTakeoffStand", + "state": "takeoffStand" + }, + { + "var": "isTakeoffRun", + "state": "TAKEOFFRUN" + }, + { + "var": "isInAirStand", + "state": "inAirStand" + }, + { + "var": "isInAirRun", + "state": "INAIRRUN" + }, + { + "var": "isMovingRightHmd", + "state": "strafeRightHmd" + }, + { + "var": "isMovingLeftHmd", + "state": "strafeLeftHmd" + } + ] + }, + { + "id": "idleSettle", + "interpTarget": 15, + "interpDuration": 8, + "interpType": "snapshotPrev", + "transitions": [ + { + "var": "idleSettleOnDone", + "state": "idle" + }, + { + "var": "isMovingForward", + "state": "WALKFWD" + }, + { + "var": "isMovingBackward", + "state": "WALKBWD" + }, + { + "var": "isMovingRight", + "state": "STRAFERIGHT" + }, + { + "var": "isMovingLeft", + "state": "STRAFELEFT" + }, + { + "var": "isMovingRightHmd", + "state": "strafeRightHmd" + }, + { + "var": "isMovingLeftHmd", + "state": "strafeLeftHmd" + }, + { + "var": "isTurningRight", + "state": "turnRight" + }, + { + "var": "isTurningLeft", + "state": "turnLeft" + }, + { + "var": "isFlying", + "state": "fly" + }, + { + "var": "isTakeoffStand", + "state": "takeoffStand" + }, + { + "var": "isTakeoffRun", + "state": "TAKEOFFRUN" + }, + { + "var": "isInAirStand", + "state": "inAirStand" + }, + { + "var": "isInAirRun", + "state": "INAIRRUN" + } + ] + }, + { + "id": "WALKFWD", + "interpTarget": 35, + "interpDuration": 10, + "interpType": "snapshotPrev", + "transitions": [ + { + "var": "isNotMoving", + "state": "idleSettle" + }, + { + "var": "isMovingBackward", + "state": "WALKBWD" + }, + { + "var": "isMovingRight", + "state": "STRAFERIGHT" + }, + { + "var": "isMovingLeft", + "state": "STRAFELEFT" + }, + { + "var": "isTurningRight", + "state": "turnRight" + }, + { + "var": "isTurningLeft", + "state": "turnLeft" + }, + { + "var": "isFlying", + "state": "fly" + }, + { + "var": "isTakeoffStand", + "state": "takeoffStand" + }, + { + "var": "isTakeoffRun", + "state": "TAKEOFFRUN" + }, + { + "var": "isInAirStand", + "state": "inAirStand" + }, + { + "var": "isInAirRun", + "state": "INAIRRUN" + }, + { + "var": "isMovingRightHmd", + "state": "strafeRightHmd" + }, + { + "var": "isMovingLeftHmd", + "state": "strafeLeftHmd" + } + ] + }, + { + "id": "WALKBWD", + "interpTarget": 35, + "interpDuration": 10, + "interpType": "snapshotPrev", + "transitions": [ + { + "var": "isNotMoving", + "state": "idleSettle" + }, + { + "var": "isMovingForward", + "state": "WALKFWD" + }, + { + "var": "isMovingRight", + "state": "STRAFERIGHT" + }, + { + "var": "isMovingLeft", + "state": "STRAFELEFT" + }, + { + "var": "isTurningRight", + "state": "turnRight" + }, + { + "var": "isTurningLeft", + "state": "turnLeft" + }, + { + "var": "isFlying", + "state": "fly" + }, + { + "var": "isTakeoffStand", + "state": "takeoffStand" + }, + { + "var": "isTakeoffRun", + "state": "TAKEOFFRUN" + }, + { + "var": "isInAirStand", + "state": "inAirStand" + }, + { + "var": "isInAirRun", + "state": "INAIRRUN" + }, + { + "var": "isMovingRightHmd", + "state": "strafeRightHmd" + }, + { + "var": "isMovingLeftHmd", + "state": "strafeLeftHmd" + } + ] + }, + { + "id": "STRAFERIGHT", + "interpTarget": 25, + "interpDuration": 8, + "interpType": "snapshotPrev", + "transitions": [ + { + "var": "isNotMoving", + "state": "idleSettle" + }, + { + "var": "isMovingForward", + "state": "WALKFWD" + }, + { + "var": "isMovingBackward", + "state": "WALKBWD" + }, + { + "var": "isMovingLeft", + "state": "STRAFELEFT" + }, + { + "var": "isTurningRight", + "state": "turnRight" + }, + { + "var": "isTurningLeft", + "state": "turnLeft" + }, + { + "var": "isFlying", + "state": "fly" + }, + { + "var": "isTakeoffStand", + "state": "takeoffStand" + }, + { + "var": "isTakeoffRun", + "state": "TAKEOFFRUN" + }, + { + "var": "isInAirStand", + "state": "inAirStand" + }, + { + "var": "isInAirRun", + "state": "INAIRRUN" + }, + { + "var": "isMovingRightHmd", + "state": "strafeRightHmd" + }, + { + "var": "isMovingLeftHmd", + "state": "strafeLeftHmd" + } + ] + }, + { + "id": "STRAFELEFT", + "interpTarget": 25, + "interpDuration": 8, + "interpType": "snapshotPrev", + "transitions": [ + { + "var": "isNotMoving", + "state": "idleSettle" + }, + { + "var": "isMovingForward", + "state": "WALKFWD" + }, + { + "var": "isMovingBackward", + "state": "WALKBWD" + }, + { + "var": "isMovingRight", + "state": "STRAFERIGHT" + }, + { + "var": "isTurningRight", + "state": "turnRight" + }, + { + "var": "isTurningLeft", + "state": "turnLeft" + }, + { + "var": "isFlying", + "state": "fly" + }, + { + "var": "isTakeoffStand", + "state": "takeoffStand" + }, + { + "var": "isTakeoffRun", + "state": "TAKEOFFRUN" + }, + { + "var": "isInAirStand", + "state": "inAirStand" + }, + { + "var": "isInAirRun", + "state": "INAIRRUN" + }, + { + "var": "isMovingRightHmd", + "state": "strafeRightHmd" + }, + { + "var": "isMovingLeftHmd", + "state": "strafeLeftHmd" + } + ] + }, + { + "id": "turnRight", + "interpTarget": 6, + "interpDuration": 8, + "transitions": [ + { + "var": "isNotTurning", + "state": "idle" + }, + { + "var": "isMovingForward", + "state": "WALKFWD" + }, + { + "var": "isMovingBackward", + "state": "WALKBWD" + }, + { + "var": "isMovingRight", + "state": "STRAFERIGHT" + }, + { + "var": "isMovingLeft", + "state": "STRAFELEFT" + }, + { + "var": "isTurningLeft", + "state": "turnLeft" + }, + { + "var": "isFlying", + "state": "fly" + }, + { + "var": "isTakeoffStand", + "state": "takeoffStand" + }, + { + "var": "isTakeoffRun", + "state": "TAKEOFFRUN" + }, + { + "var": "isInAirStand", + "state": "inAirStand" + }, + { + "var": "isInAirRun", + "state": "INAIRRUN" + }, + { + "var": "isMovingRightHmd", + "state": "strafeRightHmd" + }, + { + "var": "isMovingLeftHmd", + "state": "strafeLeftHmd" + } + ] + }, + { + "id": "turnLeft", + "interpTarget": 6, + "interpDuration": 8, + "transitions": [ + { + "var": "isNotTurning", + "state": "idle" + }, + { + "var": "isMovingForward", + "state": "WALKFWD" + }, + { + "var": "isMovingBackward", + "state": "WALKBWD" + }, + { + "var": "isMovingRight", + "state": "STRAFERIGHT" + }, + { + "var": "isMovingLeft", + "state": "STRAFELEFT" + }, + { + "var": "isTurningRight", + "state": "turnRight" + }, + { + "var": "isFlying", + "state": "fly" + }, + { + "var": "isTakeoffStand", + "state": "takeoffStand" + }, + { + "var": "isTakeoffRun", + "state": "TAKEOFFRUN" + }, + { + "var": "isInAirStand", + "state": "inAirStand" + }, + { + "var": "isInAirRun", + "state": "INAIRRUN" + }, + { + "var": "isMovingRightHmd", + "state": "strafeRightHmd" + }, + { + "var": "isMovingLeftHmd", + "state": "strafeLeftHmd" + } + ] + }, + { + "id": "strafeRightHmd", + "interpTarget": 5, + "interpDuration": 8, + "interpType": "snapshotPrev", + "transitions": [ + { + "var": "isNotMoving", + "state": "idleSettle" + }, + { + "var": "isMovingForward", + "state": "WALKFWD" + }, + { + "var": "isMovingBackward", + "state": "WALKBWD" + }, + { + "var": "isMovingLeftHmd", + "state": "strafeLeftHmd" + }, + { + "var": "isMovingRight", + "state": "STRAFERIGHT" + }, + { + "var": "isMovingLeft", + "state": "STRAFELEFT" + }, + { + "var": "isTurningRight", + "state": "turnRight" + }, + { + "var": "isTurningLeft", + "state": "turnLeft" + }, + { + "var": "isFlying", + "state": "fly" + }, + { + "var": "isTakeoffStand", + "state": "takeoffStand" + }, + { + "var": "isTakeoffRun", + "state": "TAKEOFFRUN" + }, + { + "var": "isInAirStand", + "state": "inAirStand" + }, + { + "var": "isInAirRun", + "state": "INAIRRUN" + } + ] + }, + { + "id": "strafeLeftHmd", + "interpTarget": 5, + "interpDuration": 8, + "interpType": "snapshotPrev", + "transitions": [ + { + "var": "isNotMoving", + "state": "idleSettle" + }, + { + "var": "isMovingForward", + "state": "WALKFWD" + }, + { + "var": "isMovingBackward", + "state": "WALKBWD" + }, + { + "var": "isMovingRightHmd", + "state": "strafeRightHmd" + }, + { + "var": "isMovingRight", + "state": "STRAFERIGHT" + }, + { + "var": "isMovingLeft", + "state": "STRAFELEFT" + }, + { + "var": "isTurningRight", + "state": "turnRight" + }, + { + "var": "isTurningLeft", + "state": "turnLeft" + }, + { + "var": "isFlying", + "state": "fly" + }, + { + "var": "isTakeoffStand", + "state": "takeoffStand" + }, + { + "var": "isTakeoffRun", + "state": "TAKEOFFRUN" + }, + { + "var": "isInAirStand", + "state": "inAirStand" + }, + { + "var": "isInAirRun", + "state": "INAIRRUN" + } + ] + }, + { + "id": "fly", + "interpTarget": 6, + "interpDuration": 6, + "transitions": [ + { + "var": "isNotFlying", + "state": "idleSettle" + } + ] + }, + { + "id": "takeoffStand", + "interpTarget": 2, + "interpDuration": 2, + "transitions": [ + { + "var": "isNotTakeoff", + "state": "inAirStand" + } + ] + }, + { + "id": "TAKEOFFRUN", + "interpTarget": 2, + "interpDuration": 2, + "transitions": [ + { + "var": "isNotTakeoff", + "state": "INAIRRUN" + } + ] + }, + { + "id": "inAirStand", + "interpTarget": 3, + "interpDuration": 3, + "interpType": "snapshotPrev", + "transitions": [ + { + "var": "isNotInAir", + "state": "landStandImpact" + } + ] + }, + { + "id": "INAIRRUN", + "interpTarget": 3, + "interpDuration": 3, + "interpType": "snapshotPrev", + "transitions": [ + { + "var": "isNotInAir", + "state": "WALKFWD" + } + ] + }, + { + "id": "landStandImpact", + "interpTarget": 1, + "interpDuration": 1, + "transitions": [ + { + "var": "isFlying", + "state": "fly" + }, + { + "var": "isTakeoffStand", + "state": "takeoffStand" + }, + { + "var": "isTakeoffRun", + "state": "TAKEOFFRUN" + }, + { + "var": "landStandImpactOnDone", + "state": "landStand" + } + ] + }, + { + "id": "landStand", + "interpTarget": 1, + "interpDuration": 1, + "transitions": [ + { + "var": "isMovingForward", + "state": "WALKFWD" + }, + { + "var": "isMovingBackward", + "state": "WALKBWD" + }, + { + "var": "isMovingRight", + "state": "STRAFERIGHT" + }, + { + "var": "isMovingLeft", + "state": "STRAFELEFT" + }, + { + "var": "isTurningRight", + "state": "turnRight" + }, + { + "var": "isTurningLeft", + "state": "turnLeft" + }, + { + "var": "isFlying", + "state": "fly" + }, + { + "var": "isTakeoffStand", + "state": "takeoffStand" + }, + { + "var": "isTakeoffRun", + "state": "TAKEOFFRUN" + }, + { + "var": "isInAirStand", + "state": "inAirStand" + }, + { + "var": "isInAirRun", + "state": "INAIRRUN" + }, + { + "var": "landStandOnDone", + "state": "idle" + }, + { + "var": "isMovingRightHmd", + "state": "strafeRightHmd" + }, + { + "var": "isMovingLeftHmd", + "state": "strafeLeftHmd" + } + ] + }, + { + "id": "LANDRUN", + "interpTarget": 2, + "interpDuration": 2, + "transitions": [ + { + "var": "isFlying", + "state": "fly" + }, + { + "var": "isTakeoffStand", + "state": "takeoffStand" + }, + { + "var": "isTakeoffRun", + "state": "TAKEOFFRUN" + }, + { + "var": "landRunOnDone", + "state": "WALKFWD" + } + ] + } + ] }, "children": [ { - "id": "walkFwdShort_c", - "type": "clip", + "id": "idle", + "type": "stateMachine", "data": { - "url": "qrc:///avatar/animations/walk_short_fwd.fbx", - "startFrame": 0.0, - "endFrame": 39.0, - "timeScale": 1.0, - "loopFlag": true + "currentState": "idleStand", + "states": [ + { + "id": "idleStand", + "interpTarget": 6, + "interpDuration": 10, + "transitions": [ + { + "var": "isTalking", + "state": "idleTalk" + } + ] + }, + { + "id": "idleTalk", + "interpTarget": 6, + "interpDuration": 10, + "transitions": [ + { + "var": "notIsTalking", + "state": "idleStand" + } + ] + } + ] }, - "children": [] + "children": [ + { + "id": "idleStand", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/idle.fbx", + "startFrame": 0.0, + "endFrame": 300.0, + "timeScale": 1.0, + "loopFlag": true + }, + "children": [] + }, + { + "id": "idleTalk", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/talk.fbx", + "startFrame": 0.0, + "endFrame": 800.0, + "timeScale": 1.0, + "loopFlag": true + }, + "children": [] + } + ] }, { - "id": "walkFwdNormal_c", - "type": "clip", + "id": "WALKFWD", + "type": "blendLinearMove", "data": { - "url": "qrc:///avatar/animations/walk_fwd.fbx", - "startFrame": 0.0, - "endFrame": 30.0, - "timeScale": 1.0, - "loopFlag": true + "alpha": 0.0, + "desiredSpeed": 1.4, + "characteristicSpeeds": [ 0.5, 1.8, 2.3, 3.2, 4.5 ], + "alphaVar": "moveForwardAlpha", + "desiredSpeedVar": "moveForwardSpeed" }, - "children": [] + "children": [ + { + "id": "walkFwdShort_c", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/walk_short_fwd.fbx", + "startFrame": 0.0, + "endFrame": 39.0, + "timeScale": 1.0, + "loopFlag": true + }, + "children": [] + }, + { + "id": "walkFwdNormal_c", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/walk_fwd.fbx", + "startFrame": 0.0, + "endFrame": 30.0, + "timeScale": 1.0, + "loopFlag": true + }, + "children": [] + }, + { + "id": "walkFwdFast_c", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/walk_fwd_fast.fbx", + "startFrame": 0.0, + "endFrame": 25.0, + "timeScale": 1.0, + "loopFlag": true + }, + "children": [] + }, + { + "id": "walkFwdJog_c", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/jog_fwd.fbx", + "startFrame": 0.0, + "endFrame": 25.0, + "timeScale": 1.0, + "loopFlag": true + }, + "children": [] + }, + { + "id": "walkFwdRun_c", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/run_fwd.fbx", + "startFrame": 0.0, + "endFrame": 21.0, + "timeScale": 1.0, + "loopFlag": true + }, + "children": [] + } + ] }, { - "id": "walkFwdFast_c", + "id": "idleToWalkFwd", "type": "clip", "data": { - "url": "qrc:///avatar/animations/walk_fwd_fast.fbx", - "startFrame": 0.0, - "endFrame": 25.0, - "timeScale": 1.0, - "loopFlag": true - }, - "children": [] - }, - { - "id": "walkFwdJog_c", - "type": "clip", - "data": { - "url": "qrc:///avatar/animations/jog_fwd.fbx", - "startFrame": 0.0, - "endFrame": 25.0, - "timeScale": 1.0, - "loopFlag": true - }, - "children": [] - }, - { - "id": "walkFwdRun_c", - "type": "clip", - "data": { - "url": "qrc:///avatar/animations/run_fwd.fbx", - "startFrame": 0.0, - "endFrame": 21.0, - "timeScale": 1.0, - "loopFlag": true - }, - "children": [] - } - ] - }, - { - "id": "idleToWalkFwd", - "type": "clip", - "data": { - "url": "qrc:///avatar/animations/idle_to_walk.fbx", - "startFrame": 1.0, - "endFrame": 13.0, - "timeScale": 1.0, - "loopFlag": false - }, - "children": [] - }, - { - "id": "idleSettle", - "type": "clip", - "data": { - "url": "qrc:///avatar/animations/settle_to_idle.fbx", - "startFrame": 1.0, - "endFrame": 59.0, - "timeScale": 1.0, - "loopFlag": false - }, - "children": [] - }, - { - "id": "WALKBWD", - "type": "blendLinearMove", - "data": { - "alpha": 0.0, - "desiredSpeed": 1.4, - "characteristicSpeeds": [0.6, 1.6, 2.3, 3.1], - "alphaVar": "moveBackwardAlpha", - "desiredSpeedVar": "moveBackwardSpeed" - }, - "children": [ - { - "id": "walkBwdShort_c", - "type": "clip", - "data": { - "url": "qrc:///avatar/animations/walk_short_bwd.fbx", - "startFrame": 0.0, - "endFrame": 38.0, - "timeScale": 1.0, - "loopFlag": true - }, - "children": [] - }, - { - "id": "walkBwdFast_c", - "type": "clip", - "data": { - "url": "qrc:///avatar/animations/walk_bwd_fast.fbx", - "startFrame": 0.0, - "endFrame": 27.0, - "timeScale": 1.0, - "loopFlag": true - }, - "children": [] - }, - { - "id": "jogBwd_c", - "type": "clip", - "data": { - "url": "qrc:///avatar/animations/jog_bwd.fbx", - "startFrame": 0.0, - "endFrame": 24.0, - "timeScale": 1.0, - "loopFlag": true - }, - "children": [] - }, - { - "id": "runBwd_c", - "type": "clip", - "data": { - "url": "qrc:///avatar/animations/run_bwd.fbx", - "startFrame": 0.0, - "endFrame": 16.0, - "timeScale": 1.0, - "loopFlag": true - }, - "children": [] - } - ] - }, - { - "id": "turnLeft", - "type": "clip", - "data": { - "url": "qrc:///avatar/animations/turn_left.fbx", - "startFrame": 0.0, - "endFrame": 32.0, - "timeScale": 1.0, - "loopFlag": true - }, - "children": [] - }, - { - "id": "turnRight", - "type": "clip", - "data": { - "url": "qrc:///avatar/animations/turn_left.fbx", - "startFrame": 0.0, - "endFrame": 32.0, - "timeScale": 1.0, - "loopFlag": true, - "mirrorFlag": true - }, - "children": [] - }, - { - "id": "STRAFELEFT", - "type": "blendLinearMove", - "data": { - "alpha": 0.0, - "desiredSpeed": 1.4, - "characteristicSpeeds": [0.1, 0.5, 1.0, 2.6, 3.0], - "alphaVar": "moveLateralAlpha", - "desiredSpeedVar": "moveLateralSpeed" - }, - "children": [ - { - "id": "strafeLeftShortStep_c", - "type": "clip", - "data": { - "url": "qrc:///avatar/animations/side_step_short_left.fbx", - "startFrame": 0.0, - "endFrame": 29.0, - "timeScale": 1.0, - "loopFlag": true - }, - "children": [] - }, - { - "id": "strafeLeftStep_c", - "type": "clip", - "data": { - "url": "qrc:///avatar/animations/side_step_left.fbx", - "startFrame": 0.0, - "endFrame": 20.0, - "timeScale": 1.0, - "loopFlag": true - }, - "children": [] - }, - { - "id": "strafeLeftWalk_c", - "type": "clip", - "data": { - "url": "qrc:///avatar/animations/walk_left.fbx", - "startFrame": 0.0, - "endFrame": 35.0, - "timeScale": 1.0, - "loopFlag": true - }, - "children": [] - }, - { - "id": "strafeLeftWalkFast_c", - "type": "clip", - "data": { - "url": "qrc:///avatar/animations/walk_left_fast.fbx", - "startFrame": 0.0, - "endFrame": 21.0, - "timeScale": 1.0, - "loopFlag": true - }, - "children": [] - }, - { - "id": "strafeLeftJog_c", - "type": "clip", - "data": { - "url": "qrc:///avatar/animations/jog_left.fbx", - "startFrame": 0.0, - "endFrame": 24.0, - "timeScale": 1.0, - "loopFlag": true - }, - "children": [] - } - ] - }, - { - "id": "STRAFERIGHT", - "type": "blendLinearMove", - "data": { - "alpha": 0.0, - "desiredSpeed": 1.4, - "characteristicSpeeds": [0.1, 0.5, 1.0, 2.6, 3.0], - "alphaVar": "moveLateralAlpha", - "desiredSpeedVar": "moveLateralSpeed" - }, - "children": [ { - "id": "strafeRightShortStep_c", - "type": "clip", - "data": { - "url": "qrc:///avatar/animations/side_step_short_left.fbx", - "startFrame": 0.0, - "endFrame": 29.0, - "timeScale": 1.0, - "loopFlag": true, - "mirrorFlag": true - }, - "children": [] - }, - { - "id": "strafeRightStep_c", - "type": "clip", - "data": { - "url": "qrc:///avatar/animations/side_step_left.fbx", - "startFrame": 0.0, - "endFrame": 20.0, - "timeScale": 1.0, - "loopFlag": true, - "mirrorFlag": true - }, - "children": [] - }, - { - "id": "strafeRightWalk_c", - "type": "clip", - "data": { - "url": "qrc:///avatar/animations/walk_left.fbx", - "startFrame": 0.0, - "endFrame": 35.0, - "timeScale": 1.0, - "loopFlag": true, - "mirrorFlag": true - }, - "children": [] - }, - { - "id": "strafeRightFast_c", - "type": "clip", - "data": { - "url": "qrc:///avatar/animations/walk_left_fast.fbx", - "startFrame": 0.0, - "endFrame": 21.0, - "timeScale": 1.0, - "loopFlag": true, - "mirrorFlag": true - }, - "children": [] - }, - { - "id": "strafeRightJog_c", - "type": "clip", - "data": { - "url": "qrc:///avatar/animations/jog_left.fbx", - "startFrame": 0.0, - "endFrame": 24.0, - "timeScale": 1.0, - "loopFlag": true, - "mirrorFlag": true - }, - "children": [] - } - ] - }, - { - "id": "strafeLeftHmd", - "type": "blendLinearMove", - "data": { - "alpha": 0.0, - "desiredSpeed": 1.4, - "characteristicSpeeds": [0, 0.5, 2.5], - "alphaVar": "moveLateralAlpha", - "desiredSpeedVar": "moveLateralSpeed" - }, - "children": [ - { - "id": "stepLeftShort_c", - "type": "clip", - "data": { - "url": "qrc:///avatar/animations/side_step_short_left.fbx", - "startFrame": 0.0, - "endFrame": 29.0, - "timeScale": 1.0, - "loopFlag": true - }, - "children": [] - }, - { - "id": "stepLeft_c", - "type": "clip", - "data": { - "url": "qrc:///avatar/animations/side_step_left.fbx", - "startFrame": 0.0, - "endFrame": 20.0, - "timeScale": 1.0, - "loopFlag": true - }, - "children": [] - }, - { - "id": "strafeLeftAnim_c", - "type": "clip", - "data": { - "url": "qrc:///avatar/animations/side_step_left_fast.fbx", - "startFrame": 0.0, - "endFrame": 16.0, - "timeScale": 1.0, - "loopFlag": true - }, - "children": [] - } - ] - }, - { - "id": "strafeRightHmd", - "type": "blendLinearMove", - "data": { - "alpha": 0.0, - "desiredSpeed": 1.4, - "characteristicSpeeds": [0, 0.5, 2.5], - "alphaVar": "moveLateralAlpha", - "desiredSpeedVar": "moveLateralSpeed" - }, - "children": [ - { - "id": "stepRightShort_c", - "type": "clip", - "data": { - "url": "qrc:///avatar/animations/side_step_short_left.fbx", - "startFrame": 0.0, - "endFrame": 29.0, - "timeScale": 1.0, - "loopFlag": true, - "mirrorFlag": true - }, - "children": [] - }, - { - "id": "stepRight_c", - "type": "clip", - "data": { - "url": "qrc:///avatar/animations/side_step_left.fbx", - "startFrame": 0.0, - "endFrame": 20.0, - "timeScale": 1.0, - "loopFlag": true, - "mirrorFlag": true - }, - "children": [] - }, - { - "id": "strafeRightAnim_c", - "type": "clip", - "data": { - "url": "qrc:///avatar/animations/side_step_left_fast.fbx", - "startFrame": 0.0, - "endFrame": 16.0, - "timeScale": 1.0, - "loopFlag": true, - "mirrorFlag": true - }, - "children": [] - } - ] - }, - { - "id": "fly", - "type": "clip", - "data": { - "url": "qrc:///avatar/animations/fly.fbx", - "startFrame": 1.0, - "endFrame": 80.0, - "timeScale": 1.0, - "loopFlag": true - }, - "children": [] - }, - { - "id": "takeoffStand", - "type": "clip", - "data": { - "url": "qrc:///avatar/animations/jump_standing_launch.fbx", - "startFrame": 2.0, - "endFrame": 16.0, - "timeScale": 1.0, - "loopFlag": false - }, - "children": [] - }, - { - "id": "TAKEOFFRUN", - "type": "clip", - "data": { - "url": "qrc:///avatar/animations/jump_running_launch_land.fbx", - "startFrame": 4.0, - "endFrame": 15.0, - "timeScale": 1.0, - "loopFlag": false - }, - "children": [] - }, - { - "id": "inAirStand", - "type": "blendLinear", - "data": { - "alpha": 0.0, - "alphaVar": "inAirAlpha" - }, - "children": [ - { - "id": "inAirStandPreApex", - "type": "clip", - "data": { - "url": "qrc:///avatar/animations/jump_standing_apex.fbx", - "startFrame": 0.0, - "endFrame": 0.0, - "timeScale": 1.0, - "loopFlag": false - }, - "children": [] - }, - { - "id": "inAirStandApex", - "type": "clip", - "data": { - "url": "qrc:///avatar/animations/jump_standing_apex.fbx", + "url": "qrc:///avatar/animations/idle_to_walk.fbx", "startFrame": 1.0, - "endFrame": 1.0, + "endFrame": 13.0, "timeScale": 1.0, "loopFlag": false }, "children": [] }, { - "id": "inAirStandPostApex", + "id": "idleSettle", "type": "clip", "data": { - "url": "qrc:///avatar/animations/jump_standing_apex.fbx", - "startFrame": 2.0, - "endFrame": 2.0, + "url": "qrc:///avatar/animations/settle_to_idle.fbx", + "startFrame": 1.0, + "endFrame": 59.0, "timeScale": 1.0, "loopFlag": false }, "children": [] - } - ] - }, - { - "id": "INAIRRUN", - "type": "blendLinear", - "data": { - "alpha": 0.0, - "alphaVar": "inAirAlpha" - }, - "children": [ + }, { - "id": "inAirRunPreApex", + "id": "WALKBWD", + "type": "blendLinearMove", + "data": { + "alpha": 0.0, + "desiredSpeed": 1.4, + "characteristicSpeeds": [ 0.6, 1.6, 2.3, 3.1 ], + "alphaVar": "moveBackwardAlpha", + "desiredSpeedVar": "moveBackwardSpeed" + }, + "children": [ + { + "id": "walkBwdShort_c", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/walk_short_bwd.fbx", + "startFrame": 0.0, + "endFrame": 38.0, + "timeScale": 1.0, + "loopFlag": true + }, + "children": [] + }, + { + "id": "walkBwdFast_c", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/walk_bwd_fast.fbx", + "startFrame": 0.0, + "endFrame": 27.0, + "timeScale": 1.0, + "loopFlag": true + }, + "children": [] + }, + { + "id": "jogBwd_c", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/jog_bwd.fbx", + "startFrame": 0.0, + "endFrame": 24.0, + "timeScale": 1.0, + "loopFlag": true + }, + "children": [] + }, + { + "id": "runBwd_c", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/run_bwd.fbx", + "startFrame": 0.0, + "endFrame": 16.0, + "timeScale": 1.0, + "loopFlag": true + }, + "children": [] + } + ] + }, + { + "id": "turnLeft", "type": "clip", "data": { - "url": "qrc:///avatar/animations/jump_running_launch_land.fbx", - "startFrame": 16.0, + "url": "qrc:///avatar/animations/turn_left.fbx", + "startFrame": 0.0, + "endFrame": 32.0, + "timeScale": 1.0, + "loopFlag": true + }, + "children": [] + }, + { + "id": "turnRight", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/turn_left.fbx", + "startFrame": 0.0, + "endFrame": 32.0, + "timeScale": 1.0, + "loopFlag": true, + "mirrorFlag": true + }, + "children": [] + }, + { + "id": "STRAFELEFT", + "type": "blendLinearMove", + "data": { + "alpha": 0.0, + "desiredSpeed": 1.4, + "characteristicSpeeds": [ 0.1, 0.5, 1.0, 2.6, 3.0 ], + "alphaVar": "moveLateralAlpha", + "desiredSpeedVar": "moveLateralSpeed" + }, + "children": [ + { + "id": "strafeLeftShortStep_c", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/side_step_short_left.fbx", + "startFrame": 0.0, + "endFrame": 29.0, + "timeScale": 1.0, + "loopFlag": true + }, + "children": [] + }, + { + "id": "strafeLeftStep_c", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/side_step_left.fbx", + "startFrame": 0.0, + "endFrame": 20.0, + "timeScale": 1.0, + "loopFlag": true + }, + "children": [] + }, + { + "id": "strafeLeftWalk_c", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/walk_left.fbx", + "startFrame": 0.0, + "endFrame": 35.0, + "timeScale": 1.0, + "loopFlag": true + }, + "children": [] + }, + { + "id": "strafeLeftWalkFast_c", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/walk_left_fast.fbx", + "startFrame": 0.0, + "endFrame": 21.0, + "timeScale": 1.0, + "loopFlag": true + }, + "children": [] + }, + { + "id": "strafeLeftJog_c", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/jog_left.fbx", + "startFrame": 0.0, + "endFrame": 24.0, + "timeScale": 1.0, + "loopFlag": true + }, + "children": [] + } + ] + }, + { + "id": "STRAFERIGHT", + "type": "blendLinearMove", + "data": { + "alpha": 0.0, + "desiredSpeed": 1.4, + "characteristicSpeeds": [ 0.1, 0.5, 1.0, 2.6, 3.0 ], + "alphaVar": "moveLateralAlpha", + "desiredSpeedVar": "moveLateralSpeed" + }, + "children": [ + { + "id": "strafeRightShortStep_c", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/side_step_short_left.fbx", + "startFrame": 0.0, + "endFrame": 29.0, + "timeScale": 1.0, + "loopFlag": true, + "mirrorFlag": true + }, + "children": [] + }, + { + "id": "strafeRightStep_c", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/side_step_left.fbx", + "startFrame": 0.0, + "endFrame": 20.0, + "timeScale": 1.0, + "loopFlag": true, + "mirrorFlag": true + }, + "children": [] + }, + { + "id": "strafeRightWalk_c", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/walk_left.fbx", + "startFrame": 0.0, + "endFrame": 35.0, + "timeScale": 1.0, + "loopFlag": true, + "mirrorFlag": true + }, + "children": [] + }, + { + "id": "strafeRightFast_c", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/walk_left_fast.fbx", + "startFrame": 0.0, + "endFrame": 21.0, + "timeScale": 1.0, + "loopFlag": true, + "mirrorFlag": true + }, + "children": [] + }, + { + "id": "strafeRightJog_c", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/jog_left.fbx", + "startFrame": 0.0, + "endFrame": 24.0, + "timeScale": 1.0, + "loopFlag": true, + "mirrorFlag": true + }, + "children": [] + } + ] + }, + { + "id": "strafeLeftHmd", + "type": "blendLinearMove", + "data": { + "alpha": 0.0, + "desiredSpeed": 1.4, + "characteristicSpeeds": [ 0, 0.5, 2.5 ], + "alphaVar": "moveLateralAlpha", + "desiredSpeedVar": "moveLateralSpeed" + }, + "children": [ + { + "id": "stepLeftShort_c", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/side_step_short_left.fbx", + "startFrame": 0.0, + "endFrame": 29.0, + "timeScale": 1.0, + "loopFlag": true + }, + "children": [] + }, + { + "id": "stepLeft_c", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/side_step_left.fbx", + "startFrame": 0.0, + "endFrame": 20.0, + "timeScale": 1.0, + "loopFlag": true + }, + "children": [] + }, + { + "id": "strafeLeftAnim_c", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/side_step_left_fast.fbx", + "startFrame": 0.0, + "endFrame": 16.0, + "timeScale": 1.0, + "loopFlag": true + }, + "children": [] + } + ] + }, + { + "id": "strafeRightHmd", + "type": "blendLinearMove", + "data": { + "alpha": 0.0, + "desiredSpeed": 1.4, + "characteristicSpeeds": [ 0, 0.5, 2.5 ], + "alphaVar": "moveLateralAlpha", + "desiredSpeedVar": "moveLateralSpeed" + }, + "children": [ + { + "id": "stepRightShort_c", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/side_step_short_left.fbx", + "startFrame": 0.0, + "endFrame": 29.0, + "timeScale": 1.0, + "loopFlag": true, + "mirrorFlag": true + }, + "children": [] + }, + { + "id": "stepRight_c", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/side_step_left.fbx", + "startFrame": 0.0, + "endFrame": 20.0, + "timeScale": 1.0, + "loopFlag": true, + "mirrorFlag": true + }, + "children": [] + }, + { + "id": "strafeRightAnim_c", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/side_step_left_fast.fbx", + "startFrame": 0.0, + "endFrame": 16.0, + "timeScale": 1.0, + "loopFlag": true, + "mirrorFlag": true + }, + "children": [] + } + ] + }, + { + "id": "fly", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/fly.fbx", + "startFrame": 1.0, + "endFrame": 80.0, + "timeScale": 1.0, + "loopFlag": true + }, + "children": [] + }, + { + "id": "takeoffStand", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/jump_standing_launch.fbx", + "startFrame": 2.0, "endFrame": 16.0, "timeScale": 1.0, "loopFlag": false @@ -1489,66 +2021,146 @@ "children": [] }, { - "id": "inAirRunApex", + "id": "TAKEOFFRUN", "type": "clip", "data": { "url": "qrc:///avatar/animations/jump_running_launch_land.fbx", - "startFrame": 22.0, - "endFrame": 22.0, + "startFrame": 4.0, + "endFrame": 15.0, "timeScale": 1.0, "loopFlag": false }, "children": [] }, { - "id": "inAirRunPostApex", + "id": "inAirStand", + "type": "blendLinear", + "data": { + "alpha": 0.0, + "alphaVar": "inAirAlpha" + }, + "children": [ + { + "id": "inAirStandPreApex", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/jump_standing_apex.fbx", + "startFrame": 0.0, + "endFrame": 0.0, + "timeScale": 1.0, + "loopFlag": false + }, + "children": [] + }, + { + "id": "inAirStandApex", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/jump_standing_apex.fbx", + "startFrame": 1.0, + "endFrame": 1.0, + "timeScale": 1.0, + "loopFlag": false + }, + "children": [] + }, + { + "id": "inAirStandPostApex", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/jump_standing_apex.fbx", + "startFrame": 2.0, + "endFrame": 2.0, + "timeScale": 1.0, + "loopFlag": false + }, + "children": [] + } + ] + }, + { + "id": "INAIRRUN", + "type": "blendLinear", + "data": { + "alpha": 0.0, + "alphaVar": "inAirAlpha" + }, + "children": [ + { + "id": "inAirRunPreApex", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/jump_running_launch_land.fbx", + "startFrame": 16.0, + "endFrame": 16.0, + "timeScale": 1.0, + "loopFlag": false + }, + "children": [] + }, + { + "id": "inAirRunApex", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/jump_running_launch_land.fbx", + "startFrame": 22.0, + "endFrame": 22.0, + "timeScale": 1.0, + "loopFlag": false + }, + "children": [] + }, + { + "id": "inAirRunPostApex", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/jump_running_launch_land.fbx", + "startFrame": 33.0, + "endFrame": 33.0, + "timeScale": 1.0, + "loopFlag": false + }, + "children": [] + } + ] + }, + { + "id": "landStandImpact", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/jump_standing_land_settle.fbx", + "startFrame": 1.0, + "endFrame": 6.0, + "timeScale": 1.0, + "loopFlag": false + }, + "children": [] + }, + { + "id": "landStand", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/jump_standing_land_settle.fbx", + "startFrame": 6.0, + "endFrame": 68.0, + "timeScale": 1.0, + "loopFlag": false + }, + "children": [] + }, + { + "id": "LANDRUN", "type": "clip", "data": { "url": "qrc:///avatar/animations/jump_running_launch_land.fbx", - "startFrame": 33.0, - "endFrame": 33.0, + "startFrame": 29.0, + "endFrame": 40.0, "timeScale": 1.0, "loopFlag": false }, "children": [] } ] - }, - { - "id": "landStandImpact", - "type": "clip", - "data": { - "url": "qrc:///avatar/animations/jump_standing_land_settle.fbx", - "startFrame": 1.0, - "endFrame": 6.0, - "timeScale": 1.0, - "loopFlag": false - }, - "children": [] - }, - { - "id": "landStand", - "type": "clip", - "data": { - "url": "qrc:///avatar/animations/jump_standing_land_settle.fbx", - "startFrame": 6.0, - "endFrame": 68.0, - "timeScale": 1.0, - "loopFlag": false - }, - "children": [] - }, - { - "id": "LANDRUN", - "type": "clip", - "data": { - "url": "qrc:///avatar/animations/jump_running_launch_land.fbx", - "startFrame": 29.0, - "endFrame": 40.0, - "timeScale": 1.0, - "loopFlag": false - }, - "children": [] } ] } diff --git a/libraries/animation/src/AnimNodeLoader.cpp b/libraries/animation/src/AnimNodeLoader.cpp index 562a614b4a..ec9099df8b 100644 --- a/libraries/animation/src/AnimNodeLoader.cpp +++ b/libraries/animation/src/AnimNodeLoader.cpp @@ -63,6 +63,7 @@ static const char* animNodeTypeToString(AnimNode::Type type) { case AnimNode::Type::InverseKinematics: return "inverseKinematics"; case AnimNode::Type::DefaultPose: return "defaultPose"; case AnimNode::Type::TwoBoneIK: return "twoBoneIK"; + case AnimNode::Type::SplineIK: return "splineIK"; case AnimNode::Type::PoleVectorConstraint: return "poleVectorConstraint"; case AnimNode::Type::NumTypes: return nullptr; }; diff --git a/libraries/animation/src/AnimStateMachine.cpp b/libraries/animation/src/AnimStateMachine.cpp index fb13b8e71c..3042ad20f0 100644 --- a/libraries/animation/src/AnimStateMachine.cpp +++ b/libraries/animation/src/AnimStateMachine.cpp @@ -22,7 +22,7 @@ AnimStateMachine::~AnimStateMachine() { } const AnimPoseVec& AnimStateMachine::evaluate(const AnimVariantMap& animVars, const AnimContext& context, float dt, AnimVariantMap& triggersOut) { - + qCDebug(animation) << "evaluating state machine"; float parentDebugAlpha = context.getDebugAlpha(_id); QString desiredStateID = animVars.lookup(_currentStateVar, _currentState->getID()); diff --git a/libraries/animation/src/AnimTwoBoneIK.cpp b/libraries/animation/src/AnimTwoBoneIK.cpp index 8960b15940..d970e6b862 100644 --- a/libraries/animation/src/AnimTwoBoneIK.cpp +++ b/libraries/animation/src/AnimTwoBoneIK.cpp @@ -46,10 +46,13 @@ AnimTwoBoneIK::~AnimTwoBoneIK() { const AnimPoseVec& AnimTwoBoneIK::evaluate(const AnimVariantMap& animVars, const AnimContext& context, float dt, AnimVariantMap& triggersOut) { + qCDebug(animation) << "evaluating the 2 bone IK"; + assert(_children.size() == 1); if (_children.size() != 1) { return _poses; } + // evalute underPoses AnimPoseVec underPoses = _children[0]->evaluate(animVars, context, dt, triggersOut); From bd9405aef82575972fa3340c2907c50ac45f9601 Mon Sep 17 00:00:00 2001 From: amantley Date: Thu, 10 Jan 2019 10:27:15 -0800 Subject: [PATCH 008/436] add arm ik class for cleanup of inverse kinematics --- libraries/animation/src/AnimArmIK.cpp | 40 +++++++++++++++++++ libraries/animation/src/AnimArmIK.h | 34 ++++++++++++++++ .../animation/src/AnimInverseKinematics.cpp | 4 +- 3 files changed, 77 insertions(+), 1 deletion(-) create mode 100644 libraries/animation/src/AnimArmIK.cpp create mode 100644 libraries/animation/src/AnimArmIK.h diff --git a/libraries/animation/src/AnimArmIK.cpp b/libraries/animation/src/AnimArmIK.cpp new file mode 100644 index 0000000000..202e8c8420 --- /dev/null +++ b/libraries/animation/src/AnimArmIK.cpp @@ -0,0 +1,40 @@ +// +// AnimArmIK.cpp +// +// Created by Angus Antley on 1/9/19. +// Copyright (c) 2019 High Fidelity, Inc. All rights reserved. +// +// Distributed under the Apache License, Version 2.0. +// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html +// + +#include "AnimArmIK.h" + +#include + +#include "AnimationLogging.h" +#include "AnimUtil.h" + +AnimArmIK::AnimArmIK(const QString& id, float alpha, bool enabled, float interpDuration, + const QString& baseJointName, const QString& midJointName, + const QString& tipJointName, const glm::vec3& midHingeAxis, + const QString& alphaVar, const QString& enabledVar, + const QString& endEffectorRotationVarVar, const QString& endEffectorPositionVarVar) : + AnimTwoBoneIK(id, alpha, enabled, interpDuration, baseJointName, midJointName, tipJointName, midHingeAxis, alphaVar, enabledVar, endEffectorRotationVarVar, endEffectorPositionVarVar) { + +} + +AnimArmIK::~AnimArmIK() { + +} + +const AnimPoseVec& AnimArmIK::evaluate(const AnimVariantMap& animVars, const AnimContext& context, float dt, AnimVariantMap& triggersOut) { + qCDebug(animation) << "evaluating the arm IK"; + + assert(_children.size() == 1); + if (_children.size() != 1) { + return _poses; + } else { + return _poses; + } +} \ No newline at end of file diff --git a/libraries/animation/src/AnimArmIK.h b/libraries/animation/src/AnimArmIK.h new file mode 100644 index 0000000000..26f79a1b9c --- /dev/null +++ b/libraries/animation/src/AnimArmIK.h @@ -0,0 +1,34 @@ +// +// AnimArmIK.h +// +// Created by Angus Antley on 1/9/19. +// Copyright (c) 2019 High Fidelity, Inc. All rights reserved. +// +// Distributed under the Apache License, Version 2.0. +// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html +// + +#ifndef hifi_AnimArmIK_h +#define hifi_AnimArmIK_h + +//#include "AnimNode.h" +#include "AnimTwoBoneIK.h" +//#include "AnimChain.h" + +// Simple two bone IK chain +class AnimArmIK : public AnimTwoBoneIK { +public: + AnimArmIK(const QString& id, float alpha, bool enabled, float interpDuration, + const QString& baseJointName, const QString& midJointName, + const QString& tipJointName, const glm::vec3& midHingeAxis, + const QString& alphaVar, const QString& enabledVar, + const QString& endEffectorRotationVarVar, const QString& endEffectorPositionVarVar); + virtual ~AnimArmIK(); + virtual const AnimPoseVec& evaluate(const AnimVariantMap& animVars, const AnimContext& context, float dt, AnimVariantMap& triggersOut) override; + +protected: + +}; + +#endif // hifi_AnimArmIK_h + diff --git a/libraries/animation/src/AnimInverseKinematics.cpp b/libraries/animation/src/AnimInverseKinematics.cpp index a1809f3438..a6dcf5b2d9 100644 --- a/libraries/animation/src/AnimInverseKinematics.cpp +++ b/libraries/animation/src/AnimInverseKinematics.cpp @@ -237,6 +237,7 @@ void AnimInverseKinematics::solve(const AnimContext& context, const std::vector< // solve all targets for (size_t i = 0; i < targets.size(); i++) { + qCDebug(animation) << "target id: " << targets[i].getIndex() << " and type " << (int)targets[i].getType(); switch (targets[i].getType()) { case IKTarget::Type::Unknown: break; @@ -859,6 +860,7 @@ void AnimInverseKinematics::solveTargetWithSpline(const AnimContext& context, co //virtual const AnimPoseVec& AnimInverseKinematics::evaluate(const AnimVariantMap& animVars, const AnimContext& context, float dt, AnimVariantMap& triggersOut) { // don't call this function, call overlay() instead + qCDebug(animation) << "called evaluate for inverse kinematics"; assert(false); return _relativePoses; } @@ -869,7 +871,7 @@ const AnimPoseVec& AnimInverseKinematics::overlay(const AnimVariantMap& animVars // disable IK on android return underPoses; #endif - + qCDebug(animation) << "called overlay for inverse kinematics"; // allows solutionSource to be overridden by an animVar auto solutionSource = animVars.lookup(_solutionSourceVar, (int)_solutionSource); From 33ff5188c11b949fff7371c9ec155edffae0d52e Mon Sep 17 00:00:00 2001 From: amantley Date: Tue, 15 Jan 2019 18:28:29 -0800 Subject: [PATCH 009/436] adding the spline code to the splineik class --- libraries/animation/src/AnimSplineIK.cpp | 230 ++++++++++++++++++++++- libraries/animation/src/AnimSplineIK.h | 17 ++ 2 files changed, 246 insertions(+), 1 deletion(-) diff --git a/libraries/animation/src/AnimSplineIK.cpp b/libraries/animation/src/AnimSplineIK.cpp index db6b6864b1..65d7bfc821 100644 --- a/libraries/animation/src/AnimSplineIK.cpp +++ b/libraries/animation/src/AnimSplineIK.cpp @@ -44,10 +44,46 @@ const AnimPoseVec& AnimSplineIK::evaluate(const AnimVariantMap& animVars, const if (_children.size() != 1) { return _poses; } - // evalute underPoses AnimPoseVec underPoses = _children[0]->evaluate(animVars, context, dt, triggersOut); _poses = underPoses; + + // check to see if we actually need absolute poses. + AnimPoseVec absolutePoses; + absolutePoses.resize(_poses.size()); + computeAbsolutePoses(absolutePoses); + + IKTarget target; + int jointIndex = _skeleton->nameToJointIndex("Head"); + if (jointIndex != -1) { + target.setType(animVars.lookup("HeadType", (int)IKTarget::Type::RotationAndPosition)); + target.setIndex(jointIndex); + AnimPose absPose = _skeleton->getAbsolutePose(jointIndex, _poses); + glm::quat rotation = animVars.lookupRigToGeometry("headRotation", absPose.rot()); + glm::vec3 translation = animVars.lookupRigToGeometry("headPosition", absPose.trans()); + float weight = animVars.lookup("headWeight", "4.0"); + + target.setPose(rotation, translation); + target.setWeight(weight); + const float* flexCoefficients = new float[5]{ 1.0f, 0.5f, 0.25f, 0.2f, 0.1f }; + target.setFlexCoefficients(4, flexCoefficients); + + // record the index of the hips ik target. + if (target.getIndex() == _hipsIndex) { + _hipsTargetIndex = 1; + } + } + if (_poses.size() > 0) { + AnimChain jointChain; + jointChain.buildFromRelativePoses(_skeleton, _poses, target.getIndex()); + + // for each target solve target with spline + + solveTargetWithSpline(context, target, absolutePoses, false, jointChain); + qCDebug(animation) << "made it past the spline solve code"; + } + // we need to blend the old joint chain with the current joint chain, otherwise known as: _snapShotChain + /**/ return _poses; } @@ -66,6 +102,20 @@ void AnimSplineIK::lookUpIndices() { } } +void AnimSplineIK::computeAbsolutePoses(AnimPoseVec& absolutePoses) const { + int numJoints = (int)_poses.size(); + assert(numJoints <= _skeleton->getNumJoints()); + assert(numJoints == (int)absolutePoses.size()); + for (int i = 0; i < numJoints; ++i) { + int parentIndex = _skeleton->getParentIndex(i); + if (parentIndex < 0) { + absolutePoses[i] = _poses[i]; + } else { + absolutePoses[i] = absolutePoses[parentIndex] * _poses[i]; + } + } +} + // for AnimDebugDraw rendering const AnimPoseVec& AnimSplineIK::getPosesInternal() const { return _poses; @@ -73,5 +123,183 @@ const AnimPoseVec& AnimSplineIK::getPosesInternal() const { void AnimSplineIK::setSkeletonInternal(AnimSkeleton::ConstPointer skeleton) { AnimNode::setSkeletonInternal(skeleton); + _headIndex = _skeleton->nameToJointIndex("Head"); + _hipsIndex = _skeleton->nameToJointIndex("Hips"); lookUpIndices(); +} + +static CubicHermiteSplineFunctorWithArcLength computeSplineFromTipAndBase(const AnimPose& tipPose, const AnimPose& basePose, float baseGain = 1.0f, float tipGain = 1.0f) { + float linearDistance = glm::length(basePose.trans() - tipPose.trans()); + glm::vec3 p0 = basePose.trans(); + glm::vec3 m0 = baseGain * linearDistance * (basePose.rot() * Vectors::UNIT_Y); + glm::vec3 p1 = tipPose.trans(); + glm::vec3 m1 = tipGain * linearDistance * (tipPose.rot() * Vectors::UNIT_Y); + + return CubicHermiteSplineFunctorWithArcLength(p0, m0, p1, m1); +} + +void AnimSplineIK::solveTargetWithSpline(const AnimContext& context, const IKTarget& target, const AnimPoseVec& absolutePoses, bool debug, AnimChain& chainInfoOut) const { + + const int baseIndex = _hipsIndex; + + // build spline from tip to base + AnimPose tipPose = AnimPose(glm::vec3(1.0f), target.getRotation(), target.getTranslation()); + AnimPose basePose = absolutePoses[baseIndex]; + CubicHermiteSplineFunctorWithArcLength spline; + if (target.getIndex() == _headIndex) { + // set gain factors so that more curvature occurs near the tip of the spline. + const float HIPS_GAIN = 0.5f; + const float HEAD_GAIN = 1.0f; + spline = computeSplineFromTipAndBase(tipPose, basePose, HIPS_GAIN, HEAD_GAIN); + } else { + spline = computeSplineFromTipAndBase(tipPose, basePose); + } + float totalArcLength = spline.arcLength(1.0f); + + // This prevents the rotation interpolation from rotating the wrong physical way (but correct mathematical way) + // when the head is arched backwards very far. + glm::quat halfRot = safeLerp(basePose.rot(), tipPose.rot(), 0.5f); + if (glm::dot(halfRot * Vectors::UNIT_Z, basePose.rot() * Vectors::UNIT_Z) < 0.0f) { + tipPose.rot() = -tipPose.rot(); + } + qCDebug(animation) << "spot 1"; + // find or create splineJointInfo for this target + const std::vector* splineJointInfoVec = findOrCreateSplineJointInfo(context, target); + + if (splineJointInfoVec && splineJointInfoVec->size() > 0) { + const int baseParentIndex = _skeleton->getParentIndex(baseIndex); + AnimPose parentAbsPose = (baseParentIndex >= 0) ? absolutePoses[baseParentIndex] : AnimPose(); + qCDebug(animation) << "spot 2"; + // go thru splineJointInfoVec backwards (base to tip) + for (int i = (int)splineJointInfoVec->size() - 1; i >= 0; i--) { + const SplineJointInfo& splineJointInfo = (*splineJointInfoVec)[i]; + float t = spline.arcLengthInverse(splineJointInfo.ratio * totalArcLength); + glm::vec3 trans = spline(t); + + // for head splines, preform most twist toward the tip by using ease in function. t^2 + float rotT = t; + if (target.getIndex() == _headIndex) { + rotT = t * t; + } + glm::quat twistRot = safeLerp(basePose.rot(), tipPose.rot(), rotT); + + // compute the rotation by using the derivative of the spline as the y-axis, and the twistRot x-axis + glm::vec3 y = glm::normalize(spline.d(t)); + glm::vec3 x = twistRot * Vectors::UNIT_X; + glm::vec3 u, v, w; + generateBasisVectors(y, x, v, u, w); + glm::mat3 m(u, v, glm::cross(u, v)); + glm::quat rot = glm::normalize(glm::quat_cast(m)); + + AnimPose desiredAbsPose = AnimPose(glm::vec3(1.0f), rot, trans) * splineJointInfo.offsetPose; + + // apply flex coefficent + AnimPose flexedAbsPose; + ::blend(1, &absolutePoses[splineJointInfo.jointIndex], &desiredAbsPose, target.getFlexCoefficient(i), &flexedAbsPose); + + AnimPose relPose = parentAbsPose.inverse() * flexedAbsPose; + + bool constrained = false; + if (splineJointInfo.jointIndex != _hipsIndex) { + // constrain the amount the spine can stretch or compress + float length = glm::length(relPose.trans()); + const float EPSILON = 0.0001f; + if (length > EPSILON) { + float defaultLength = glm::length(_skeleton->getRelativeDefaultPose(splineJointInfo.jointIndex).trans()); + const float STRETCH_COMPRESS_PERCENTAGE = 0.15f; + const float MAX_LENGTH = defaultLength * (1.0f + STRETCH_COMPRESS_PERCENTAGE); + const float MIN_LENGTH = defaultLength * (1.0f - STRETCH_COMPRESS_PERCENTAGE); + if (length > MAX_LENGTH) { + relPose.trans() = (relPose.trans() / length) * MAX_LENGTH; + constrained = true; + } else if (length < MIN_LENGTH) { + relPose.trans() = (relPose.trans() / length) * MIN_LENGTH; + constrained = true; + } + } else { + relPose.trans() = glm::vec3(0.0f); + } + } + // note we are ignoring the constrained info for now. + if (!chainInfoOut.setRelativePoseAtJointIndex(splineJointInfo.jointIndex, relPose)) { + qCDebug(animation) << "we didn't find the joint index for the spline!!!!"; + } + + parentAbsPose = flexedAbsPose; + } + } + + if (debug) { + //debugDrawIKChain(jointChainInfoOut, context); + } +} + +const std::vector* AnimSplineIK::findOrCreateSplineJointInfo(const AnimContext& context, const IKTarget& target) const { + // find or create splineJointInfo for this target + auto iter = _splineJointInfoMap.find(target.getIndex()); + if (iter != _splineJointInfoMap.end()) { + return &(iter->second); + } else { + computeAndCacheSplineJointInfosForIKTarget(context, target); + auto iter = _splineJointInfoMap.find(target.getIndex()); + if (iter != _splineJointInfoMap.end()) { + return &(iter->second); + } + } + + return nullptr; +} + +// pre-compute information about each joint influenced by this spline IK target. +void AnimSplineIK::computeAndCacheSplineJointInfosForIKTarget(const AnimContext& context, const IKTarget& target) const { + std::vector splineJointInfoVec; + + // build spline between the default poses. + AnimPose tipPose = _skeleton->getAbsoluteDefaultPose(target.getIndex()); + AnimPose basePose = _skeleton->getAbsoluteDefaultPose(_hipsIndex); + + CubicHermiteSplineFunctorWithArcLength spline; + if (target.getIndex() == _headIndex) { + // set gain factors so that more curvature occurs near the tip of the spline. + const float HIPS_GAIN = 0.5f; + const float HEAD_GAIN = 1.0f; + spline = computeSplineFromTipAndBase(tipPose, basePose, HIPS_GAIN, HEAD_GAIN); + } else { + spline = computeSplineFromTipAndBase(tipPose, basePose); + } + + // measure the total arc length along the spline + float totalArcLength = spline.arcLength(1.0f); + + glm::vec3 baseToTip = tipPose.trans() - basePose.trans(); + float baseToTipLength = glm::length(baseToTip); + glm::vec3 baseToTipNormal = baseToTip / baseToTipLength; + + int index = target.getIndex(); + int endIndex = _skeleton->getParentIndex(_hipsIndex); + while (index != endIndex) { + AnimPose defaultPose = _skeleton->getAbsoluteDefaultPose(index); + + float ratio = glm::dot(defaultPose.trans() - basePose.trans(), baseToTipNormal) / baseToTipLength; + + // compute offset from spline to the default pose. + float t = spline.arcLengthInverse(ratio * totalArcLength); + + // compute the rotation by using the derivative of the spline as the y-axis, and the defaultPose x-axis + glm::vec3 y = glm::normalize(spline.d(t)); + glm::vec3 x = defaultPose.rot() * Vectors::UNIT_X; + glm::vec3 u, v, w; + generateBasisVectors(y, x, v, u, w); + glm::mat3 m(u, v, glm::cross(u, v)); + glm::quat rot = glm::normalize(glm::quat_cast(m)); + + AnimPose pose(glm::vec3(1.0f), rot, spline(t)); + AnimPose offsetPose = pose.inverse() * defaultPose; + + SplineJointInfo splineJointInfo = { index, ratio, offsetPose }; + splineJointInfoVec.push_back(splineJointInfo); + index = _skeleton->getParentIndex(index); + } + + _splineJointInfoMap[target.getIndex()] = splineJointInfoVec; } \ No newline at end of file diff --git a/libraries/animation/src/AnimSplineIK.h b/libraries/animation/src/AnimSplineIK.h index 36a29971a0..79f012365a 100644 --- a/libraries/animation/src/AnimSplineIK.h +++ b/libraries/animation/src/AnimSplineIK.h @@ -12,6 +12,7 @@ #define hifi_AnimSplineIK_h #include "AnimNode.h" +#include "IKTarget.h" #include "AnimChain.h" // Spline IK for the spine @@ -34,6 +35,8 @@ protected: NumTypes }; + void computeAbsolutePoses(AnimPoseVec& absolutePoses) const; + // for AnimDebugDraw rendering virtual const AnimPoseVec& getPosesInternal() const override; virtual void setSkeletonInternal(AnimSkeleton::ConstPointer skeleton) override; @@ -51,6 +54,9 @@ protected: int _baseParentJointIndex{ -1 }; int _baseJointIndex{ -1 }; int _tipJointIndex{ -1 }; + int _headIndex{ -1 }; + int _hipsIndex{ -1 }; + int _hipsTargetIndex{ -1 }; QString _alphaVar; // float - (0, 1) 0 means underPoses only, 1 means IK only. QString _enabledVar; // bool @@ -66,7 +72,18 @@ protected: AnimChain _snapshotChain; + // used to pre-compute information about each joint influeced by a spline IK target. + struct SplineJointInfo { + int jointIndex; // joint in the skeleton that this information pertains to. + float ratio; // percentage (0..1) along the spline for this joint. + AnimPose offsetPose; // local offset from the spline to the joint. + }; + bool _lastEnableDebugDrawIKTargets{ false }; + void AnimSplineIK::solveTargetWithSpline(const AnimContext& context, const IKTarget& target, const AnimPoseVec& absolutePoses, bool debug, AnimChain& chainInfoOut) const; + void computeAndCacheSplineJointInfosForIKTarget(const AnimContext& context, const IKTarget& target) const; + const std::vector* findOrCreateSplineJointInfo(const AnimContext& context, const IKTarget& target) const; + mutable std::map> _splineJointInfoMap; // no copies AnimSplineIK(const AnimSplineIK&) = delete; From e5b16ef17466d2dae88a31704f5994bf3dc45192 Mon Sep 17 00:00:00 2001 From: amantley Date: Wed, 16 Jan 2019 18:31:52 -0800 Subject: [PATCH 010/436] implemented the splineIK in animSplineIK.cpp, todo: disable animinversekinematic.cpp --- .../resources/avatar/avatar-animation.json | 2 +- .../animation/src/AnimInverseKinematics.cpp | 13 ++++++-- libraries/animation/src/AnimSplineIK.cpp | 32 +++++++++++++------ libraries/animation/src/AnimStateMachine.cpp | 1 - libraries/animation/src/AnimTwoBoneIK.cpp | 2 -- libraries/fbx/src/FBXSerializer.cpp | 1 + 6 files changed, 35 insertions(+), 16 deletions(-) diff --git a/interface/resources/avatar/avatar-animation.json b/interface/resources/avatar/avatar-animation.json index 88ee1ff06b..16523afba3 100644 --- a/interface/resources/avatar/avatar-animation.json +++ b/interface/resources/avatar/avatar-animation.json @@ -173,7 +173,7 @@ "jointName": "Head", "positionVar": "headPosition", "rotationVar": "headRotation", - "typeVar": "headType", + "typeVar": "spine2Type", "weightVar": "headWeight", "weight": 4.0, "flexCoefficients": [ 1, 0.5, 0.25, 0.2, 0.1 ] diff --git a/libraries/animation/src/AnimInverseKinematics.cpp b/libraries/animation/src/AnimInverseKinematics.cpp index a6dcf5b2d9..e5509dc43d 100644 --- a/libraries/animation/src/AnimInverseKinematics.cpp +++ b/libraries/animation/src/AnimInverseKinematics.cpp @@ -237,12 +237,19 @@ void AnimInverseKinematics::solve(const AnimContext& context, const std::vector< // solve all targets for (size_t i = 0; i < targets.size(); i++) { - qCDebug(animation) << "target id: " << targets[i].getIndex() << " and type " << (int)targets[i].getType(); + // qCDebug(animation) << "target id: " << targets[i].getIndex() << " and type " << (int)targets[i].getType(); switch (targets[i].getType()) { case IKTarget::Type::Unknown: break; case IKTarget::Type::Spline: solveTargetWithSpline(context, targets[i], absolutePoses, debug, jointChainInfoVec[i]); + //if (jointChainInfoVec[i].target.getIndex() == _skeleton->nameToJointIndex("Head")) { + // qCDebug(animation) << "AnimIK spline index is " << targets[i].getIndex() << " and chain info size is " << jointChainInfoVec[i].jointInfoVec.size(); + for (int w = 0; w < jointChainInfoVec[i].jointInfoVec.size(); w++) { + // qCDebug(animation) << "joint " << jointChainInfoVec[i].jointInfoVec[w].jointIndex << " rotation is " << jointChainInfoVec[i].jointInfoVec[w].rot; + // qCDebug(animation) << "joint " << jointChainInfoVec[i].jointInfoVec[w].jointIndex << " translation is " << jointChainInfoVec[i].jointInfoVec[w].trans; + } + //} break; default: solveTargetWithCCD(context, targets[i], absolutePoses, debug, jointChainInfoVec[i]); @@ -259,6 +266,7 @@ void AnimInverseKinematics::solve(const AnimContext& context, const std::vector< // ease in expo alpha = 1.0f - powf(2.0f, -10.0f * alpha); + qCDebug(animation) << "the alpha for joint chains is " << alpha; size_t chainSize = std::min(_prevJointChainInfoVec[i].jointInfoVec.size(), jointChainInfoVec[i].jointInfoVec.size()); @@ -361,6 +369,7 @@ void AnimInverseKinematics::solve(const AnimContext& context, const std::vector< // copy jointChainInfoVec into _prevJointChainInfoVec, and update timers for (size_t i = 0; i < jointChainInfoVec.size(); i++) { _prevJointChainInfoVec[i].timer = _prevJointChainInfoVec[i].timer - dt; + //qCDebug(animation) << "the alpha for joint chains is " << _prevJointChainInfoVec[i].timer; if (_prevJointChainInfoVec[i].timer <= 0.0f) { _prevJointChainInfoVec[i] = jointChainInfoVec[i]; _prevJointChainInfoVec[i].target = targets[i]; @@ -860,7 +869,6 @@ void AnimInverseKinematics::solveTargetWithSpline(const AnimContext& context, co //virtual const AnimPoseVec& AnimInverseKinematics::evaluate(const AnimVariantMap& animVars, const AnimContext& context, float dt, AnimVariantMap& triggersOut) { // don't call this function, call overlay() instead - qCDebug(animation) << "called evaluate for inverse kinematics"; assert(false); return _relativePoses; } @@ -871,7 +879,6 @@ const AnimPoseVec& AnimInverseKinematics::overlay(const AnimVariantMap& animVars // disable IK on android return underPoses; #endif - qCDebug(animation) << "called overlay for inverse kinematics"; // allows solutionSource to be overridden by an animVar auto solutionSource = animVars.lookup(_solutionSourceVar, (int)_solutionSource); diff --git a/libraries/animation/src/AnimSplineIK.cpp b/libraries/animation/src/AnimSplineIK.cpp index 65d7bfc821..442112e8f0 100644 --- a/libraries/animation/src/AnimSplineIK.cpp +++ b/libraries/animation/src/AnimSplineIK.cpp @@ -14,6 +14,8 @@ #include #include "AnimUtil.h" +static const float JOINT_CHAIN_INTERP_TIME = 0.5f; + AnimSplineIK::AnimSplineIK(const QString& id, float alpha, bool enabled, float interpDuration, const QString& baseJointName, const QString& tipJointName, @@ -39,7 +41,6 @@ AnimSplineIK::~AnimSplineIK() { } const AnimPoseVec& AnimSplineIK::evaluate(const AnimVariantMap& animVars, const AnimContext& context, float dt, AnimVariantMap& triggersOut) { - qCDebug(animation) << "evaluating the spline function"; assert(_children.size() == 1); if (_children.size() != 1) { return _poses; @@ -56,7 +57,7 @@ const AnimPoseVec& AnimSplineIK::evaluate(const AnimVariantMap& animVars, const IKTarget target; int jointIndex = _skeleton->nameToJointIndex("Head"); if (jointIndex != -1) { - target.setType(animVars.lookup("HeadType", (int)IKTarget::Type::RotationAndPosition)); + target.setType(animVars.lookup("headType", (int)IKTarget::Type::RotationAndPosition)); target.setIndex(jointIndex); AnimPose absPose = _skeleton->getAbsolutePose(jointIndex, _poses); glm::quat rotation = animVars.lookupRigToGeometry("headRotation", absPose.rot()); @@ -74,15 +75,30 @@ const AnimPoseVec& AnimSplineIK::evaluate(const AnimVariantMap& animVars, const } } if (_poses.size() > 0) { - AnimChain jointChain; - jointChain.buildFromRelativePoses(_skeleton, _poses, target.getIndex()); + AnimChain jointChain; + _snapshotChain.buildFromRelativePoses(_skeleton, _poses, target.getIndex()); + jointChain.buildFromRelativePoses(_skeleton, _poses, target.getIndex()); - // for each target solve target with spline - + // for each target solve target with spline solveTargetWithSpline(context, target, absolutePoses, false, jointChain); - qCDebug(animation) << "made it past the spline solve code"; + + // qCDebug(animation) << "AnimSpline Joint chain length " << jointChain.size(); + // jointChain.dump(); + jointChain.outputRelativePoses(_poses); + } + + const float FRAMES_PER_SECOND = 30.0f; + _interpAlphaVel = FRAMES_PER_SECOND / _interpDuration; + _alpha = _interpAlphaVel * dt; // we need to blend the old joint chain with the current joint chain, otherwise known as: _snapShotChain + // we blend the chain info then we accumulate it then we assign to relative poses then we return the value. + // make the alpha + // make the prevchain + // interp from the previous chain to the new chain/or underposes if the ik is disabled. + // update the relative poses and then we are done + + /**/ return _poses; } @@ -162,14 +178,12 @@ void AnimSplineIK::solveTargetWithSpline(const AnimContext& context, const IKTar if (glm::dot(halfRot * Vectors::UNIT_Z, basePose.rot() * Vectors::UNIT_Z) < 0.0f) { tipPose.rot() = -tipPose.rot(); } - qCDebug(animation) << "spot 1"; // find or create splineJointInfo for this target const std::vector* splineJointInfoVec = findOrCreateSplineJointInfo(context, target); if (splineJointInfoVec && splineJointInfoVec->size() > 0) { const int baseParentIndex = _skeleton->getParentIndex(baseIndex); AnimPose parentAbsPose = (baseParentIndex >= 0) ? absolutePoses[baseParentIndex] : AnimPose(); - qCDebug(animation) << "spot 2"; // go thru splineJointInfoVec backwards (base to tip) for (int i = (int)splineJointInfoVec->size() - 1; i >= 0; i--) { const SplineJointInfo& splineJointInfo = (*splineJointInfoVec)[i]; diff --git a/libraries/animation/src/AnimStateMachine.cpp b/libraries/animation/src/AnimStateMachine.cpp index 3042ad20f0..2c5d4ad0f3 100644 --- a/libraries/animation/src/AnimStateMachine.cpp +++ b/libraries/animation/src/AnimStateMachine.cpp @@ -22,7 +22,6 @@ AnimStateMachine::~AnimStateMachine() { } const AnimPoseVec& AnimStateMachine::evaluate(const AnimVariantMap& animVars, const AnimContext& context, float dt, AnimVariantMap& triggersOut) { - qCDebug(animation) << "evaluating state machine"; float parentDebugAlpha = context.getDebugAlpha(_id); QString desiredStateID = animVars.lookup(_currentStateVar, _currentState->getID()); diff --git a/libraries/animation/src/AnimTwoBoneIK.cpp b/libraries/animation/src/AnimTwoBoneIK.cpp index d970e6b862..6334f6c4fd 100644 --- a/libraries/animation/src/AnimTwoBoneIK.cpp +++ b/libraries/animation/src/AnimTwoBoneIK.cpp @@ -46,8 +46,6 @@ AnimTwoBoneIK::~AnimTwoBoneIK() { const AnimPoseVec& AnimTwoBoneIK::evaluate(const AnimVariantMap& animVars, const AnimContext& context, float dt, AnimVariantMap& triggersOut) { - qCDebug(animation) << "evaluating the 2 bone IK"; - assert(_children.size() == 1); if (_children.size() != 1) { return _poses; diff --git a/libraries/fbx/src/FBXSerializer.cpp b/libraries/fbx/src/FBXSerializer.cpp index 68019c2f4b..5e7258f069 100644 --- a/libraries/fbx/src/FBXSerializer.cpp +++ b/libraries/fbx/src/FBXSerializer.cpp @@ -1308,6 +1308,7 @@ HFMModel* FBXSerializer::extractHFMModel(const QVariantHash& mapping, const QStr joint.inverseBindRotation = joint.inverseDefaultRotation; joint.name = fbxModel.name; if (hfmModel.hfmToHifiJointNameMapping.contains(hfmModel.hfmToHifiJointNameMapping.key(joint.name))) { + // qCDebug(modelformat) << "joint name " << joint.name << " hifi name " << hfmModel.hfmToHifiJointNameMapping.key(fbxModel.name); joint.name = hfmModel.hfmToHifiJointNameMapping.key(fbxModel.name); } From 777716235106b6d8c5efa34cec4ad8a841309b47 Mon Sep 17 00:00:00 2001 From: amantley Date: Fri, 18 Jan 2019 15:28:41 -0800 Subject: [PATCH 011/436] got the spine2 rotationa and the head spline working --- .../resources/avatar/avatar-animation.json | 18 ---- interface/src/Application.cpp | 2 +- interface/src/avatar/MySkeletonModel.cpp | 5 +- libraries/animation/src/AnimSplineIK.cpp | 86 +++++++++++++++++-- 4 files changed, 86 insertions(+), 25 deletions(-) diff --git a/interface/resources/avatar/avatar-animation.json b/interface/resources/avatar/avatar-animation.json index 16523afba3..f68d7e61d4 100644 --- a/interface/resources/avatar/avatar-animation.json +++ b/interface/resources/avatar/avatar-animation.json @@ -159,24 +159,6 @@ "poleVectorEnabledVar": "leftHandPoleVectorEnabled", "poleReferenceVectorVar": "leftHandPoleReferenceVector", "poleVectorVar": "leftHandPoleVector" - }, - { - "jointName": "Spine2", - "positionVar": "spine2Position", - "rotationVar": "spine2Rotation", - "typeVar": "spine2Type", - "weightVar": "spine2Weight", - "weight": 2.0, - "flexCoefficients": [ 1.0, 0.5, 0.25 ] - }, - { - "jointName": "Head", - "positionVar": "headPosition", - "rotationVar": "headRotation", - "typeVar": "spine2Type", - "weightVar": "headWeight", - "weight": 4.0, - "flexCoefficients": [ 1, 0.5, 0.25, 0.2, 0.1 ] } ] }, diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index 2816dbcb04..2401bf5315 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -4679,7 +4679,7 @@ void setupCpuMonitorThread() { void Application::idle() { PerformanceTimer perfTimer("idle"); - + qCDebug(interfaceapp) << "idle called"; // Update the deadlock watchdog updateHeartbeat(); diff --git a/interface/src/avatar/MySkeletonModel.cpp b/interface/src/avatar/MySkeletonModel.cpp index 356b365f93..e0362ef548 100644 --- a/interface/src/avatar/MySkeletonModel.cpp +++ b/interface/src/avatar/MySkeletonModel.cpp @@ -199,7 +199,7 @@ void MySkeletonModel::updateRig(float deltaTime, glm::mat4 parentTransform) { // if hips are not under direct control, estimate the hips position. if (avatarHeadPose.isValid() && !(params.primaryControllerFlags[Rig::PrimaryControllerType_Hips] & (uint8_t)Rig::ControllerFlags::Enabled)) { bool isFlying = (myAvatar->getCharacterController()->getState() == CharacterController::State::Hover || myAvatar->getCharacterController()->computeCollisionGroup() == BULLET_COLLISION_GROUP_COLLISIONLESS); - + // timescale in seconds const float TRANS_HORIZ_TIMESCALE = 0.15f; const float TRANS_VERT_TIMESCALE = 0.01f; // We want the vertical component of the hips to follow quickly to prevent spine squash/stretch. @@ -255,6 +255,9 @@ void MySkeletonModel::updateRig(float deltaTime, glm::mat4 parentTransform) { AnimPose newSpinePose(glm::mat4(glm::vec4(w, 0.0f), glm::vec4(u, 0.0f), glm::vec4(v, 0.0f), glm::vec4(glm::vec3(0.0f, 0.0f, 0.0f), 1.0f))); currentSpine2Pose.rot() = safeLerp(currentSpine2Pose.rot(), newSpinePose.rot(), SPINE2_ROTATION_FILTER); params.primaryControllerPoses[Rig::PrimaryControllerType_Spine2] = currentSpine2Pose; + qCDebug(interfaceapp) << "finding the spine 2 azimuth"; + qCDebug(interfaceapp) << currentSpine2Pose; + params.primaryControllerFlags[Rig::PrimaryControllerType_Spine2] = (uint8_t)Rig::ControllerFlags::Enabled | (uint8_t)Rig::ControllerFlags::Estimated; } } diff --git a/libraries/animation/src/AnimSplineIK.cpp b/libraries/animation/src/AnimSplineIK.cpp index 442112e8f0..6f1c15d0f9 100644 --- a/libraries/animation/src/AnimSplineIK.cpp +++ b/libraries/animation/src/AnimSplineIK.cpp @@ -53,7 +53,21 @@ const AnimPoseVec& AnimSplineIK::evaluate(const AnimVariantMap& animVars, const AnimPoseVec absolutePoses; absolutePoses.resize(_poses.size()); computeAbsolutePoses(absolutePoses); + AnimPoseVec absolutePoses2; + absolutePoses2.resize(_poses.size()); + // do this later + computeAbsolutePoses(absolutePoses2); + int jointIndex2 = _skeleton->nameToJointIndex("Spine2"); + AnimPose origSpine2PoseAbs = _skeleton->getAbsolutePose(jointIndex2, _poses); + if ((jointIndex2 != -1) && (_poses.size() > 0)) { + AnimPose origSpine2 = _skeleton->getAbsolutePose(jointIndex2, _poses); + AnimPose origSpine1 = _skeleton->getAbsolutePose(_skeleton->nameToJointIndex("Spine1"),_poses); + //origSpine2PoseRel = origSpine1.inverse() * origSpine2; + //qCDebug(animation) << "origSpine2Pose: " << origSpine2Pose.rot(); + qCDebug(animation) << "original relative spine2 " << origSpine2PoseAbs; + } + IKTarget target; int jointIndex = _skeleton->nameToJointIndex("Head"); if (jointIndex != -1) { @@ -64,30 +78,92 @@ const AnimPoseVec& AnimSplineIK::evaluate(const AnimVariantMap& animVars, const glm::vec3 translation = animVars.lookupRigToGeometry("headPosition", absPose.trans()); float weight = animVars.lookup("headWeight", "4.0"); + //qCDebug(animation) << "target 1 rotation absolute" << rotation; target.setPose(rotation, translation); target.setWeight(weight); const float* flexCoefficients = new float[5]{ 1.0f, 0.5f, 0.25f, 0.2f, 0.1f }; - target.setFlexCoefficients(4, flexCoefficients); + target.setFlexCoefficients(5, flexCoefficients); // record the index of the hips ik target. if (target.getIndex() == _hipsIndex) { _hipsTargetIndex = 1; } } + + AnimPose origAbsAfterHeadSpline; + AnimPose finalSpine2; + AnimChain jointChain; if (_poses.size() > 0) { - AnimChain jointChain; + _snapshotChain.buildFromRelativePoses(_skeleton, _poses, target.getIndex()); jointChain.buildFromRelativePoses(_skeleton, _poses, target.getIndex()); + // jointChain2.buildFromRelativePoses(_skeleton, _poses, target2.getIndex()); // for each target solve target with spline + //qCDebug(animation) << "before head spline"; + //jointChain.dump(); solveTargetWithSpline(context, target, absolutePoses, false, jointChain); + AnimPose afterSolveSpine2 = jointChain.getAbsolutePoseFromJointIndex(jointIndex2); + AnimPose afterSolveSpine1 = jointChain.getAbsolutePoseFromJointIndex(_skeleton->nameToJointIndex("Spine1")); + AnimPose afterSolveSpine2Rel = afterSolveSpine1.inverse() * afterSolveSpine2; + AnimPose originalSpine2Relative = afterSolveSpine1.inverse() * origSpine2PoseAbs; + glm::quat rotation3 = animVars.lookupRigToGeometry("spine2Rotation", afterSolveSpine2.rot()); + glm::vec3 translation3 = animVars.lookupRigToGeometry("spine2Position", afterSolveSpine2.trans()); + AnimPose targetSpine2(rotation3, afterSolveSpine2.trans()); + finalSpine2 = afterSolveSpine1.inverse() * targetSpine2; - // qCDebug(animation) << "AnimSpline Joint chain length " << jointChain.size(); - // jointChain.dump(); + qCDebug(animation) << "relative spine2 after solve" << afterSolveSpine2Rel; + qCDebug(animation) << "relative spine2 orig" << originalSpine2Relative; + AnimPose latestSpine2Relative(originalSpine2Relative.rot(), afterSolveSpine2Rel.trans()); + //jointChain.setRelativePoseAtJointIndex(jointIndex2, finalSpine2); jointChain.outputRelativePoses(_poses); + //qCDebug(animation) << "after head spline"; + //jointChain.dump(); + + //computeAbsolutePoses(absolutePoses2); + origAbsAfterHeadSpline = _skeleton->getAbsolutePose(jointIndex2, _poses); + // qCDebug(animation) << "Spine2 trans after head spline: " << origAbsAfterHeadSpline.trans(); + + } + + IKTarget target2; + //int jointIndex2 = _skeleton->nameToJointIndex("Spine2"); + if (jointIndex2 != -1) { + target2.setType(animVars.lookup("spine2Type", (int)IKTarget::Type::RotationAndPosition)); + target2.setIndex(jointIndex2); + AnimPose absPose2 = _skeleton->getAbsolutePose(jointIndex2, _poses); + glm::quat rotation2 = animVars.lookupRigToGeometry("spine2Rotation", absPose2.rot()); + glm::vec3 translation2 = animVars.lookupRigToGeometry("spine2Position", absPose2.trans()); + float weight2 = animVars.lookup("spine2Weight", "2.0"); + qCDebug(animation) << "rig to geometry" << rotation2; + + target2.setPose(rotation2, translation2); + target2.setPose(finalSpine2.rot(), finalSpine2.trans()); + target2.setWeight(weight2); + const float* flexCoefficients2 = new float[3]{ 1.0f, 0.5f, 0.25f }; + target2.setFlexCoefficients(3, flexCoefficients2); + + + } + AnimChain jointChain2; + if (_poses.size() > 0) { + + // _snapshotChain.buildFromRelativePoses(_skeleton, _poses, target.getIndex()); + // jointChain.buildFromRelativePoses(_skeleton, _poses, target.getIndex()); + // jointChain2.buildFromRelativePoses(_skeleton, underPoses, target2.getIndex()); + jointChain2.buildFromRelativePoses(_skeleton, _poses, target2.getIndex()); + + // for each target solve target with spline + solveTargetWithSpline(context, target2, absolutePoses2, false, jointChain2); + + //jointChain.outputRelativePoses(_poses); + jointChain2.outputRelativePoses(_poses); + //qCDebug(animation) << "Spine2 spline"; + //jointChain2.dump(); + //qCDebug(animation) << "Spine2Pose trans after spine2 spline: " << _skeleton->getAbsolutePose(jointIndex2, _poses).trans(); } - + const float FRAMES_PER_SECOND = 30.0f; _interpAlphaVel = FRAMES_PER_SECOND / _interpDuration; _alpha = _interpAlphaVel * dt; From 4a6d5e418730f54da54ede95a0adef94ca3dade4 Mon Sep 17 00:00:00 2001 From: amantley Date: Fri, 18 Jan 2019 15:50:29 -0800 Subject: [PATCH 012/436] both head and spine2 spline to working in consecutive order --- libraries/animation/src/AnimSplineIK.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/libraries/animation/src/AnimSplineIK.cpp b/libraries/animation/src/AnimSplineIK.cpp index 6f1c15d0f9..79a1a431c8 100644 --- a/libraries/animation/src/AnimSplineIK.cpp +++ b/libraries/animation/src/AnimSplineIK.cpp @@ -56,7 +56,7 @@ const AnimPoseVec& AnimSplineIK::evaluate(const AnimVariantMap& animVars, const AnimPoseVec absolutePoses2; absolutePoses2.resize(_poses.size()); // do this later - computeAbsolutePoses(absolutePoses2); + // computeAbsolutePoses(absolutePoses2); int jointIndex2 = _skeleton->nameToJointIndex("Spine2"); AnimPose origSpine2PoseAbs = _skeleton->getAbsolutePose(jointIndex2, _poses); @@ -93,6 +93,7 @@ const AnimPoseVec& AnimSplineIK::evaluate(const AnimVariantMap& animVars, const AnimPose origAbsAfterHeadSpline; AnimPose finalSpine2; AnimChain jointChain; + AnimPose targetSpine2; if (_poses.size() > 0) { _snapshotChain.buildFromRelativePoses(_skeleton, _poses, target.getIndex()); @@ -109,7 +110,7 @@ const AnimPoseVec& AnimSplineIK::evaluate(const AnimVariantMap& animVars, const AnimPose originalSpine2Relative = afterSolveSpine1.inverse() * origSpine2PoseAbs; glm::quat rotation3 = animVars.lookupRigToGeometry("spine2Rotation", afterSolveSpine2.rot()); glm::vec3 translation3 = animVars.lookupRigToGeometry("spine2Position", afterSolveSpine2.trans()); - AnimPose targetSpine2(rotation3, afterSolveSpine2.trans()); + targetSpine2 = AnimPose(rotation3, afterSolveSpine2.trans()); finalSpine2 = afterSolveSpine1.inverse() * targetSpine2; qCDebug(animation) << "relative spine2 after solve" << afterSolveSpine2Rel; @@ -120,7 +121,7 @@ const AnimPoseVec& AnimSplineIK::evaluate(const AnimVariantMap& animVars, const //qCDebug(animation) << "after head spline"; //jointChain.dump(); - //computeAbsolutePoses(absolutePoses2); + computeAbsolutePoses(absolutePoses2); origAbsAfterHeadSpline = _skeleton->getAbsolutePose(jointIndex2, _poses); // qCDebug(animation) << "Spine2 trans after head spline: " << origAbsAfterHeadSpline.trans(); @@ -137,8 +138,8 @@ const AnimPoseVec& AnimSplineIK::evaluate(const AnimVariantMap& animVars, const float weight2 = animVars.lookup("spine2Weight", "2.0"); qCDebug(animation) << "rig to geometry" << rotation2; - target2.setPose(rotation2, translation2); - target2.setPose(finalSpine2.rot(), finalSpine2.trans()); + //target2.setPose(rotation2, translation2); + target2.setPose(targetSpine2.rot(), targetSpine2.trans()); target2.setWeight(weight2); const float* flexCoefficients2 = new float[3]{ 1.0f, 0.5f, 0.25f }; target2.setFlexCoefficients(3, flexCoefficients2); From 7115796fc42db231fb6445a473663800bfab3bae Mon Sep 17 00:00:00 2001 From: amantley Date: Fri, 18 Jan 2019 16:47:55 -0800 Subject: [PATCH 013/436] version with spline from Spine2 to head --- libraries/animation/src/AnimChain.h | 10 ++ libraries/animation/src/AnimSplineIK.cpp | 127 ++++++++++++++--------- libraries/animation/src/AnimSplineIK.h | 13 +-- 3 files changed, 96 insertions(+), 54 deletions(-) diff --git a/libraries/animation/src/AnimChain.h b/libraries/animation/src/AnimChain.h index 2385e0c16a..37d175a334 100644 --- a/libraries/animation/src/AnimChain.h +++ b/libraries/animation/src/AnimChain.h @@ -82,6 +82,16 @@ public: return foundIndex; } + const AnimPose& getRelativePoseAtJointIndex(int jointIndex) const { + for (int i = 0; i < _top; i++) { + if (_chain[i].jointIndex == jointIndex) { + return _chain[i].relativePose; + } + } + return AnimPose::identity; + } + + void buildDirtyAbsolutePoses() { // the relative and absolute pose is the same for the base of the chain. _chain[_top - 1].absolutePose = _chain[_top - 1].relativePose; diff --git a/libraries/animation/src/AnimSplineIK.cpp b/libraries/animation/src/AnimSplineIK.cpp index 79a1a431c8..d55484f7c7 100644 --- a/libraries/animation/src/AnimSplineIK.cpp +++ b/libraries/animation/src/AnimSplineIK.cpp @@ -52,11 +52,11 @@ const AnimPoseVec& AnimSplineIK::evaluate(const AnimVariantMap& animVars, const // check to see if we actually need absolute poses. AnimPoseVec absolutePoses; absolutePoses.resize(_poses.size()); - computeAbsolutePoses(absolutePoses); + //computeAbsolutePoses(absolutePoses); AnimPoseVec absolutePoses2; absolutePoses2.resize(_poses.size()); // do this later - // computeAbsolutePoses(absolutePoses2); + computeAbsolutePoses(absolutePoses2); int jointIndex2 = _skeleton->nameToJointIndex("Spine2"); AnimPose origSpine2PoseAbs = _skeleton->getAbsolutePose(jointIndex2, _poses); @@ -67,6 +67,45 @@ const AnimPoseVec& AnimSplineIK::evaluate(const AnimVariantMap& animVars, const //qCDebug(animation) << "origSpine2Pose: " << origSpine2Pose.rot(); qCDebug(animation) << "original relative spine2 " << origSpine2PoseAbs; } + + IKTarget target2; + //int jointIndex2 = _skeleton->nameToJointIndex("Spine2"); + if (jointIndex2 != -1) { + target2.setType(animVars.lookup("spine2Type", (int)IKTarget::Type::RotationAndPosition)); + target2.setIndex(jointIndex2); + AnimPose absPose2 = _skeleton->getAbsolutePose(jointIndex2, _poses); + glm::quat rotation2 = animVars.lookupRigToGeometry("spine2Rotation", absPose2.rot()); + glm::vec3 translation2 = animVars.lookupRigToGeometry("spine2Position", absPose2.trans()); + float weight2 = animVars.lookup("spine2Weight", "2.0"); + qCDebug(animation) << "rig to geometry" << rotation2; + + target2.setPose(rotation2, translation2); + //target2.setPose(targetSpine2.rot(), targetSpine2.trans()); + target2.setWeight(weight2); + const float* flexCoefficients2 = new float[3]{ 1.0f, 0.5f, 0.25f }; + target2.setFlexCoefficients(3, flexCoefficients2); + + + } + AnimChain jointChain2; + if (_poses.size() > 0) { + + // _snapshotChain.buildFromRelativePoses(_skeleton, _poses, target.getIndex()); + // jointChain.buildFromRelativePoses(_skeleton, _poses, target.getIndex()); + // jointChain2.buildFromRelativePoses(_skeleton, underPoses, target2.getIndex()); + jointChain2.buildFromRelativePoses(_skeleton, _poses, target2.getIndex()); + + // for each target solve target with spline + solveTargetWithSpline(context, target2, absolutePoses2, false, jointChain2); + + //jointChain.outputRelativePoses(_poses); + jointChain2.outputRelativePoses(_poses); + computeAbsolutePoses(absolutePoses); + //qCDebug(animation) << "Spine2 spline"; + //jointChain2.dump(); + //qCDebug(animation) << "Spine2Pose trans after spine2 spline: " << _skeleton->getAbsolutePose(jointIndex2, _poses).trans(); + + } IKTarget target; int jointIndex = _skeleton->nameToJointIndex("Head"); @@ -81,8 +120,9 @@ const AnimPoseVec& AnimSplineIK::evaluate(const AnimVariantMap& animVars, const //qCDebug(animation) << "target 1 rotation absolute" << rotation; target.setPose(rotation, translation); target.setWeight(weight); - const float* flexCoefficients = new float[5]{ 1.0f, 0.5f, 0.25f, 0.2f, 0.1f }; - target.setFlexCoefficients(5, flexCoefficients); + //const float* flexCoefficients = new float[5]{ 1.0f, 0.5f, 0.25f, 0.2f, 0.1f }; + const float* flexCoefficients = new float[2]{ 1.0f, 0.5f }; + target.setFlexCoefficients(2, flexCoefficients); // record the index of the hips ik target. if (target.getIndex() == _hipsIndex) { @@ -118,52 +158,23 @@ const AnimPoseVec& AnimSplineIK::evaluate(const AnimVariantMap& animVars, const AnimPose latestSpine2Relative(originalSpine2Relative.rot(), afterSolveSpine2Rel.trans()); //jointChain.setRelativePoseAtJointIndex(jointIndex2, finalSpine2); jointChain.outputRelativePoses(_poses); + _poses[_headIndex] = jointChain.getRelativePoseAtJointIndex(_headIndex); + _poses[_skeleton->nameToJointIndex("Neck")] = jointChain.getRelativePoseAtJointIndex(_skeleton->nameToJointIndex("Neck")); + _poses[_spine2Index] = jointChain.getRelativePoseAtJointIndex(_spine2Index); + + //custom output code for the head. just do the head neck and spine2 + + //qCDebug(animation) << "after head spline"; //jointChain.dump(); - computeAbsolutePoses(absolutePoses2); - origAbsAfterHeadSpline = _skeleton->getAbsolutePose(jointIndex2, _poses); + //computeAbsolutePoses(absolutePoses2); + //origAbsAfterHeadSpline = _skeleton->getAbsolutePose(jointIndex2, _poses); // qCDebug(animation) << "Spine2 trans after head spline: " << origAbsAfterHeadSpline.trans(); } - IKTarget target2; - //int jointIndex2 = _skeleton->nameToJointIndex("Spine2"); - if (jointIndex2 != -1) { - target2.setType(animVars.lookup("spine2Type", (int)IKTarget::Type::RotationAndPosition)); - target2.setIndex(jointIndex2); - AnimPose absPose2 = _skeleton->getAbsolutePose(jointIndex2, _poses); - glm::quat rotation2 = animVars.lookupRigToGeometry("spine2Rotation", absPose2.rot()); - glm::vec3 translation2 = animVars.lookupRigToGeometry("spine2Position", absPose2.trans()); - float weight2 = animVars.lookup("spine2Weight", "2.0"); - qCDebug(animation) << "rig to geometry" << rotation2; - - //target2.setPose(rotation2, translation2); - target2.setPose(targetSpine2.rot(), targetSpine2.trans()); - target2.setWeight(weight2); - const float* flexCoefficients2 = new float[3]{ 1.0f, 0.5f, 0.25f }; - target2.setFlexCoefficients(3, flexCoefficients2); - - - } - AnimChain jointChain2; - if (_poses.size() > 0) { - - // _snapshotChain.buildFromRelativePoses(_skeleton, _poses, target.getIndex()); - // jointChain.buildFromRelativePoses(_skeleton, _poses, target.getIndex()); - // jointChain2.buildFromRelativePoses(_skeleton, underPoses, target2.getIndex()); - jointChain2.buildFromRelativePoses(_skeleton, _poses, target2.getIndex()); - - // for each target solve target with spline - solveTargetWithSpline(context, target2, absolutePoses2, false, jointChain2); - - //jointChain.outputRelativePoses(_poses); - jointChain2.outputRelativePoses(_poses); - //qCDebug(animation) << "Spine2 spline"; - //jointChain2.dump(); - //qCDebug(animation) << "Spine2Pose trans after spine2 spline: " << _skeleton->getAbsolutePose(jointIndex2, _poses).trans(); - - } + const float FRAMES_PER_SECOND = 30.0f; _interpAlphaVel = FRAMES_PER_SECOND / _interpDuration; @@ -218,6 +229,7 @@ void AnimSplineIK::setSkeletonInternal(AnimSkeleton::ConstPointer skeleton) { AnimNode::setSkeletonInternal(skeleton); _headIndex = _skeleton->nameToJointIndex("Head"); _hipsIndex = _skeleton->nameToJointIndex("Hips"); + _spine2Index = _skeleton->nameToJointIndex("Spine2"); lookUpIndices(); } @@ -234,16 +246,24 @@ static CubicHermiteSplineFunctorWithArcLength computeSplineFromTipAndBase(const void AnimSplineIK::solveTargetWithSpline(const AnimContext& context, const IKTarget& target, const AnimPoseVec& absolutePoses, bool debug, AnimChain& chainInfoOut) const { const int baseIndex = _hipsIndex; + const int headBaseIndex = _spine2Index; // build spline from tip to base AnimPose tipPose = AnimPose(glm::vec3(1.0f), target.getRotation(), target.getTranslation()); - AnimPose basePose = absolutePoses[baseIndex]; + AnimPose basePose; + if (target.getIndex() == _headIndex) { + basePose = absolutePoses[headBaseIndex]; + } else { + basePose = absolutePoses[baseIndex]; + } + CubicHermiteSplineFunctorWithArcLength spline; if (target.getIndex() == _headIndex) { // set gain factors so that more curvature occurs near the tip of the spline. const float HIPS_GAIN = 0.5f; const float HEAD_GAIN = 1.0f; - spline = computeSplineFromTipAndBase(tipPose, basePose, HIPS_GAIN, HEAD_GAIN); + //spline = computeSplineFromTipAndBase(tipPose, basePose, HIPS_GAIN, HEAD_GAIN); + spline = computeSplineFromTipAndBase(tipPose, basePose); } else { spline = computeSplineFromTipAndBase(tipPose, basePose); } @@ -347,14 +367,20 @@ void AnimSplineIK::computeAndCacheSplineJointInfosForIKTarget(const AnimContext& // build spline between the default poses. AnimPose tipPose = _skeleton->getAbsoluteDefaultPose(target.getIndex()); - AnimPose basePose = _skeleton->getAbsoluteDefaultPose(_hipsIndex); + AnimPose basePose; + if (target.getIndex() == _headIndex) { + basePose = _skeleton->getAbsoluteDefaultPose(_spine2Index); + } else { + basePose = _skeleton->getAbsoluteDefaultPose(_hipsIndex); + } CubicHermiteSplineFunctorWithArcLength spline; if (target.getIndex() == _headIndex) { // set gain factors so that more curvature occurs near the tip of the spline. const float HIPS_GAIN = 0.5f; const float HEAD_GAIN = 1.0f; - spline = computeSplineFromTipAndBase(tipPose, basePose, HIPS_GAIN, HEAD_GAIN); + // spline = computeSplineFromTipAndBase(tipPose, basePose, HIPS_GAIN, HEAD_GAIN); + spline = computeSplineFromTipAndBase(tipPose, basePose); } else { spline = computeSplineFromTipAndBase(tipPose, basePose); } @@ -367,7 +393,12 @@ void AnimSplineIK::computeAndCacheSplineJointInfosForIKTarget(const AnimContext& glm::vec3 baseToTipNormal = baseToTip / baseToTipLength; int index = target.getIndex(); - int endIndex = _skeleton->getParentIndex(_hipsIndex); + int endIndex; + if (target.getIndex() == _headIndex) { + endIndex = _skeleton->getParentIndex(_spine2Index); + } else { + endIndex = _skeleton->getParentIndex(_hipsIndex); + } while (index != endIndex) { AnimPose defaultPose = _skeleton->getAbsoluteDefaultPose(index); diff --git a/libraries/animation/src/AnimSplineIK.h b/libraries/animation/src/AnimSplineIK.h index 79f012365a..d303f81053 100644 --- a/libraries/animation/src/AnimSplineIK.h +++ b/libraries/animation/src/AnimSplineIK.h @@ -51,12 +51,13 @@ protected: QString _baseJointName; QString _tipJointName; - int _baseParentJointIndex{ -1 }; - int _baseJointIndex{ -1 }; - int _tipJointIndex{ -1 }; - int _headIndex{ -1 }; - int _hipsIndex{ -1 }; - int _hipsTargetIndex{ -1 }; + int _baseParentJointIndex { -1 }; + int _baseJointIndex { -1 }; + int _tipJointIndex { -1 }; + int _headIndex { -1 }; + int _hipsIndex { -1 }; + int _spine2Index { -1 }; + int _hipsTargetIndex { -1 }; QString _alphaVar; // float - (0, 1) 0 means underPoses only, 1 means IK only. QString _enabledVar; // bool From 3a2697fa8c3a69f80416988e88f818989adadaab Mon Sep 17 00:00:00 2001 From: amantley Date: Fri, 18 Jan 2019 17:55:19 -0800 Subject: [PATCH 014/436] working on the two bone ik for the hands --- .../avatar/avatar-animation_twoboneIK.json | 2213 +++++++++++++++++ libraries/animation/src/AnimSplineIK.cpp | 94 +- 2 files changed, 2262 insertions(+), 45 deletions(-) create mode 100644 interface/resources/avatar/avatar-animation_twoboneIK.json diff --git a/interface/resources/avatar/avatar-animation_twoboneIK.json b/interface/resources/avatar/avatar-animation_twoboneIK.json new file mode 100644 index 0000000000..ba84a5d527 --- /dev/null +++ b/interface/resources/avatar/avatar-animation_twoboneIK.json @@ -0,0 +1,2213 @@ +{ + "version": "1.1", + "root": { + "id": "userAnimStateMachine", + "type": "stateMachine", + "data": { + "currentState": "userAnimNone", + "states": [ + { + "id": "userAnimNone", + "interpTarget": 6, + "interpDuration": 6, + "transitions": [ + { "var": "userAnimA", "state": "userAnimA" }, + { "var": "userAnimB", "state": "userAnimB" } + ] + }, + { + "id": "userAnimA", + "interpTarget": 6, + "interpDuration": 6, + "transitions": [ + { "var": "userAnimNone", "state": "userAnimNone" }, + { "var": "userAnimB", "state": "userAnimB" } + ] + }, + { + "id": "userAnimB", + "interpTarget": 6, + "interpDuration": 6, + "transitions": [ + { "var": "userAnimNone", "state": "userAnimNone" }, + { "var": "userAnimA", "state": "userAnimA" } + ] + } + ] + }, + "children": [ + { + "id": "userAnimNone", + "type": "splineIK", + "data": { + "alpha": 1.0, + "enabled": false, + "interpDuration": 15, + "baseJointName": "Hips", + "tipJointName": "Head", + "alphaVar": "splineIKAlpha", + "enabledVar": "splineIKEnabled", + "endEffectorRotationVarVar": "splineIKRotationVar", + "endEffectorPositionVarVar": "splineIKPositionVar" + }, + "children": [ + { + "id": "rightFootPoleVector", + "type": "poleVectorConstraint", + "data": { + "enabled": false, + "referenceVector": [ 0, 0, 1 ], + "baseJointName": "RightUpLeg", + "midJointName": "RightLeg", + "tipJointName": "RightFoot", + "enabledVar": "rightFootPoleVectorEnabled", + "poleVectorVar": "rightFootPoleVector" + }, + "children": [ + { + "id": "rightFootIK", + "type": "twoBoneIK", + "data": { + "alpha": 1.0, + "enabled": false, + "interpDuration": 15, + "baseJointName": "RightUpLeg", + "midJointName": "RightLeg", + "tipJointName": "RightFoot", + "midHingeAxis": [ -1, 0, 0 ], + "alphaVar": "rightFootIKAlpha", + "enabledVar": "rightFootIKEnabled", + "endEffectorRotationVarVar": "rightFootIKRotationVar", + "endEffectorPositionVarVar": "rightFootIKPositionVar" + }, + "children": [ + { + "id": "leftFootPoleVector", + "type": "poleVectorConstraint", + "data": { + "enabled": false, + "referenceVector": [ 0, 0, 1 ], + "baseJointName": "LeftUpLeg", + "midJointName": "LeftLeg", + "tipJointName": "LeftFoot", + "enabledVar": "leftFootPoleVectorEnabled", + "poleVectorVar": "leftFootPoleVector" + }, + "children": [ + { + "id": "leftFootIK", + "type": "twoBoneIK", + "data": { + "alpha": 1.0, + "enabled": false, + "interpDuration": 15, + "baseJointName": "LeftUpLeg", + "midJointName": "LeftLeg", + "tipJointName": "LeftFoot", + "midHingeAxis": [ -1, 0, 0 ], + "alphaVar": "leftFootIKAlpha", + "enabledVar": "leftFootIKEnabled", + "endEffectorRotationVarVar": "leftFootIKRotationVar", + "endEffectorPositionVarVar": "leftFootIKPositionVar" + }, + "children": [ + { + "id": "rightArmPoleVector", + "type": "poleVectorConstraint", + "data": { + "enabled": false, + "referenceVector": [ 0, 0, 1 ], + "baseJointName": "RightArm", + "midJointName": "RightForeArm", + "tipJointName": "RightHand", + "enabledVar": "rightHandPoleVectorEnabled", + "poleVectorVar": "rightHandPoleVector" + }, + "children": [ + { + "id": "rightArmIK", + "type": "twoBoneIK", + "data": { + "alpha": 1.0, + "enabled": false, + "interpDuration": 15, + "baseJointName": "RightArm", + "midJointName": "RightForeArm", + "tipJointName": "RightHand", + "midHingeAxis": [ 1, 0, 0 ], + "alphaVar": "rightArmIKAlpha", + "enabledVar": "rightArmIKEnabled", + "endEffectorRotationVarVar": "rightArmIKRotationVar", + "endEffectorPositionVarVar": "rightArmIKPositionVar" + }, + "children": [ + { + "id": "ikOverlay", + "type": "overlay", + "data": { + "alpha": 1.0, + "alphaVar": "ikOverlayAlpha", + "boneSet": "fullBody" + }, + "children": [ + { + "id": "ik", + "type": "inverseKinematics", + "data": { + "solutionSource": "relaxToUnderPoses", + "solutionSourceVar": "solutionSource", + "targets": [ + { + "jointName": "Hips", + "positionVar": "hipsPosition", + "rotationVar": "hipsRotation", + "typeVar": "hipsType", + "weightVar": "hipsWeight", + "weight": 1.0, + "flexCoefficients": [ 1 ] + }, + { + "jointName": "LeftHand", + "positionVar": "leftHandPosition", + "rotationVar": "leftHandRotation", + "typeVar": "leftHandType", + "weightVar": "leftHandWeight", + "weight": 1.0, + "flexCoefficients": [ 1, 0.5, 0.5, 0.2, 0.01, 0.005, 0.001, 0.0, 0.0 ], + "poleVectorEnabledVar": "leftHandPoleVectorEnabled", + "poleReferenceVectorVar": "leftHandPoleReferenceVector", + "poleVectorVar": "leftHandPoleVector" + } + ] + }, + "children": [] + }, + { + "id": "defaultPoseOverlay", + "type": "overlay", + "data": { + "alpha": 0.0, + "alphaVar": "defaultPoseOverlayAlpha", + "boneSet": "fullBody", + "boneSetVar": "defaultPoseOverlayBoneSet" + }, + "children": [ + { + "id": "defaultPose", + "type": "defaultPose", + "data": { + }, + "children": [] + }, + { + "id": "rightHandOverlay", + "type": "overlay", + "data": { + "alpha": 0.0, + "boneSet": "rightHand", + "alphaVar": "rightHandOverlayAlpha" + }, + "children": [ + { + "id": "rightHandStateMachine", + "type": "stateMachine", + "data": { + "currentState": "rightHandGrasp", + "states": [ + { + "id": "rightHandGrasp", + "interpTarget": 3, + "interpDuration": 3, + "transitions": [ + { + "var": "isRightIndexPoint", + "state": "rightIndexPoint" + }, + { + "var": "isRightThumbRaise", + "state": "rightThumbRaise" + }, + { + "var": "isRightIndexPointAndThumbRaise", + "state": "rightIndexPointAndThumbRaise" + } + ] + }, + { + "id": "rightIndexPoint", + "interpTarget": 15, + "interpDuration": 3, + "transitions": [ + { + "var": "isRightHandGrasp", + "state": "rightHandGrasp" + }, + { + "var": "isRightThumbRaise", + "state": "rightThumbRaise" + }, + { + "var": "isRightIndexPointAndThumbRaise", + "state": "rightIndexPointAndThumbRaise" + } + ] + }, + { + "id": "rightThumbRaise", + "interpTarget": 15, + "interpDuration": 3, + "transitions": [ + { + "var": "isRightHandGrasp", + "state": "rightHandGrasp" + }, + { + "var": "isRightIndexPoint", + "state": "rightIndexPoint" + }, + { + "var": "isRightIndexPointAndThumbRaise", + "state": "rightIndexPointAndThumbRaise" + } + ] + }, + { + "id": "rightIndexPointAndThumbRaise", + "interpTarget": 15, + "interpDuration": 3, + "transitions": [ + { + "var": "isRightHandGrasp", + "state": "rightHandGrasp" + }, + { + "var": "isRightIndexPoint", + "state": "rightIndexPoint" + }, + { + "var": "isRightThumbRaise", + "state": "rightThumbRaise" + } + ] + } + ] + }, + "children": [ + { + "id": "rightHandGrasp", + "type": "blendLinear", + "data": { + "alpha": 0.0, + "alphaVar": "rightHandGraspAlpha" + }, + "children": [ + { + "id": "rightHandGraspOpen", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/hydra_pose_open_right.fbx", + "startFrame": 0.0, + "endFrame": 0.0, + "timeScale": 1.0, + "loopFlag": true + }, + "children": [] + }, + { + "id": "rightHandGraspClosed", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/hydra_pose_closed_right.fbx", + "startFrame": 0.0, + "endFrame": 0.0, + "timeScale": 1.0, + "loopFlag": true + }, + "children": [] + } + ] + }, + { + "id": "rightIndexPoint", + "type": "blendLinear", + "data": { + "alpha": 0.0, + "alphaVar": "rightHandGraspAlpha" + }, + "children": [ + { + "id": "rightIndexPointOpen", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/touch_point_open_right.fbx", + "startFrame": 15.0, + "endFrame": 15.0, + "timeScale": 1.0, + "loopFlag": true + }, + "children": [] + }, + { + "id": "rightIndexPointClosed", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/touch_point_closed_right.fbx", + "startFrame": 15.0, + "endFrame": 15.0, + "timeScale": 1.0, + "loopFlag": true + }, + "children": [] + } + ] + }, + { + "id": "rightThumbRaise", + "type": "blendLinear", + "data": { + "alpha": 0.0, + "alphaVar": "rightHandGraspAlpha" + }, + "children": [ + { + "id": "rightThumbRaiseOpen", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/touch_thumb_open_right.fbx", + "startFrame": 15.0, + "endFrame": 15.0, + "timeScale": 1.0, + "loopFlag": true + }, + "children": [] + }, + { + "id": "rightThumbRaiseClosed", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/touch_thumb_closed_right.fbx", + "startFrame": 15.0, + "endFrame": 15.0, + "timeScale": 1.0, + "loopFlag": true + }, + "children": [] + } + ] + }, + { + "id": "rightIndexPointAndThumbRaise", + "type": "blendLinear", + "data": { + "alpha": 0.0, + "alphaVar": "rightHandGraspAlpha" + }, + "children": [ + { + "id": "rightIndexPointAndThumbRaiseOpen", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/touch_thumb_point_open_right.fbx", + "startFrame": 15.0, + "endFrame": 15.0, + "timeScale": 1.0, + "loopFlag": true + }, + "children": [] + }, + { + "id": "rightIndexPointAndThumbRaiseClosed", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/touch_thumb_point_closed_right.fbx", + "startFrame": 15.0, + "endFrame": 15.0, + "timeScale": 1.0, + "loopFlag": true + }, + "children": [] + } + ] + } + ] + }, + { + "id": "leftHandOverlay", + "type": "overlay", + "data": { + "alpha": 0.0, + "boneSet": "leftHand", + "alphaVar": "leftHandOverlayAlpha" + }, + "children": [ + { + "id": "leftHandStateMachine", + "type": "stateMachine", + "data": { + "currentState": "leftHandGrasp", + "states": [ + { + "id": "leftHandGrasp", + "interpTarget": 3, + "interpDuration": 3, + "transitions": [ + { + "var": "isLeftIndexPoint", + "state": "leftIndexPoint" + }, + { + "var": "isLeftThumbRaise", + "state": "leftThumbRaise" + }, + { + "var": "isLeftIndexPointAndThumbRaise", + "state": "leftIndexPointAndThumbRaise" + } + ] + }, + { + "id": "leftIndexPoint", + "interpTarget": 15, + "interpDuration": 3, + "transitions": [ + { + "var": "isLeftHandGrasp", + "state": "leftHandGrasp" + }, + { + "var": "isLeftThumbRaise", + "state": "leftThumbRaise" + }, + { + "var": "isLeftIndexPointAndThumbRaise", + "state": "leftIndexPointAndThumbRaise" + } + ] + }, + { + "id": "leftThumbRaise", + "interpTarget": 15, + "interpDuration": 3, + "transitions": [ + { + "var": "isLeftHandGrasp", + "state": "leftHandGrasp" + }, + { + "var": "isLeftIndexPoint", + "state": "leftIndexPoint" + }, + { + "var": "isLeftIndexPointAndThumbRaise", + "state": "leftIndexPointAndThumbRaise" + } + ] + }, + { + "id": "leftIndexPointAndThumbRaise", + "interpTarget": 15, + "interpDuration": 3, + "transitions": [ + { + "var": "isLeftHandGrasp", + "state": "leftHandGrasp" + }, + { + "var": "isLeftIndexPoint", + "state": "leftIndexPoint" + }, + { + "var": "isLeftThumbRaise", + "state": "leftThumbRaise" + } + ] + } + ] + }, + "children": [ + { + "id": "leftHandGrasp", + "type": "blendLinear", + "data": { + "alpha": 0.0, + "alphaVar": "leftHandGraspAlpha" + }, + "children": [ + { + "id": "leftHandGraspOpen", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/hydra_pose_open_left.fbx", + "startFrame": 0.0, + "endFrame": 0.0, + "timeScale": 1.0, + "loopFlag": true + }, + "children": [] + }, + { + "id": "leftHandGraspClosed", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/hydra_pose_closed_left.fbx", + "startFrame": 10.0, + "endFrame": 10.0, + "timeScale": 1.0, + "loopFlag": true + }, + "children": [] + } + ] + }, + { + "id": "leftIndexPoint", + "type": "blendLinear", + "data": { + "alpha": 0.0, + "alphaVar": "leftHandGraspAlpha" + }, + "children": [ + { + "id": "leftIndexPointOpen", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/touch_point_open_left.fbx", + "startFrame": 15.0, + "endFrame": 15.0, + "timeScale": 1.0, + "loopFlag": true + }, + "children": [] + }, + { + "id": "leftIndexPointClosed", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/touch_point_closed_left.fbx", + "startFrame": 15.0, + "endFrame": 15.0, + "timeScale": 1.0, + "loopFlag": true + }, + "children": [] + } + ] + }, + { + "id": "leftThumbRaise", + "type": "blendLinear", + "data": { + "alpha": 0.0, + "alphaVar": "leftHandGraspAlpha" + }, + "children": [ + { + "id": "leftThumbRaiseOpen", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/touch_thumb_open_left.fbx", + "startFrame": 15.0, + "endFrame": 15.0, + "timeScale": 1.0, + "loopFlag": true + }, + "children": [] + }, + { + "id": "leftThumbRaiseClosed", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/touch_thumb_closed_left.fbx", + "startFrame": 15.0, + "endFrame": 15.0, + "timeScale": 1.0, + "loopFlag": true + }, + "children": [] + } + ] + }, + { + "id": "leftIndexPointAndThumbRaise", + "type": "blendLinear", + "data": { + "alpha": 0.0, + "alphaVar": "leftHandGraspAlpha" + }, + "children": [ + { + "id": "leftIndexPointAndThumbRaiseOpen", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/touch_thumb_point_open_left.fbx", + "startFrame": 15.0, + "endFrame": 15.0, + "timeScale": 1.0, + "loopFlag": true + }, + "children": [] + }, + { + "id": "leftIndexPointAndThumbRaiseClosed", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/touch_thumb_point_closed_left.fbx", + "startFrame": 15.0, + "endFrame": 15.0, + "timeScale": 1.0, + "loopFlag": true + }, + "children": [] + } + ] + } + ] + }, + { + "id": "mainStateMachine", + "type": "stateMachine", + "data": { + "outputJoints": [ "LeftFoot", "RightFoot" ], + "currentState": "idle", + "states": [ + { + "id": "idle", + "interpTarget": 20, + "interpDuration": 8, + "interpType": "snapshotPrev", + "transitions": [ + { + "var": "isMovingForward", + "state": "WALKFWD" + }, + { + "var": "isMovingBackward", + "state": "WALKBWD" + }, + { + "var": "isMovingRight", + "state": "STRAFERIGHT" + }, + { + "var": "isMovingLeft", + "state": "STRAFELEFT" + }, + { + "var": "isTurningRight", + "state": "turnRight" + }, + { + "var": "isTurningLeft", + "state": "turnLeft" + }, + { + "var": "isFlying", + "state": "fly" + }, + { + "var": "isTakeoffStand", + "state": "takeoffStand" + }, + { + "var": "isTakeoffRun", + "state": "TAKEOFFRUN" + }, + { + "var": "isInAirStand", + "state": "inAirStand" + }, + { + "var": "isInAirRun", + "state": "INAIRRUN" + }, + { + "var": "isMovingRightHmd", + "state": "strafeRightHmd" + }, + { + "var": "isMovingLeftHmd", + "state": "strafeLeftHmd" + } + ] + }, + { + "id": "idleToWalkFwd", + "interpTarget": 12, + "interpDuration": 8, + "transitions": [ + { + "var": "idleToWalkFwdOnDone", + "state": "WALKFWD" + }, + { + "var": "isNotMoving", + "state": "idle" + }, + { + "var": "isMovingBackward", + "state": "WALKBWD" + }, + { + "var": "isMovingRight", + "state": "STRAFERIGHT" + }, + { + "var": "isMovingLeft", + "state": "STRAFELEFT" + }, + { + "var": "isTurningRight", + "state": "turnRight" + }, + { + "var": "isTurningLeft", + "state": "turnLeft" + }, + { + "var": "isFlying", + "state": "fly" + }, + { + "var": "isTakeoffStand", + "state": "takeoffStand" + }, + { + "var": "isTakeoffRun", + "state": "TAKEOFFRUN" + }, + { + "var": "isInAirStand", + "state": "inAirStand" + }, + { + "var": "isInAirRun", + "state": "INAIRRUN" + }, + { + "var": "isMovingRightHmd", + "state": "strafeRightHmd" + }, + { + "var": "isMovingLeftHmd", + "state": "strafeLeftHmd" + } + ] + }, + { + "id": "idleSettle", + "interpTarget": 15, + "interpDuration": 8, + "interpType": "snapshotPrev", + "transitions": [ + { + "var": "idleSettleOnDone", + "state": "idle" + }, + { + "var": "isMovingForward", + "state": "WALKFWD" + }, + { + "var": "isMovingBackward", + "state": "WALKBWD" + }, + { + "var": "isMovingRight", + "state": "STRAFERIGHT" + }, + { + "var": "isMovingLeft", + "state": "STRAFELEFT" + }, + { + "var": "isMovingRightHmd", + "state": "strafeRightHmd" + }, + { + "var": "isMovingLeftHmd", + "state": "strafeLeftHmd" + }, + { + "var": "isTurningRight", + "state": "turnRight" + }, + { + "var": "isTurningLeft", + "state": "turnLeft" + }, + { + "var": "isFlying", + "state": "fly" + }, + { + "var": "isTakeoffStand", + "state": "takeoffStand" + }, + { + "var": "isTakeoffRun", + "state": "TAKEOFFRUN" + }, + { + "var": "isInAirStand", + "state": "inAirStand" + }, + { + "var": "isInAirRun", + "state": "INAIRRUN" + } + ] + }, + { + "id": "WALKFWD", + "interpTarget": 35, + "interpDuration": 10, + "interpType": "snapshotPrev", + "transitions": [ + { + "var": "isNotMoving", + "state": "idleSettle" + }, + { + "var": "isMovingBackward", + "state": "WALKBWD" + }, + { + "var": "isMovingRight", + "state": "STRAFERIGHT" + }, + { + "var": "isMovingLeft", + "state": "STRAFELEFT" + }, + { + "var": "isTurningRight", + "state": "turnRight" + }, + { + "var": "isTurningLeft", + "state": "turnLeft" + }, + { + "var": "isFlying", + "state": "fly" + }, + { + "var": "isTakeoffStand", + "state": "takeoffStand" + }, + { + "var": "isTakeoffRun", + "state": "TAKEOFFRUN" + }, + { + "var": "isInAirStand", + "state": "inAirStand" + }, + { + "var": "isInAirRun", + "state": "INAIRRUN" + }, + { + "var": "isMovingRightHmd", + "state": "strafeRightHmd" + }, + { + "var": "isMovingLeftHmd", + "state": "strafeLeftHmd" + } + ] + }, + { + "id": "WALKBWD", + "interpTarget": 35, + "interpDuration": 10, + "interpType": "snapshotPrev", + "transitions": [ + { + "var": "isNotMoving", + "state": "idleSettle" + }, + { + "var": "isMovingForward", + "state": "WALKFWD" + }, + { + "var": "isMovingRight", + "state": "STRAFERIGHT" + }, + { + "var": "isMovingLeft", + "state": "STRAFELEFT" + }, + { + "var": "isTurningRight", + "state": "turnRight" + }, + { + "var": "isTurningLeft", + "state": "turnLeft" + }, + { + "var": "isFlying", + "state": "fly" + }, + { + "var": "isTakeoffStand", + "state": "takeoffStand" + }, + { + "var": "isTakeoffRun", + "state": "TAKEOFFRUN" + }, + { + "var": "isInAirStand", + "state": "inAirStand" + }, + { + "var": "isInAirRun", + "state": "INAIRRUN" + }, + { + "var": "isMovingRightHmd", + "state": "strafeRightHmd" + }, + { + "var": "isMovingLeftHmd", + "state": "strafeLeftHmd" + } + ] + }, + { + "id": "STRAFERIGHT", + "interpTarget": 25, + "interpDuration": 8, + "interpType": "snapshotPrev", + "transitions": [ + { + "var": "isNotMoving", + "state": "idleSettle" + }, + { + "var": "isMovingForward", + "state": "WALKFWD" + }, + { + "var": "isMovingBackward", + "state": "WALKBWD" + }, + { + "var": "isMovingLeft", + "state": "STRAFELEFT" + }, + { + "var": "isTurningRight", + "state": "turnRight" + }, + { + "var": "isTurningLeft", + "state": "turnLeft" + }, + { + "var": "isFlying", + "state": "fly" + }, + { + "var": "isTakeoffStand", + "state": "takeoffStand" + }, + { + "var": "isTakeoffRun", + "state": "TAKEOFFRUN" + }, + { + "var": "isInAirStand", + "state": "inAirStand" + }, + { + "var": "isInAirRun", + "state": "INAIRRUN" + }, + { + "var": "isMovingRightHmd", + "state": "strafeRightHmd" + }, + { + "var": "isMovingLeftHmd", + "state": "strafeLeftHmd" + } + ] + }, + { + "id": "STRAFELEFT", + "interpTarget": 25, + "interpDuration": 8, + "interpType": "snapshotPrev", + "transitions": [ + { + "var": "isNotMoving", + "state": "idleSettle" + }, + { + "var": "isMovingForward", + "state": "WALKFWD" + }, + { + "var": "isMovingBackward", + "state": "WALKBWD" + }, + { + "var": "isMovingRight", + "state": "STRAFERIGHT" + }, + { + "var": "isTurningRight", + "state": "turnRight" + }, + { + "var": "isTurningLeft", + "state": "turnLeft" + }, + { + "var": "isFlying", + "state": "fly" + }, + { + "var": "isTakeoffStand", + "state": "takeoffStand" + }, + { + "var": "isTakeoffRun", + "state": "TAKEOFFRUN" + }, + { + "var": "isInAirStand", + "state": "inAirStand" + }, + { + "var": "isInAirRun", + "state": "INAIRRUN" + }, + { + "var": "isMovingRightHmd", + "state": "strafeRightHmd" + }, + { + "var": "isMovingLeftHmd", + "state": "strafeLeftHmd" + } + ] + }, + { + "id": "turnRight", + "interpTarget": 6, + "interpDuration": 8, + "transitions": [ + { + "var": "isNotTurning", + "state": "idle" + }, + { + "var": "isMovingForward", + "state": "WALKFWD" + }, + { + "var": "isMovingBackward", + "state": "WALKBWD" + }, + { + "var": "isMovingRight", + "state": "STRAFERIGHT" + }, + { + "var": "isMovingLeft", + "state": "STRAFELEFT" + }, + { + "var": "isTurningLeft", + "state": "turnLeft" + }, + { + "var": "isFlying", + "state": "fly" + }, + { + "var": "isTakeoffStand", + "state": "takeoffStand" + }, + { + "var": "isTakeoffRun", + "state": "TAKEOFFRUN" + }, + { + "var": "isInAirStand", + "state": "inAirStand" + }, + { + "var": "isInAirRun", + "state": "INAIRRUN" + }, + { + "var": "isMovingRightHmd", + "state": "strafeRightHmd" + }, + { + "var": "isMovingLeftHmd", + "state": "strafeLeftHmd" + } + ] + }, + { + "id": "turnLeft", + "interpTarget": 6, + "interpDuration": 8, + "transitions": [ + { + "var": "isNotTurning", + "state": "idle" + }, + { + "var": "isMovingForward", + "state": "WALKFWD" + }, + { + "var": "isMovingBackward", + "state": "WALKBWD" + }, + { + "var": "isMovingRight", + "state": "STRAFERIGHT" + }, + { + "var": "isMovingLeft", + "state": "STRAFELEFT" + }, + { + "var": "isTurningRight", + "state": "turnRight" + }, + { + "var": "isFlying", + "state": "fly" + }, + { + "var": "isTakeoffStand", + "state": "takeoffStand" + }, + { + "var": "isTakeoffRun", + "state": "TAKEOFFRUN" + }, + { + "var": "isInAirStand", + "state": "inAirStand" + }, + { + "var": "isInAirRun", + "state": "INAIRRUN" + }, + { + "var": "isMovingRightHmd", + "state": "strafeRightHmd" + }, + { + "var": "isMovingLeftHmd", + "state": "strafeLeftHmd" + } + ] + }, + { + "id": "strafeRightHmd", + "interpTarget": 5, + "interpDuration": 8, + "interpType": "snapshotPrev", + "transitions": [ + { + "var": "isNotMoving", + "state": "idleSettle" + }, + { + "var": "isMovingForward", + "state": "WALKFWD" + }, + { + "var": "isMovingBackward", + "state": "WALKBWD" + }, + { + "var": "isMovingLeftHmd", + "state": "strafeLeftHmd" + }, + { + "var": "isMovingRight", + "state": "STRAFERIGHT" + }, + { + "var": "isMovingLeft", + "state": "STRAFELEFT" + }, + { + "var": "isTurningRight", + "state": "turnRight" + }, + { + "var": "isTurningLeft", + "state": "turnLeft" + }, + { + "var": "isFlying", + "state": "fly" + }, + { + "var": "isTakeoffStand", + "state": "takeoffStand" + }, + { + "var": "isTakeoffRun", + "state": "TAKEOFFRUN" + }, + { + "var": "isInAirStand", + "state": "inAirStand" + }, + { + "var": "isInAirRun", + "state": "INAIRRUN" + } + ] + }, + { + "id": "strafeLeftHmd", + "interpTarget": 5, + "interpDuration": 8, + "interpType": "snapshotPrev", + "transitions": [ + { + "var": "isNotMoving", + "state": "idleSettle" + }, + { + "var": "isMovingForward", + "state": "WALKFWD" + }, + { + "var": "isMovingBackward", + "state": "WALKBWD" + }, + { + "var": "isMovingRightHmd", + "state": "strafeRightHmd" + }, + { + "var": "isMovingRight", + "state": "STRAFERIGHT" + }, + { + "var": "isMovingLeft", + "state": "STRAFELEFT" + }, + { + "var": "isTurningRight", + "state": "turnRight" + }, + { + "var": "isTurningLeft", + "state": "turnLeft" + }, + { + "var": "isFlying", + "state": "fly" + }, + { + "var": "isTakeoffStand", + "state": "takeoffStand" + }, + { + "var": "isTakeoffRun", + "state": "TAKEOFFRUN" + }, + { + "var": "isInAirStand", + "state": "inAirStand" + }, + { + "var": "isInAirRun", + "state": "INAIRRUN" + } + ] + }, + { + "id": "fly", + "interpTarget": 6, + "interpDuration": 6, + "transitions": [ + { + "var": "isNotFlying", + "state": "idleSettle" + } + ] + }, + { + "id": "takeoffStand", + "interpTarget": 2, + "interpDuration": 2, + "transitions": [ + { + "var": "isNotTakeoff", + "state": "inAirStand" + } + ] + }, + { + "id": "TAKEOFFRUN", + "interpTarget": 2, + "interpDuration": 2, + "transitions": [ + { + "var": "isNotTakeoff", + "state": "INAIRRUN" + } + ] + }, + { + "id": "inAirStand", + "interpTarget": 3, + "interpDuration": 3, + "interpType": "snapshotPrev", + "transitions": [ + { + "var": "isNotInAir", + "state": "landStandImpact" + } + ] + }, + { + "id": "INAIRRUN", + "interpTarget": 3, + "interpDuration": 3, + "interpType": "snapshotPrev", + "transitions": [ + { + "var": "isNotInAir", + "state": "WALKFWD" + } + ] + }, + { + "id": "landStandImpact", + "interpTarget": 1, + "interpDuration": 1, + "transitions": [ + { + "var": "isFlying", + "state": "fly" + }, + { + "var": "isTakeoffStand", + "state": "takeoffStand" + }, + { + "var": "isTakeoffRun", + "state": "TAKEOFFRUN" + }, + { + "var": "landStandImpactOnDone", + "state": "landStand" + } + ] + }, + { + "id": "landStand", + "interpTarget": 1, + "interpDuration": 1, + "transitions": [ + { + "var": "isMovingForward", + "state": "WALKFWD" + }, + { + "var": "isMovingBackward", + "state": "WALKBWD" + }, + { + "var": "isMovingRight", + "state": "STRAFERIGHT" + }, + { + "var": "isMovingLeft", + "state": "STRAFELEFT" + }, + { + "var": "isTurningRight", + "state": "turnRight" + }, + { + "var": "isTurningLeft", + "state": "turnLeft" + }, + { + "var": "isFlying", + "state": "fly" + }, + { + "var": "isTakeoffStand", + "state": "takeoffStand" + }, + { + "var": "isTakeoffRun", + "state": "TAKEOFFRUN" + }, + { + "var": "isInAirStand", + "state": "inAirStand" + }, + { + "var": "isInAirRun", + "state": "INAIRRUN" + }, + { + "var": "landStandOnDone", + "state": "idle" + }, + { + "var": "isMovingRightHmd", + "state": "strafeRightHmd" + }, + { + "var": "isMovingLeftHmd", + "state": "strafeLeftHmd" + } + ] + }, + { + "id": "LANDRUN", + "interpTarget": 2, + "interpDuration": 2, + "transitions": [ + { + "var": "isFlying", + "state": "fly" + }, + { + "var": "isTakeoffStand", + "state": "takeoffStand" + }, + { + "var": "isTakeoffRun", + "state": "TAKEOFFRUN" + }, + { + "var": "landRunOnDone", + "state": "WALKFWD" + } + ] + } + ] + }, + "children": [ + { + "id": "idle", + "type": "stateMachine", + "data": { + "currentState": "idleStand", + "states": [ + { + "id": "idleStand", + "interpTarget": 6, + "interpDuration": 10, + "transitions": [ + { + "var": "isTalking", + "state": "idleTalk" + } + ] + }, + { + "id": "idleTalk", + "interpTarget": 6, + "interpDuration": 10, + "transitions": [ + { + "var": "notIsTalking", + "state": "idleStand" + } + ] + } + ] + }, + "children": [ + { + "id": "idleStand", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/idle.fbx", + "startFrame": 0.0, + "endFrame": 300.0, + "timeScale": 1.0, + "loopFlag": true + }, + "children": [] + }, + { + "id": "idleTalk", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/talk.fbx", + "startFrame": 0.0, + "endFrame": 800.0, + "timeScale": 1.0, + "loopFlag": true + }, + "children": [] + } + ] + }, + { + "id": "WALKFWD", + "type": "blendLinearMove", + "data": { + "alpha": 0.0, + "desiredSpeed": 1.4, + "characteristicSpeeds": [ 0.5, 1.8, 2.3, 3.2, 4.5 ], + "alphaVar": "moveForwardAlpha", + "desiredSpeedVar": "moveForwardSpeed" + }, + "children": [ + { + "id": "walkFwdShort_c", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/walk_short_fwd.fbx", + "startFrame": 0.0, + "endFrame": 39.0, + "timeScale": 1.0, + "loopFlag": true + }, + "children": [] + }, + { + "id": "walkFwdNormal_c", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/walk_fwd.fbx", + "startFrame": 0.0, + "endFrame": 30.0, + "timeScale": 1.0, + "loopFlag": true + }, + "children": [] + }, + { + "id": "walkFwdFast_c", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/walk_fwd_fast.fbx", + "startFrame": 0.0, + "endFrame": 25.0, + "timeScale": 1.0, + "loopFlag": true + }, + "children": [] + }, + { + "id": "walkFwdJog_c", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/jog_fwd.fbx", + "startFrame": 0.0, + "endFrame": 25.0, + "timeScale": 1.0, + "loopFlag": true + }, + "children": [] + }, + { + "id": "walkFwdRun_c", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/run_fwd.fbx", + "startFrame": 0.0, + "endFrame": 21.0, + "timeScale": 1.0, + "loopFlag": true + }, + "children": [] + } + ] + }, + { + "id": "idleToWalkFwd", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/idle_to_walk.fbx", + "startFrame": 1.0, + "endFrame": 13.0, + "timeScale": 1.0, + "loopFlag": false + }, + "children": [] + }, + { + "id": "idleSettle", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/settle_to_idle.fbx", + "startFrame": 1.0, + "endFrame": 59.0, + "timeScale": 1.0, + "loopFlag": false + }, + "children": [] + }, + { + "id": "WALKBWD", + "type": "blendLinearMove", + "data": { + "alpha": 0.0, + "desiredSpeed": 1.4, + "characteristicSpeeds": [ 0.6, 1.6, 2.3, 3.1 ], + "alphaVar": "moveBackwardAlpha", + "desiredSpeedVar": "moveBackwardSpeed" + }, + "children": [ + { + "id": "walkBwdShort_c", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/walk_short_bwd.fbx", + "startFrame": 0.0, + "endFrame": 38.0, + "timeScale": 1.0, + "loopFlag": true + }, + "children": [] + }, + { + "id": "walkBwdFast_c", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/walk_bwd_fast.fbx", + "startFrame": 0.0, + "endFrame": 27.0, + "timeScale": 1.0, + "loopFlag": true + }, + "children": [] + }, + { + "id": "jogBwd_c", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/jog_bwd.fbx", + "startFrame": 0.0, + "endFrame": 24.0, + "timeScale": 1.0, + "loopFlag": true + }, + "children": [] + }, + { + "id": "runBwd_c", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/run_bwd.fbx", + "startFrame": 0.0, + "endFrame": 16.0, + "timeScale": 1.0, + "loopFlag": true + }, + "children": [] + } + ] + }, + { + "id": "turnLeft", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/turn_left.fbx", + "startFrame": 0.0, + "endFrame": 32.0, + "timeScale": 1.0, + "loopFlag": true + }, + "children": [] + }, + { + "id": "turnRight", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/turn_left.fbx", + "startFrame": 0.0, + "endFrame": 32.0, + "timeScale": 1.0, + "loopFlag": true, + "mirrorFlag": true + }, + "children": [] + }, + { + "id": "STRAFELEFT", + "type": "blendLinearMove", + "data": { + "alpha": 0.0, + "desiredSpeed": 1.4, + "characteristicSpeeds": [ 0.1, 0.5, 1.0, 2.6, 3.0 ], + "alphaVar": "moveLateralAlpha", + "desiredSpeedVar": "moveLateralSpeed" + }, + "children": [ + { + "id": "strafeLeftShortStep_c", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/side_step_short_left.fbx", + "startFrame": 0.0, + "endFrame": 29.0, + "timeScale": 1.0, + "loopFlag": true + }, + "children": [] + }, + { + "id": "strafeLeftStep_c", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/side_step_left.fbx", + "startFrame": 0.0, + "endFrame": 20.0, + "timeScale": 1.0, + "loopFlag": true + }, + "children": [] + }, + { + "id": "strafeLeftWalk_c", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/walk_left.fbx", + "startFrame": 0.0, + "endFrame": 35.0, + "timeScale": 1.0, + "loopFlag": true + }, + "children": [] + }, + { + "id": "strafeLeftWalkFast_c", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/walk_left_fast.fbx", + "startFrame": 0.0, + "endFrame": 21.0, + "timeScale": 1.0, + "loopFlag": true + }, + "children": [] + }, + { + "id": "strafeLeftJog_c", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/jog_left.fbx", + "startFrame": 0.0, + "endFrame": 24.0, + "timeScale": 1.0, + "loopFlag": true + }, + "children": [] + } + ] + }, + { + "id": "STRAFERIGHT", + "type": "blendLinearMove", + "data": { + "alpha": 0.0, + "desiredSpeed": 1.4, + "characteristicSpeeds": [ 0.1, 0.5, 1.0, 2.6, 3.0 ], + "alphaVar": "moveLateralAlpha", + "desiredSpeedVar": "moveLateralSpeed" + }, + "children": [ + { + "id": "strafeRightShortStep_c", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/side_step_short_left.fbx", + "startFrame": 0.0, + "endFrame": 29.0, + "timeScale": 1.0, + "loopFlag": true, + "mirrorFlag": true + }, + "children": [] + }, + { + "id": "strafeRightStep_c", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/side_step_left.fbx", + "startFrame": 0.0, + "endFrame": 20.0, + "timeScale": 1.0, + "loopFlag": true, + "mirrorFlag": true + }, + "children": [] + }, + { + "id": "strafeRightWalk_c", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/walk_left.fbx", + "startFrame": 0.0, + "endFrame": 35.0, + "timeScale": 1.0, + "loopFlag": true, + "mirrorFlag": true + }, + "children": [] + }, + { + "id": "strafeRightFast_c", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/walk_left_fast.fbx", + "startFrame": 0.0, + "endFrame": 21.0, + "timeScale": 1.0, + "loopFlag": true, + "mirrorFlag": true + }, + "children": [] + }, + { + "id": "strafeRightJog_c", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/jog_left.fbx", + "startFrame": 0.0, + "endFrame": 24.0, + "timeScale": 1.0, + "loopFlag": true, + "mirrorFlag": true + }, + "children": [] + } + ] + }, + { + "id": "strafeLeftHmd", + "type": "blendLinearMove", + "data": { + "alpha": 0.0, + "desiredSpeed": 1.4, + "characteristicSpeeds": [ 0, 0.5, 2.5 ], + "alphaVar": "moveLateralAlpha", + "desiredSpeedVar": "moveLateralSpeed" + }, + "children": [ + { + "id": "stepLeftShort_c", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/side_step_short_left.fbx", + "startFrame": 0.0, + "endFrame": 29.0, + "timeScale": 1.0, + "loopFlag": true + }, + "children": [] + }, + { + "id": "stepLeft_c", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/side_step_left.fbx", + "startFrame": 0.0, + "endFrame": 20.0, + "timeScale": 1.0, + "loopFlag": true + }, + "children": [] + }, + { + "id": "strafeLeftAnim_c", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/side_step_left_fast.fbx", + "startFrame": 0.0, + "endFrame": 16.0, + "timeScale": 1.0, + "loopFlag": true + }, + "children": [] + } + ] + }, + { + "id": "strafeRightHmd", + "type": "blendLinearMove", + "data": { + "alpha": 0.0, + "desiredSpeed": 1.4, + "characteristicSpeeds": [ 0, 0.5, 2.5 ], + "alphaVar": "moveLateralAlpha", + "desiredSpeedVar": "moveLateralSpeed" + }, + "children": [ + { + "id": "stepRightShort_c", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/side_step_short_left.fbx", + "startFrame": 0.0, + "endFrame": 29.0, + "timeScale": 1.0, + "loopFlag": true, + "mirrorFlag": true + }, + "children": [] + }, + { + "id": "stepRight_c", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/side_step_left.fbx", + "startFrame": 0.0, + "endFrame": 20.0, + "timeScale": 1.0, + "loopFlag": true, + "mirrorFlag": true + }, + "children": [] + }, + { + "id": "strafeRightAnim_c", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/side_step_left_fast.fbx", + "startFrame": 0.0, + "endFrame": 16.0, + "timeScale": 1.0, + "loopFlag": true, + "mirrorFlag": true + }, + "children": [] + } + ] + }, + { + "id": "fly", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/fly.fbx", + "startFrame": 1.0, + "endFrame": 80.0, + "timeScale": 1.0, + "loopFlag": true + }, + "children": [] + }, + { + "id": "takeoffStand", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/jump_standing_launch.fbx", + "startFrame": 2.0, + "endFrame": 16.0, + "timeScale": 1.0, + "loopFlag": false + }, + "children": [] + }, + { + "id": "TAKEOFFRUN", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/jump_running_launch_land.fbx", + "startFrame": 4.0, + "endFrame": 15.0, + "timeScale": 1.0, + "loopFlag": false + }, + "children": [] + }, + { + "id": "inAirStand", + "type": "blendLinear", + "data": { + "alpha": 0.0, + "alphaVar": "inAirAlpha" + }, + "children": [ + { + "id": "inAirStandPreApex", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/jump_standing_apex.fbx", + "startFrame": 0.0, + "endFrame": 0.0, + "timeScale": 1.0, + "loopFlag": false + }, + "children": [] + }, + { + "id": "inAirStandApex", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/jump_standing_apex.fbx", + "startFrame": 1.0, + "endFrame": 1.0, + "timeScale": 1.0, + "loopFlag": false + }, + "children": [] + }, + { + "id": "inAirStandPostApex", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/jump_standing_apex.fbx", + "startFrame": 2.0, + "endFrame": 2.0, + "timeScale": 1.0, + "loopFlag": false + }, + "children": [] + } + ] + }, + { + "id": "INAIRRUN", + "type": "blendLinear", + "data": { + "alpha": 0.0, + "alphaVar": "inAirAlpha" + }, + "children": [ + { + "id": "inAirRunPreApex", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/jump_running_launch_land.fbx", + "startFrame": 16.0, + "endFrame": 16.0, + "timeScale": 1.0, + "loopFlag": false + }, + "children": [] + }, + { + "id": "inAirRunApex", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/jump_running_launch_land.fbx", + "startFrame": 22.0, + "endFrame": 22.0, + "timeScale": 1.0, + "loopFlag": false + }, + "children": [] + }, + { + "id": "inAirRunPostApex", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/jump_running_launch_land.fbx", + "startFrame": 33.0, + "endFrame": 33.0, + "timeScale": 1.0, + "loopFlag": false + }, + "children": [] + } + ] + }, + { + "id": "landStandImpact", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/jump_standing_land_settle.fbx", + "startFrame": 1.0, + "endFrame": 6.0, + "timeScale": 1.0, + "loopFlag": false + }, + "children": [] + }, + { + "id": "landStand", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/jump_standing_land_settle.fbx", + "startFrame": 6.0, + "endFrame": 68.0, + "timeScale": 1.0, + "loopFlag": false + }, + "children": [] + }, + { + "id": "LANDRUN", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/jump_running_launch_land.fbx", + "startFrame": 29.0, + "endFrame": 40.0, + "timeScale": 1.0, + "loopFlag": false + }, + "children": [] + } + ] + } + ] + } + ] + } + ] + } + ] + } + ] + } + ] + } + ] + } + ] + } + ] + } + ] + } + ] + }, + { + "id": "userAnimA", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/idle.fbx", + "startFrame": 0.0, + "endFrame": 90.0, + "timeScale": 1.0, + "loopFlag": true + }, + "children": [] + }, + { + "id": "userAnimB", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/idle.fbx", + "startFrame": 0.0, + "endFrame": 90.0, + "timeScale": 1.0, + "loopFlag": true + }, + "children": [] + } + ] + } +} diff --git a/libraries/animation/src/AnimSplineIK.cpp b/libraries/animation/src/AnimSplineIK.cpp index d55484f7c7..fe54aa5fe7 100644 --- a/libraries/animation/src/AnimSplineIK.cpp +++ b/libraries/animation/src/AnimSplineIK.cpp @@ -52,11 +52,11 @@ const AnimPoseVec& AnimSplineIK::evaluate(const AnimVariantMap& animVars, const // check to see if we actually need absolute poses. AnimPoseVec absolutePoses; absolutePoses.resize(_poses.size()); - //computeAbsolutePoses(absolutePoses); + computeAbsolutePoses(absolutePoses); AnimPoseVec absolutePoses2; absolutePoses2.resize(_poses.size()); // do this later - computeAbsolutePoses(absolutePoses2); + //computeAbsolutePoses(absolutePoses2); int jointIndex2 = _skeleton->nameToJointIndex("Spine2"); AnimPose origSpine2PoseAbs = _skeleton->getAbsolutePose(jointIndex2, _poses); @@ -68,44 +68,7 @@ const AnimPoseVec& AnimSplineIK::evaluate(const AnimVariantMap& animVars, const qCDebug(animation) << "original relative spine2 " << origSpine2PoseAbs; } - IKTarget target2; - //int jointIndex2 = _skeleton->nameToJointIndex("Spine2"); - if (jointIndex2 != -1) { - target2.setType(animVars.lookup("spine2Type", (int)IKTarget::Type::RotationAndPosition)); - target2.setIndex(jointIndex2); - AnimPose absPose2 = _skeleton->getAbsolutePose(jointIndex2, _poses); - glm::quat rotation2 = animVars.lookupRigToGeometry("spine2Rotation", absPose2.rot()); - glm::vec3 translation2 = animVars.lookupRigToGeometry("spine2Position", absPose2.trans()); - float weight2 = animVars.lookup("spine2Weight", "2.0"); - qCDebug(animation) << "rig to geometry" << rotation2; - - target2.setPose(rotation2, translation2); - //target2.setPose(targetSpine2.rot(), targetSpine2.trans()); - target2.setWeight(weight2); - const float* flexCoefficients2 = new float[3]{ 1.0f, 0.5f, 0.25f }; - target2.setFlexCoefficients(3, flexCoefficients2); - - - } - AnimChain jointChain2; - if (_poses.size() > 0) { - - // _snapshotChain.buildFromRelativePoses(_skeleton, _poses, target.getIndex()); - // jointChain.buildFromRelativePoses(_skeleton, _poses, target.getIndex()); - // jointChain2.buildFromRelativePoses(_skeleton, underPoses, target2.getIndex()); - jointChain2.buildFromRelativePoses(_skeleton, _poses, target2.getIndex()); - - // for each target solve target with spline - solveTargetWithSpline(context, target2, absolutePoses2, false, jointChain2); - - //jointChain.outputRelativePoses(_poses); - jointChain2.outputRelativePoses(_poses); - computeAbsolutePoses(absolutePoses); - //qCDebug(animation) << "Spine2 spline"; - //jointChain2.dump(); - //qCDebug(animation) << "Spine2Pose trans after spine2 spline: " << _skeleton->getAbsolutePose(jointIndex2, _poses).trans(); - - } + IKTarget target; int jointIndex = _skeleton->nameToJointIndex("Head"); @@ -158,9 +121,9 @@ const AnimPoseVec& AnimSplineIK::evaluate(const AnimVariantMap& animVars, const AnimPose latestSpine2Relative(originalSpine2Relative.rot(), afterSolveSpine2Rel.trans()); //jointChain.setRelativePoseAtJointIndex(jointIndex2, finalSpine2); jointChain.outputRelativePoses(_poses); - _poses[_headIndex] = jointChain.getRelativePoseAtJointIndex(_headIndex); - _poses[_skeleton->nameToJointIndex("Neck")] = jointChain.getRelativePoseAtJointIndex(_skeleton->nameToJointIndex("Neck")); - _poses[_spine2Index] = jointChain.getRelativePoseAtJointIndex(_spine2Index); + //_poses[_headIndex] = jointChain.getRelativePoseAtJointIndex(_headIndex); + //_poses[_skeleton->nameToJointIndex("Neck")] = jointChain.getRelativePoseAtJointIndex(_skeleton->nameToJointIndex("Neck")); + //_poses[_spine2Index] = jointChain.getRelativePoseAtJointIndex(_spine2Index); //custom output code for the head. just do the head neck and spine2 @@ -168,11 +131,50 @@ const AnimPoseVec& AnimSplineIK::evaluate(const AnimVariantMap& animVars, const //qCDebug(animation) << "after head spline"; //jointChain.dump(); - //computeAbsolutePoses(absolutePoses2); + computeAbsolutePoses(absolutePoses2); //origAbsAfterHeadSpline = _skeleton->getAbsolutePose(jointIndex2, _poses); // qCDebug(animation) << "Spine2 trans after head spline: " << origAbsAfterHeadSpline.trans(); } + + IKTarget target2; + //int jointIndex2 = _skeleton->nameToJointIndex("Spine2"); + if (jointIndex2 != -1) { + target2.setType(animVars.lookup("spine2Type", (int)IKTarget::Type::RotationAndPosition)); + target2.setIndex(jointIndex2); + AnimPose absPose2 = _skeleton->getAbsolutePose(jointIndex2, _poses); + glm::quat rotation2 = animVars.lookupRigToGeometry("spine2Rotation", absPose2.rot()); + glm::vec3 translation2 = animVars.lookupRigToGeometry("spine2Position", absPose2.trans()); + float weight2 = animVars.lookup("spine2Weight", "2.0"); + qCDebug(animation) << "rig to geometry" << rotation2; + + //target2.setPose(rotation2, translation2); + target2.setPose(targetSpine2.rot(), targetSpine2.trans()); + target2.setWeight(weight2); + const float* flexCoefficients2 = new float[3]{ 1.0f, 0.5f, 0.25f }; + target2.setFlexCoefficients(3, flexCoefficients2); + + + } + AnimChain jointChain2; + if (_poses.size() > 0) { + + // _snapshotChain.buildFromRelativePoses(_skeleton, _poses, target.getIndex()); + // jointChain.buildFromRelativePoses(_skeleton, _poses, target.getIndex()); + // jointChain2.buildFromRelativePoses(_skeleton, underPoses, target2.getIndex()); + jointChain2.buildFromRelativePoses(_skeleton, _poses, target2.getIndex()); + + // for each target solve target with spline + solveTargetWithSpline(context, target2, absolutePoses2, false, jointChain2); + + //jointChain.outputRelativePoses(_poses); + jointChain2.outputRelativePoses(_poses); + //computeAbsolutePoses(absolutePoses); + //qCDebug(animation) << "Spine2 spline"; + //jointChain2.dump(); + //qCDebug(animation) << "Spine2Pose trans after spine2 spline: " << _skeleton->getAbsolutePose(jointIndex2, _poses).trans(); + + } @@ -246,7 +248,7 @@ static CubicHermiteSplineFunctorWithArcLength computeSplineFromTipAndBase(const void AnimSplineIK::solveTargetWithSpline(const AnimContext& context, const IKTarget& target, const AnimPoseVec& absolutePoses, bool debug, AnimChain& chainInfoOut) const { const int baseIndex = _hipsIndex; - const int headBaseIndex = _spine2Index; + const int headBaseIndex = _spine2Index; // build spline from tip to base AnimPose tipPose = AnimPose(glm::vec3(1.0f), target.getRotation(), target.getTranslation()); @@ -369,6 +371,7 @@ void AnimSplineIK::computeAndCacheSplineJointInfosForIKTarget(const AnimContext& AnimPose tipPose = _skeleton->getAbsoluteDefaultPose(target.getIndex()); AnimPose basePose; if (target.getIndex() == _headIndex) { + //basePose = _skeleton->getAbsoluteDefaultPose(_hipsIndex); basePose = _skeleton->getAbsoluteDefaultPose(_spine2Index); } else { basePose = _skeleton->getAbsoluteDefaultPose(_hipsIndex); @@ -396,6 +399,7 @@ void AnimSplineIK::computeAndCacheSplineJointInfosForIKTarget(const AnimContext& int endIndex; if (target.getIndex() == _headIndex) { endIndex = _skeleton->getParentIndex(_spine2Index); + // endIndex = _skeleton->getParentIndex(_hipsIndex); } else { endIndex = _skeleton->getParentIndex(_hipsIndex); } From 6680ca53ad165e9ecdabd236ace78e66f2da73bb Mon Sep 17 00:00:00 2001 From: amantley Date: Sun, 20 Jan 2019 08:56:39 -0800 Subject: [PATCH 015/436] added updateHands2 which deals with two bone hands animvars --- .../avatar/avatar-animation_twoboneIK.json | 2 +- libraries/animation/src/AnimTwoBoneIK.cpp | 4 +- libraries/animation/src/Rig.cpp | 115 ++++++++++++++++++ libraries/animation/src/Rig.h | 9 ++ 4 files changed, 127 insertions(+), 3 deletions(-) diff --git a/interface/resources/avatar/avatar-animation_twoboneIK.json b/interface/resources/avatar/avatar-animation_twoboneIK.json index ba84a5d527..8a18b4859a 100644 --- a/interface/resources/avatar/avatar-animation_twoboneIK.json +++ b/interface/resources/avatar/avatar-animation_twoboneIK.json @@ -134,7 +134,7 @@ "baseJointName": "RightArm", "midJointName": "RightForeArm", "tipJointName": "RightHand", - "midHingeAxis": [ 1, 0, 0 ], + "midHingeAxis": [ 0, 0, -1 ], "alphaVar": "rightArmIKAlpha", "enabledVar": "rightArmIKEnabled", "endEffectorRotationVarVar": "rightArmIKRotationVar", diff --git a/libraries/animation/src/AnimTwoBoneIK.cpp b/libraries/animation/src/AnimTwoBoneIK.cpp index 6334f6c4fd..5df98df969 100644 --- a/libraries/animation/src/AnimTwoBoneIK.cpp +++ b/libraries/animation/src/AnimTwoBoneIK.cpp @@ -90,8 +90,8 @@ const AnimPoseVec& AnimTwoBoneIK::evaluate(const AnimVariantMap& animVars, const } _enabled = enabled; - // don't build chains or do IK if we are disbled & not interping. - if (_interpType == InterpType::None && !enabled) { + // don't build chains or do IK if we are disabled & not interping. + if (_interpType == InterpType::None){// && !enabled) { _poses = underPoses; return _poses; } diff --git a/libraries/animation/src/Rig.cpp b/libraries/animation/src/Rig.cpp index 44fdd8797f..e1db2fef8f 100644 --- a/libraries/animation/src/Rig.cpp +++ b/libraries/animation/src/Rig.cpp @@ -75,6 +75,20 @@ static const QString RIGHT_FOOT_IK_ROTATION_VAR("rightFootIKRotationVar"); static const QString MAIN_STATE_MACHINE_RIGHT_FOOT_ROTATION("mainStateMachineRightFootRotation"); static const QString MAIN_STATE_MACHINE_RIGHT_FOOT_POSITION("mainStateMachineRightFootPosition"); +static const QString LEFT_HAND_POSITION("leftHandPosition"); +static const QString LEFT_HAND_ROTATION("leftHandRotation"); +static const QString LEFT_HAND_IK_POSITION_VAR("leftHandIKPositionVar"); +static const QString LEFT_HAND_IK_ROTATION_VAR("leftHandIKRotationVar"); +static const QString MAIN_STATE_MACHINE_LEFT_HAND_POSITION("mainStateMachineLeftHandPosition"); +static const QString MAIN_STATE_MACHINE_LEFT_HAND_ROTATION("mainStateMachineLeftHandRotation"); + +static const QString RIGHT_HAND_POSITION("rightHandPosition"); +static const QString RIGHT_HAND_ROTATION("rightHandRotation"); +static const QString RIGHT_HAND_IK_POSITION_VAR("rightHandIKPositionVar"); +static const QString RIGHT_HAND_IK_ROTATION_VAR("rightHandIKRotationVar"); +static const QString MAIN_STATE_MACHINE_RIGHT_HAND_ROTATION("mainStateMachineRightHandRotation"); +static const QString MAIN_STATE_MACHINE_RIGHT_HAND_POSITION("mainStateMachineRightHandPosition"); + Rig::Rig() { // Ensure thread-safe access to the rigRegistry. @@ -1498,6 +1512,103 @@ void Rig::updateHands(bool leftHandEnabled, bool rightHandEnabled, bool hipsEnab } } +void Rig::updateHands2(bool leftHandEnabled, bool rightHandEnabled, bool headEnabled, + const AnimPose& leftHandPose, const AnimPose& rightHandPose, + const glm::mat4& rigToSensorMatrix, const glm::mat4& sensorToRigMatrix) { + + int hipsIndex = indexOfJoint("Hips"); + const float ELBOW_POLE_VECTOR_BLEND_FACTOR = 0.85f; + + if (headEnabled) { + // always do IK if head is enabled + _animVars.set("leftHandIKEnabled", true); + _animVars.set("rightHandIKEnabled", true); + } else { + // only do IK if we have a valid foot. + _animVars.set("leftHandIKEnabled", leftHandEnabled); + _animVars.set("rightHandIKEnabled", rightHandEnabled); + } + + if (leftHandEnabled) { + + _animVars.set(LEFT_HAND_POSITION, leftHandPose.trans()); + _animVars.set(LEFT_HAND_ROTATION, leftHandPose.rot()); + + // We want to drive the IK directly from the trackers. + _animVars.set(LEFT_HAND_IK_POSITION_VAR, LEFT_HAND_POSITION); + _animVars.set(LEFT_HAND_IK_ROTATION_VAR, LEFT_HAND_ROTATION); + + int handJointIndex = _animSkeleton->nameToJointIndex("LeftHand"); + int elbowJointIndex = _animSkeleton->nameToJointIndex("LeftForeArm"); + int shoulderJointIndex = _animSkeleton->nameToJointIndex("LeftArm"); + int oppositeArmJointIndex = _animSkeleton->nameToJointIndex("LeftArm"); + glm::vec3 poleVector; + bool usePoleVector = calculateElbowPoleVector(handJointIndex, elbowJointIndex, shoulderJointIndex, oppositeArmJointIndex, poleVector); + glm::vec3 sensorPoleVector = transformVectorFast(rigToSensorMatrix, poleVector); + + // smooth toward desired pole vector from previous pole vector... to reduce jitter, but in sensor space. + if (!_prevLeftHandPoleVectorValid) { + _prevLeftHandPoleVectorValid = true; + _prevLeftHandPoleVector = sensorPoleVector; + } + glm::quat deltaRot = rotationBetween(_prevLeftHandPoleVector, sensorPoleVector); + glm::quat smoothDeltaRot = safeMix(deltaRot, Quaternions::IDENTITY, ELBOW_POLE_VECTOR_BLEND_FACTOR); + _prevLeftHandPoleVector = smoothDeltaRot * _prevLeftHandPoleVector; + + _animVars.set("leftHandPoleVectorEnabled", true); + _animVars.set("leftHandPoleVector", transformVectorFast(sensorToRigMatrix, _prevLeftFootPoleVector)); + } else { + // We want to drive the IK from the underlying animation. + // This gives us the ability to squat while in the HMD, without the feet from dipping under the floor. + _animVars.set(LEFT_HAND_IK_POSITION_VAR, MAIN_STATE_MACHINE_LEFT_HAND_POSITION); + _animVars.set(LEFT_HAND_IK_ROTATION_VAR, MAIN_STATE_MACHINE_LEFT_HAND_ROTATION); + + // We want to match the animated knee pose as close as possible, so don't use poleVectors + _animVars.set("leftHandPoleVectorEnabled", false); + _prevLeftHandPoleVectorValid = false; + } + + if (rightHandEnabled) { + + _animVars.set(RIGHT_HAND_POSITION, rightHandPose.trans()); + _animVars.set(RIGHT_HAND_ROTATION, rightHandPose.rot()); + + // We want to drive the IK directly from the trackers. + _animVars.set(RIGHT_HAND_IK_POSITION_VAR, RIGHT_HAND_POSITION); + _animVars.set(RIGHT_HAND_IK_ROTATION_VAR, RIGHT_HAND_ROTATION); + + int handJointIndex = _animSkeleton->nameToJointIndex("RightHand"); + int elbowJointIndex = _animSkeleton->nameToJointIndex("RightForeArm"); + int shoulderJointIndex = _animSkeleton->nameToJointIndex("RightArm"); + int oppositeArmJointIndex = _animSkeleton->nameToJointIndex("RightArm"); + glm::vec3 poleVector; + bool usePoleVector = calculateElbowPoleVector(handJointIndex, elbowJointIndex, shoulderJointIndex, oppositeArmJointIndex, poleVector); + glm::vec3 sensorPoleVector = transformVectorFast(rigToSensorMatrix, poleVector); + + // smooth toward desired pole vector from previous pole vector... to reduce jitter, but in sensor space. + if (!_prevRightHandPoleVectorValid) { + _prevRightHandPoleVectorValid = true; + _prevRightHandPoleVector = sensorPoleVector; + } + glm::quat deltaRot = rotationBetween(_prevRightHandPoleVector, sensorPoleVector); + glm::quat smoothDeltaRot = safeMix(deltaRot, Quaternions::IDENTITY, ELBOW_POLE_VECTOR_BLEND_FACTOR); + _prevRightHandPoleVector = smoothDeltaRot * _prevRightHandPoleVector; + + _animVars.set("rightHandPoleVectorEnabled", true); + _animVars.set("rightHandPoleVector", transformVectorFast(sensorToRigMatrix, _prevRightFootPoleVector)); + } else { + // We want to drive the IK from the underlying animation. + // This gives us the ability to squat while in the HMD, without the feet from dipping under the floor. + _animVars.set(RIGHT_HAND_IK_POSITION_VAR, MAIN_STATE_MACHINE_RIGHT_HAND_POSITION); + _animVars.set(RIGHT_HAND_IK_ROTATION_VAR, MAIN_STATE_MACHINE_RIGHT_HAND_ROTATION); + + // We want to match the animated knee pose as close as possible, so don't use poleVectors + _animVars.set("rightHandPoleVectorEnabled", false); + _prevRightHandPoleVectorValid = false; + } + +} + void Rig::updateFeet(bool leftFootEnabled, bool rightFootEnabled, bool headEnabled, const AnimPose& leftFootPose, const AnimPose& rightFootPose, const glm::mat4& rigToSensorMatrix, const glm::mat4& sensorToRigMatrix) { @@ -1750,6 +1861,10 @@ void Rig::updateFromControllerParameters(const ControllerParameters& params, flo params.hipsShapeInfo, params.spineShapeInfo, params.spine1ShapeInfo, params.spine2ShapeInfo, params.rigToSensorMatrix, sensorToRigMatrix); + updateHands2(leftHandEnabled, rightHandEnabled, _headEnabled, + params.primaryControllerPoses[PrimaryControllerType_LeftHand], params.primaryControllerPoses[PrimaryControllerType_RightHand], + params.rigToSensorMatrix, sensorToRigMatrix); + updateFeet(leftFootEnabled, rightFootEnabled, _headEnabled, params.primaryControllerPoses[PrimaryControllerType_LeftFoot], params.primaryControllerPoses[PrimaryControllerType_RightFoot], params.rigToSensorMatrix, sensorToRigMatrix); diff --git a/libraries/animation/src/Rig.h b/libraries/animation/src/Rig.h index 41c25a3c3e..e6effe9e53 100644 --- a/libraries/animation/src/Rig.h +++ b/libraries/animation/src/Rig.h @@ -250,6 +250,9 @@ protected: const HFMJointShapeInfo& hipsShapeInfo, const HFMJointShapeInfo& spineShapeInfo, const HFMJointShapeInfo& spine1ShapeInfo, const HFMJointShapeInfo& spine2ShapeInfo, const glm::mat4& rigToSensorMatrix, const glm::mat4& sensorToRigMatrix); + void updateHands2(bool leftHandEnabled, bool rightHandEnabled, bool headEnabled, + const AnimPose& leftHandPose, const AnimPose& rightHandPose, + const glm::mat4& rigToSensorMatrix, const glm::mat4& sensorToRigMatrix); void updateFeet(bool leftFootEnabled, bool rightFootEnabled, bool headEnabled, const AnimPose& leftFootPose, const AnimPose& rightFootPose, const glm::mat4& rigToSensorMatrix, const glm::mat4& sensorToRigMatrix); @@ -414,6 +417,12 @@ protected: glm::vec3 _prevLeftFootPoleVector { Vectors::UNIT_Z }; // sensor space bool _prevLeftFootPoleVectorValid { false }; + glm::vec3 _prevRightHandPoleVector { Vectors::UNIT_Z }; // sensor space + bool _prevRightHandPoleVectorValid { false }; + + glm::vec3 _prevLeftHandPoleVector { Vectors::UNIT_Z }; // sensor space + bool _prevLeftHandPoleVectorValid { false }; + int _rigId; bool _headEnabled { false }; bool _computeNetworkAnimation { false }; From 8d88c627b01161ed50942e192981c063f1dbb9df Mon Sep 17 00:00:00 2001 From: amantley Date: Mon, 21 Jan 2019 17:41:08 -0800 Subject: [PATCH 016/436] nearly have the arms legs and back working with out the ik node --- .../avatar/avatar-animation_twoboneIK.json | 3479 ++++++++--------- interface/src/Application.cpp | 1 - .../animation/src/AnimInverseKinematics.cpp | 13 +- libraries/animation/src/AnimSplineIK.cpp | 24 +- libraries/animation/src/AnimTwoBoneIK.cpp | 4 +- libraries/animation/src/Rig.cpp | 14 +- 6 files changed, 1773 insertions(+), 1762 deletions(-) diff --git a/interface/resources/avatar/avatar-animation_twoboneIK.json b/interface/resources/avatar/avatar-animation_twoboneIK.json index 8a18b4859a..45cb7b570e 100644 --- a/interface/resources/avatar/avatar-animation_twoboneIK.json +++ b/interface/resources/avatar/avatar-animation_twoboneIK.json @@ -112,7 +112,7 @@ }, "children": [ { - "id": "rightArmPoleVector", + "id": "rightHandPoleVector", "type": "poleVectorConstraint", "data": { "enabled": false, @@ -125,7 +125,7 @@ }, "children": [ { - "id": "rightArmIK", + "id": "rightHandIK", "type": "twoBoneIK", "data": { "alpha": 1.0, @@ -135,390 +135,147 @@ "midJointName": "RightForeArm", "tipJointName": "RightHand", "midHingeAxis": [ 0, 0, -1 ], - "alphaVar": "rightArmIKAlpha", - "enabledVar": "rightArmIKEnabled", - "endEffectorRotationVarVar": "rightArmIKRotationVar", - "endEffectorPositionVarVar": "rightArmIKPositionVar" + "alphaVar": "rightHandIKAlpha", + "enabledVar": "rightHandIKEnabled", + "endEffectorRotationVarVar": "rightHandIKRotationVar", + "endEffectorPositionVarVar": "rightHandIKPositionVar" }, "children": [ { - "id": "ikOverlay", - "type": "overlay", + "id": "leftHandPoleVector", + "type": "poleVectorConstraint", "data": { - "alpha": 1.0, - "alphaVar": "ikOverlayAlpha", - "boneSet": "fullBody" + "enabled": false, + "referenceVector": [ 0, 0, 1 ], + "baseJointName": "LeftArm", + "midJointName": "LeftForeArm", + "tipJointName": "LeftHand", + "enabledVar": "leftHandPoleVectorEnabled", + "poleVectorVar": "leftHandPoleVector" }, "children": [ { - "id": "ik", - "type": "inverseKinematics", + "id": "leftHandIK", + "type": "twoBoneIK", "data": { - "solutionSource": "relaxToUnderPoses", - "solutionSourceVar": "solutionSource", - "targets": [ - { - "jointName": "Hips", - "positionVar": "hipsPosition", - "rotationVar": "hipsRotation", - "typeVar": "hipsType", - "weightVar": "hipsWeight", - "weight": 1.0, - "flexCoefficients": [ 1 ] - }, - { - "jointName": "LeftHand", - "positionVar": "leftHandPosition", - "rotationVar": "leftHandRotation", - "typeVar": "leftHandType", - "weightVar": "leftHandWeight", - "weight": 1.0, - "flexCoefficients": [ 1, 0.5, 0.5, 0.2, 0.01, 0.005, 0.001, 0.0, 0.0 ], - "poleVectorEnabledVar": "leftHandPoleVectorEnabled", - "poleReferenceVectorVar": "leftHandPoleReferenceVector", - "poleVectorVar": "leftHandPoleVector" - } - ] - }, - "children": [] - }, - { - "id": "defaultPoseOverlay", - "type": "overlay", - "data": { - "alpha": 0.0, - "alphaVar": "defaultPoseOverlayAlpha", - "boneSet": "fullBody", - "boneSetVar": "defaultPoseOverlayBoneSet" + "alpha": 1.0, + "enabled": false, + "interpDuration": 15, + "baseJointName": "LeftArm", + "midJointName": "LeftForeArm", + "tipJointName": "LeftHand", + "midHingeAxis": [ 0, 0, 1 ], + "alphaVar": "leftHandIKAlpha", + "enabledVar": "leftHandIKEnabled", + "endEffectorRotationVarVar": "leftHandIKRotationVar", + "endEffectorPositionVarVar": "leftHandIKPositionVar" }, "children": [ { - "id": "defaultPose", - "type": "defaultPose", - "data": { - }, - "children": [] - }, - { - "id": "rightHandOverlay", + "id": "defaultPoseOverlay", "type": "overlay", "data": { "alpha": 0.0, - "boneSet": "rightHand", - "alphaVar": "rightHandOverlayAlpha" + "alphaVar": "defaultPoseOverlayAlpha", + "boneSet": "fullBody", + "boneSetVar": "defaultPoseOverlayBoneSet" }, "children": [ { - "id": "rightHandStateMachine", - "type": "stateMachine", + "id": "defaultPose", + "type": "defaultPose", "data": { - "currentState": "rightHandGrasp", - "states": [ - { - "id": "rightHandGrasp", - "interpTarget": 3, - "interpDuration": 3, - "transitions": [ - { - "var": "isRightIndexPoint", - "state": "rightIndexPoint" - }, - { - "var": "isRightThumbRaise", - "state": "rightThumbRaise" - }, - { - "var": "isRightIndexPointAndThumbRaise", - "state": "rightIndexPointAndThumbRaise" - } - ] - }, - { - "id": "rightIndexPoint", - "interpTarget": 15, - "interpDuration": 3, - "transitions": [ - { - "var": "isRightHandGrasp", - "state": "rightHandGrasp" - }, - { - "var": "isRightThumbRaise", - "state": "rightThumbRaise" - }, - { - "var": "isRightIndexPointAndThumbRaise", - "state": "rightIndexPointAndThumbRaise" - } - ] - }, - { - "id": "rightThumbRaise", - "interpTarget": 15, - "interpDuration": 3, - "transitions": [ - { - "var": "isRightHandGrasp", - "state": "rightHandGrasp" - }, - { - "var": "isRightIndexPoint", - "state": "rightIndexPoint" - }, - { - "var": "isRightIndexPointAndThumbRaise", - "state": "rightIndexPointAndThumbRaise" - } - ] - }, - { - "id": "rightIndexPointAndThumbRaise", - "interpTarget": 15, - "interpDuration": 3, - "transitions": [ - { - "var": "isRightHandGrasp", - "state": "rightHandGrasp" - }, - { - "var": "isRightIndexPoint", - "state": "rightIndexPoint" - }, - { - "var": "isRightThumbRaise", - "state": "rightThumbRaise" - } - ] - } - ] }, - "children": [ - { - "id": "rightHandGrasp", - "type": "blendLinear", - "data": { - "alpha": 0.0, - "alphaVar": "rightHandGraspAlpha" - }, - "children": [ - { - "id": "rightHandGraspOpen", - "type": "clip", - "data": { - "url": "qrc:///avatar/animations/hydra_pose_open_right.fbx", - "startFrame": 0.0, - "endFrame": 0.0, - "timeScale": 1.0, - "loopFlag": true - }, - "children": [] - }, - { - "id": "rightHandGraspClosed", - "type": "clip", - "data": { - "url": "qrc:///avatar/animations/hydra_pose_closed_right.fbx", - "startFrame": 0.0, - "endFrame": 0.0, - "timeScale": 1.0, - "loopFlag": true - }, - "children": [] - } - ] - }, - { - "id": "rightIndexPoint", - "type": "blendLinear", - "data": { - "alpha": 0.0, - "alphaVar": "rightHandGraspAlpha" - }, - "children": [ - { - "id": "rightIndexPointOpen", - "type": "clip", - "data": { - "url": "qrc:///avatar/animations/touch_point_open_right.fbx", - "startFrame": 15.0, - "endFrame": 15.0, - "timeScale": 1.0, - "loopFlag": true - }, - "children": [] - }, - { - "id": "rightIndexPointClosed", - "type": "clip", - "data": { - "url": "qrc:///avatar/animations/touch_point_closed_right.fbx", - "startFrame": 15.0, - "endFrame": 15.0, - "timeScale": 1.0, - "loopFlag": true - }, - "children": [] - } - ] - }, - { - "id": "rightThumbRaise", - "type": "blendLinear", - "data": { - "alpha": 0.0, - "alphaVar": "rightHandGraspAlpha" - }, - "children": [ - { - "id": "rightThumbRaiseOpen", - "type": "clip", - "data": { - "url": "qrc:///avatar/animations/touch_thumb_open_right.fbx", - "startFrame": 15.0, - "endFrame": 15.0, - "timeScale": 1.0, - "loopFlag": true - }, - "children": [] - }, - { - "id": "rightThumbRaiseClosed", - "type": "clip", - "data": { - "url": "qrc:///avatar/animations/touch_thumb_closed_right.fbx", - "startFrame": 15.0, - "endFrame": 15.0, - "timeScale": 1.0, - "loopFlag": true - }, - "children": [] - } - ] - }, - { - "id": "rightIndexPointAndThumbRaise", - "type": "blendLinear", - "data": { - "alpha": 0.0, - "alphaVar": "rightHandGraspAlpha" - }, - "children": [ - { - "id": "rightIndexPointAndThumbRaiseOpen", - "type": "clip", - "data": { - "url": "qrc:///avatar/animations/touch_thumb_point_open_right.fbx", - "startFrame": 15.0, - "endFrame": 15.0, - "timeScale": 1.0, - "loopFlag": true - }, - "children": [] - }, - { - "id": "rightIndexPointAndThumbRaiseClosed", - "type": "clip", - "data": { - "url": "qrc:///avatar/animations/touch_thumb_point_closed_right.fbx", - "startFrame": 15.0, - "endFrame": 15.0, - "timeScale": 1.0, - "loopFlag": true - }, - "children": [] - } - ] - } - ] + "children": [] }, { - "id": "leftHandOverlay", + "id": "rightHandOverlay", "type": "overlay", "data": { "alpha": 0.0, - "boneSet": "leftHand", - "alphaVar": "leftHandOverlayAlpha" + "boneSet": "rightHand", + "alphaVar": "rightHandOverlayAlpha" }, "children": [ { - "id": "leftHandStateMachine", + "id": "rightHandStateMachine", "type": "stateMachine", "data": { - "currentState": "leftHandGrasp", + "currentState": "rightHandGrasp", "states": [ { - "id": "leftHandGrasp", + "id": "rightHandGrasp", "interpTarget": 3, "interpDuration": 3, "transitions": [ { - "var": "isLeftIndexPoint", - "state": "leftIndexPoint" + "var": "isRightIndexPoint", + "state": "rightIndexPoint" }, { - "var": "isLeftThumbRaise", - "state": "leftThumbRaise" + "var": "isRightThumbRaise", + "state": "rightThumbRaise" }, { - "var": "isLeftIndexPointAndThumbRaise", - "state": "leftIndexPointAndThumbRaise" + "var": "isRightIndexPointAndThumbRaise", + "state": "rightIndexPointAndThumbRaise" } ] }, { - "id": "leftIndexPoint", + "id": "rightIndexPoint", "interpTarget": 15, "interpDuration": 3, "transitions": [ { - "var": "isLeftHandGrasp", - "state": "leftHandGrasp" + "var": "isRightHandGrasp", + "state": "rightHandGrasp" }, { - "var": "isLeftThumbRaise", - "state": "leftThumbRaise" + "var": "isRightThumbRaise", + "state": "rightThumbRaise" }, { - "var": "isLeftIndexPointAndThumbRaise", - "state": "leftIndexPointAndThumbRaise" + "var": "isRightIndexPointAndThumbRaise", + "state": "rightIndexPointAndThumbRaise" } ] }, { - "id": "leftThumbRaise", + "id": "rightThumbRaise", "interpTarget": 15, "interpDuration": 3, "transitions": [ { - "var": "isLeftHandGrasp", - "state": "leftHandGrasp" + "var": "isRightHandGrasp", + "state": "rightHandGrasp" }, { - "var": "isLeftIndexPoint", - "state": "leftIndexPoint" + "var": "isRightIndexPoint", + "state": "rightIndexPoint" }, { - "var": "isLeftIndexPointAndThumbRaise", - "state": "leftIndexPointAndThumbRaise" + "var": "isRightIndexPointAndThumbRaise", + "state": "rightIndexPointAndThumbRaise" } ] }, { - "id": "leftIndexPointAndThumbRaise", + "id": "rightIndexPointAndThumbRaise", "interpTarget": 15, "interpDuration": 3, "transitions": [ { - "var": "isLeftHandGrasp", - "state": "leftHandGrasp" + "var": "isRightHandGrasp", + "state": "rightHandGrasp" }, { - "var": "isLeftIndexPoint", - "state": "leftIndexPoint" + "var": "isRightIndexPoint", + "state": "rightIndexPoint" }, { - "var": "isLeftThumbRaise", - "state": "leftThumbRaise" + "var": "isRightThumbRaise", + "state": "rightThumbRaise" } ] } @@ -526,18 +283,18 @@ }, "children": [ { - "id": "leftHandGrasp", + "id": "rightHandGrasp", "type": "blendLinear", "data": { "alpha": 0.0, - "alphaVar": "leftHandGraspAlpha" + "alphaVar": "rightHandGraspAlpha" }, "children": [ { - "id": "leftHandGraspOpen", + "id": "rightHandGraspOpen", "type": "clip", "data": { - "url": "qrc:///avatar/animations/hydra_pose_open_left.fbx", + "url": "qrc:///avatar/animations/hydra_pose_open_right.fbx", "startFrame": 0.0, "endFrame": 0.0, "timeScale": 1.0, @@ -546,12 +303,12 @@ "children": [] }, { - "id": "leftHandGraspClosed", + "id": "rightHandGraspClosed", "type": "clip", "data": { - "url": "qrc:///avatar/animations/hydra_pose_closed_left.fbx", - "startFrame": 10.0, - "endFrame": 10.0, + "url": "qrc:///avatar/animations/hydra_pose_closed_right.fbx", + "startFrame": 0.0, + "endFrame": 0.0, "timeScale": 1.0, "loopFlag": true }, @@ -560,18 +317,18 @@ ] }, { - "id": "leftIndexPoint", + "id": "rightIndexPoint", "type": "blendLinear", "data": { "alpha": 0.0, - "alphaVar": "leftHandGraspAlpha" + "alphaVar": "rightHandGraspAlpha" }, "children": [ { - "id": "leftIndexPointOpen", + "id": "rightIndexPointOpen", "type": "clip", "data": { - "url": "qrc:///avatar/animations/touch_point_open_left.fbx", + "url": "qrc:///avatar/animations/touch_point_open_right.fbx", "startFrame": 15.0, "endFrame": 15.0, "timeScale": 1.0, @@ -580,10 +337,10 @@ "children": [] }, { - "id": "leftIndexPointClosed", + "id": "rightIndexPointClosed", "type": "clip", "data": { - "url": "qrc:///avatar/animations/touch_point_closed_left.fbx", + "url": "qrc:///avatar/animations/touch_point_closed_right.fbx", "startFrame": 15.0, "endFrame": 15.0, "timeScale": 1.0, @@ -594,18 +351,18 @@ ] }, { - "id": "leftThumbRaise", + "id": "rightThumbRaise", "type": "blendLinear", "data": { "alpha": 0.0, - "alphaVar": "leftHandGraspAlpha" + "alphaVar": "rightHandGraspAlpha" }, "children": [ { - "id": "leftThumbRaiseOpen", + "id": "rightThumbRaiseOpen", "type": "clip", "data": { - "url": "qrc:///avatar/animations/touch_thumb_open_left.fbx", + "url": "qrc:///avatar/animations/touch_thumb_open_right.fbx", "startFrame": 15.0, "endFrame": 15.0, "timeScale": 1.0, @@ -614,10 +371,10 @@ "children": [] }, { - "id": "leftThumbRaiseClosed", + "id": "rightThumbRaiseClosed", "type": "clip", "data": { - "url": "qrc:///avatar/animations/touch_thumb_closed_left.fbx", + "url": "qrc:///avatar/animations/touch_thumb_closed_right.fbx", "startFrame": 15.0, "endFrame": 15.0, "timeScale": 1.0, @@ -628,18 +385,18 @@ ] }, { - "id": "leftIndexPointAndThumbRaise", + "id": "rightIndexPointAndThumbRaise", "type": "blendLinear", "data": { "alpha": 0.0, - "alphaVar": "leftHandGraspAlpha" + "alphaVar": "rightHandGraspAlpha" }, "children": [ { - "id": "leftIndexPointAndThumbRaiseOpen", + "id": "rightIndexPointAndThumbRaiseOpen", "type": "clip", "data": { - "url": "qrc:///avatar/animations/touch_thumb_point_open_left.fbx", + "url": "qrc:///avatar/animations/touch_thumb_point_open_right.fbx", "startFrame": 15.0, "endFrame": 15.0, "timeScale": 1.0, @@ -648,10 +405,10 @@ "children": [] }, { - "id": "leftIndexPointAndThumbRaiseClosed", + "id": "rightIndexPointAndThumbRaiseClosed", "type": "clip", "data": { - "url": "qrc:///avatar/animations/touch_thumb_point_closed_left.fbx", + "url": "qrc:///avatar/animations/touch_thumb_point_closed_right.fbx", "startFrame": 15.0, "endFrame": 15.0, "timeScale": 1.0, @@ -664,871 +421,93 @@ ] }, { - "id": "mainStateMachine", - "type": "stateMachine", + "id": "leftHandOverlay", + "type": "overlay", "data": { - "outputJoints": [ "LeftFoot", "RightFoot" ], - "currentState": "idle", - "states": [ - { - "id": "idle", - "interpTarget": 20, - "interpDuration": 8, - "interpType": "snapshotPrev", - "transitions": [ - { - "var": "isMovingForward", - "state": "WALKFWD" - }, - { - "var": "isMovingBackward", - "state": "WALKBWD" - }, - { - "var": "isMovingRight", - "state": "STRAFERIGHT" - }, - { - "var": "isMovingLeft", - "state": "STRAFELEFT" - }, - { - "var": "isTurningRight", - "state": "turnRight" - }, - { - "var": "isTurningLeft", - "state": "turnLeft" - }, - { - "var": "isFlying", - "state": "fly" - }, - { - "var": "isTakeoffStand", - "state": "takeoffStand" - }, - { - "var": "isTakeoffRun", - "state": "TAKEOFFRUN" - }, - { - "var": "isInAirStand", - "state": "inAirStand" - }, - { - "var": "isInAirRun", - "state": "INAIRRUN" - }, - { - "var": "isMovingRightHmd", - "state": "strafeRightHmd" - }, - { - "var": "isMovingLeftHmd", - "state": "strafeLeftHmd" - } - ] - }, - { - "id": "idleToWalkFwd", - "interpTarget": 12, - "interpDuration": 8, - "transitions": [ - { - "var": "idleToWalkFwdOnDone", - "state": "WALKFWD" - }, - { - "var": "isNotMoving", - "state": "idle" - }, - { - "var": "isMovingBackward", - "state": "WALKBWD" - }, - { - "var": "isMovingRight", - "state": "STRAFERIGHT" - }, - { - "var": "isMovingLeft", - "state": "STRAFELEFT" - }, - { - "var": "isTurningRight", - "state": "turnRight" - }, - { - "var": "isTurningLeft", - "state": "turnLeft" - }, - { - "var": "isFlying", - "state": "fly" - }, - { - "var": "isTakeoffStand", - "state": "takeoffStand" - }, - { - "var": "isTakeoffRun", - "state": "TAKEOFFRUN" - }, - { - "var": "isInAirStand", - "state": "inAirStand" - }, - { - "var": "isInAirRun", - "state": "INAIRRUN" - }, - { - "var": "isMovingRightHmd", - "state": "strafeRightHmd" - }, - { - "var": "isMovingLeftHmd", - "state": "strafeLeftHmd" - } - ] - }, - { - "id": "idleSettle", - "interpTarget": 15, - "interpDuration": 8, - "interpType": "snapshotPrev", - "transitions": [ - { - "var": "idleSettleOnDone", - "state": "idle" - }, - { - "var": "isMovingForward", - "state": "WALKFWD" - }, - { - "var": "isMovingBackward", - "state": "WALKBWD" - }, - { - "var": "isMovingRight", - "state": "STRAFERIGHT" - }, - { - "var": "isMovingLeft", - "state": "STRAFELEFT" - }, - { - "var": "isMovingRightHmd", - "state": "strafeRightHmd" - }, - { - "var": "isMovingLeftHmd", - "state": "strafeLeftHmd" - }, - { - "var": "isTurningRight", - "state": "turnRight" - }, - { - "var": "isTurningLeft", - "state": "turnLeft" - }, - { - "var": "isFlying", - "state": "fly" - }, - { - "var": "isTakeoffStand", - "state": "takeoffStand" - }, - { - "var": "isTakeoffRun", - "state": "TAKEOFFRUN" - }, - { - "var": "isInAirStand", - "state": "inAirStand" - }, - { - "var": "isInAirRun", - "state": "INAIRRUN" - } - ] - }, - { - "id": "WALKFWD", - "interpTarget": 35, - "interpDuration": 10, - "interpType": "snapshotPrev", - "transitions": [ - { - "var": "isNotMoving", - "state": "idleSettle" - }, - { - "var": "isMovingBackward", - "state": "WALKBWD" - }, - { - "var": "isMovingRight", - "state": "STRAFERIGHT" - }, - { - "var": "isMovingLeft", - "state": "STRAFELEFT" - }, - { - "var": "isTurningRight", - "state": "turnRight" - }, - { - "var": "isTurningLeft", - "state": "turnLeft" - }, - { - "var": "isFlying", - "state": "fly" - }, - { - "var": "isTakeoffStand", - "state": "takeoffStand" - }, - { - "var": "isTakeoffRun", - "state": "TAKEOFFRUN" - }, - { - "var": "isInAirStand", - "state": "inAirStand" - }, - { - "var": "isInAirRun", - "state": "INAIRRUN" - }, - { - "var": "isMovingRightHmd", - "state": "strafeRightHmd" - }, - { - "var": "isMovingLeftHmd", - "state": "strafeLeftHmd" - } - ] - }, - { - "id": "WALKBWD", - "interpTarget": 35, - "interpDuration": 10, - "interpType": "snapshotPrev", - "transitions": [ - { - "var": "isNotMoving", - "state": "idleSettle" - }, - { - "var": "isMovingForward", - "state": "WALKFWD" - }, - { - "var": "isMovingRight", - "state": "STRAFERIGHT" - }, - { - "var": "isMovingLeft", - "state": "STRAFELEFT" - }, - { - "var": "isTurningRight", - "state": "turnRight" - }, - { - "var": "isTurningLeft", - "state": "turnLeft" - }, - { - "var": "isFlying", - "state": "fly" - }, - { - "var": "isTakeoffStand", - "state": "takeoffStand" - }, - { - "var": "isTakeoffRun", - "state": "TAKEOFFRUN" - }, - { - "var": "isInAirStand", - "state": "inAirStand" - }, - { - "var": "isInAirRun", - "state": "INAIRRUN" - }, - { - "var": "isMovingRightHmd", - "state": "strafeRightHmd" - }, - { - "var": "isMovingLeftHmd", - "state": "strafeLeftHmd" - } - ] - }, - { - "id": "STRAFERIGHT", - "interpTarget": 25, - "interpDuration": 8, - "interpType": "snapshotPrev", - "transitions": [ - { - "var": "isNotMoving", - "state": "idleSettle" - }, - { - "var": "isMovingForward", - "state": "WALKFWD" - }, - { - "var": "isMovingBackward", - "state": "WALKBWD" - }, - { - "var": "isMovingLeft", - "state": "STRAFELEFT" - }, - { - "var": "isTurningRight", - "state": "turnRight" - }, - { - "var": "isTurningLeft", - "state": "turnLeft" - }, - { - "var": "isFlying", - "state": "fly" - }, - { - "var": "isTakeoffStand", - "state": "takeoffStand" - }, - { - "var": "isTakeoffRun", - "state": "TAKEOFFRUN" - }, - { - "var": "isInAirStand", - "state": "inAirStand" - }, - { - "var": "isInAirRun", - "state": "INAIRRUN" - }, - { - "var": "isMovingRightHmd", - "state": "strafeRightHmd" - }, - { - "var": "isMovingLeftHmd", - "state": "strafeLeftHmd" - } - ] - }, - { - "id": "STRAFELEFT", - "interpTarget": 25, - "interpDuration": 8, - "interpType": "snapshotPrev", - "transitions": [ - { - "var": "isNotMoving", - "state": "idleSettle" - }, - { - "var": "isMovingForward", - "state": "WALKFWD" - }, - { - "var": "isMovingBackward", - "state": "WALKBWD" - }, - { - "var": "isMovingRight", - "state": "STRAFERIGHT" - }, - { - "var": "isTurningRight", - "state": "turnRight" - }, - { - "var": "isTurningLeft", - "state": "turnLeft" - }, - { - "var": "isFlying", - "state": "fly" - }, - { - "var": "isTakeoffStand", - "state": "takeoffStand" - }, - { - "var": "isTakeoffRun", - "state": "TAKEOFFRUN" - }, - { - "var": "isInAirStand", - "state": "inAirStand" - }, - { - "var": "isInAirRun", - "state": "INAIRRUN" - }, - { - "var": "isMovingRightHmd", - "state": "strafeRightHmd" - }, - { - "var": "isMovingLeftHmd", - "state": "strafeLeftHmd" - } - ] - }, - { - "id": "turnRight", - "interpTarget": 6, - "interpDuration": 8, - "transitions": [ - { - "var": "isNotTurning", - "state": "idle" - }, - { - "var": "isMovingForward", - "state": "WALKFWD" - }, - { - "var": "isMovingBackward", - "state": "WALKBWD" - }, - { - "var": "isMovingRight", - "state": "STRAFERIGHT" - }, - { - "var": "isMovingLeft", - "state": "STRAFELEFT" - }, - { - "var": "isTurningLeft", - "state": "turnLeft" - }, - { - "var": "isFlying", - "state": "fly" - }, - { - "var": "isTakeoffStand", - "state": "takeoffStand" - }, - { - "var": "isTakeoffRun", - "state": "TAKEOFFRUN" - }, - { - "var": "isInAirStand", - "state": "inAirStand" - }, - { - "var": "isInAirRun", - "state": "INAIRRUN" - }, - { - "var": "isMovingRightHmd", - "state": "strafeRightHmd" - }, - { - "var": "isMovingLeftHmd", - "state": "strafeLeftHmd" - } - ] - }, - { - "id": "turnLeft", - "interpTarget": 6, - "interpDuration": 8, - "transitions": [ - { - "var": "isNotTurning", - "state": "idle" - }, - { - "var": "isMovingForward", - "state": "WALKFWD" - }, - { - "var": "isMovingBackward", - "state": "WALKBWD" - }, - { - "var": "isMovingRight", - "state": "STRAFERIGHT" - }, - { - "var": "isMovingLeft", - "state": "STRAFELEFT" - }, - { - "var": "isTurningRight", - "state": "turnRight" - }, - { - "var": "isFlying", - "state": "fly" - }, - { - "var": "isTakeoffStand", - "state": "takeoffStand" - }, - { - "var": "isTakeoffRun", - "state": "TAKEOFFRUN" - }, - { - "var": "isInAirStand", - "state": "inAirStand" - }, - { - "var": "isInAirRun", - "state": "INAIRRUN" - }, - { - "var": "isMovingRightHmd", - "state": "strafeRightHmd" - }, - { - "var": "isMovingLeftHmd", - "state": "strafeLeftHmd" - } - ] - }, - { - "id": "strafeRightHmd", - "interpTarget": 5, - "interpDuration": 8, - "interpType": "snapshotPrev", - "transitions": [ - { - "var": "isNotMoving", - "state": "idleSettle" - }, - { - "var": "isMovingForward", - "state": "WALKFWD" - }, - { - "var": "isMovingBackward", - "state": "WALKBWD" - }, - { - "var": "isMovingLeftHmd", - "state": "strafeLeftHmd" - }, - { - "var": "isMovingRight", - "state": "STRAFERIGHT" - }, - { - "var": "isMovingLeft", - "state": "STRAFELEFT" - }, - { - "var": "isTurningRight", - "state": "turnRight" - }, - { - "var": "isTurningLeft", - "state": "turnLeft" - }, - { - "var": "isFlying", - "state": "fly" - }, - { - "var": "isTakeoffStand", - "state": "takeoffStand" - }, - { - "var": "isTakeoffRun", - "state": "TAKEOFFRUN" - }, - { - "var": "isInAirStand", - "state": "inAirStand" - }, - { - "var": "isInAirRun", - "state": "INAIRRUN" - } - ] - }, - { - "id": "strafeLeftHmd", - "interpTarget": 5, - "interpDuration": 8, - "interpType": "snapshotPrev", - "transitions": [ - { - "var": "isNotMoving", - "state": "idleSettle" - }, - { - "var": "isMovingForward", - "state": "WALKFWD" - }, - { - "var": "isMovingBackward", - "state": "WALKBWD" - }, - { - "var": "isMovingRightHmd", - "state": "strafeRightHmd" - }, - { - "var": "isMovingRight", - "state": "STRAFERIGHT" - }, - { - "var": "isMovingLeft", - "state": "STRAFELEFT" - }, - { - "var": "isTurningRight", - "state": "turnRight" - }, - { - "var": "isTurningLeft", - "state": "turnLeft" - }, - { - "var": "isFlying", - "state": "fly" - }, - { - "var": "isTakeoffStand", - "state": "takeoffStand" - }, - { - "var": "isTakeoffRun", - "state": "TAKEOFFRUN" - }, - { - "var": "isInAirStand", - "state": "inAirStand" - }, - { - "var": "isInAirRun", - "state": "INAIRRUN" - } - ] - }, - { - "id": "fly", - "interpTarget": 6, - "interpDuration": 6, - "transitions": [ - { - "var": "isNotFlying", - "state": "idleSettle" - } - ] - }, - { - "id": "takeoffStand", - "interpTarget": 2, - "interpDuration": 2, - "transitions": [ - { - "var": "isNotTakeoff", - "state": "inAirStand" - } - ] - }, - { - "id": "TAKEOFFRUN", - "interpTarget": 2, - "interpDuration": 2, - "transitions": [ - { - "var": "isNotTakeoff", - "state": "INAIRRUN" - } - ] - }, - { - "id": "inAirStand", - "interpTarget": 3, - "interpDuration": 3, - "interpType": "snapshotPrev", - "transitions": [ - { - "var": "isNotInAir", - "state": "landStandImpact" - } - ] - }, - { - "id": "INAIRRUN", - "interpTarget": 3, - "interpDuration": 3, - "interpType": "snapshotPrev", - "transitions": [ - { - "var": "isNotInAir", - "state": "WALKFWD" - } - ] - }, - { - "id": "landStandImpact", - "interpTarget": 1, - "interpDuration": 1, - "transitions": [ - { - "var": "isFlying", - "state": "fly" - }, - { - "var": "isTakeoffStand", - "state": "takeoffStand" - }, - { - "var": "isTakeoffRun", - "state": "TAKEOFFRUN" - }, - { - "var": "landStandImpactOnDone", - "state": "landStand" - } - ] - }, - { - "id": "landStand", - "interpTarget": 1, - "interpDuration": 1, - "transitions": [ - { - "var": "isMovingForward", - "state": "WALKFWD" - }, - { - "var": "isMovingBackward", - "state": "WALKBWD" - }, - { - "var": "isMovingRight", - "state": "STRAFERIGHT" - }, - { - "var": "isMovingLeft", - "state": "STRAFELEFT" - }, - { - "var": "isTurningRight", - "state": "turnRight" - }, - { - "var": "isTurningLeft", - "state": "turnLeft" - }, - { - "var": "isFlying", - "state": "fly" - }, - { - "var": "isTakeoffStand", - "state": "takeoffStand" - }, - { - "var": "isTakeoffRun", - "state": "TAKEOFFRUN" - }, - { - "var": "isInAirStand", - "state": "inAirStand" - }, - { - "var": "isInAirRun", - "state": "INAIRRUN" - }, - { - "var": "landStandOnDone", - "state": "idle" - }, - { - "var": "isMovingRightHmd", - "state": "strafeRightHmd" - }, - { - "var": "isMovingLeftHmd", - "state": "strafeLeftHmd" - } - ] - }, - { - "id": "LANDRUN", - "interpTarget": 2, - "interpDuration": 2, - "transitions": [ - { - "var": "isFlying", - "state": "fly" - }, - { - "var": "isTakeoffStand", - "state": "takeoffStand" - }, - { - "var": "isTakeoffRun", - "state": "TAKEOFFRUN" - }, - { - "var": "landRunOnDone", - "state": "WALKFWD" - } - ] - } - ] + "alpha": 0.0, + "boneSet": "leftHand", + "alphaVar": "leftHandOverlayAlpha" }, "children": [ { - "id": "idle", + "id": "leftHandStateMachine", "type": "stateMachine", "data": { - "currentState": "idleStand", + "currentState": "leftHandGrasp", "states": [ { - "id": "idleStand", - "interpTarget": 6, - "interpDuration": 10, + "id": "leftHandGrasp", + "interpTarget": 3, + "interpDuration": 3, "transitions": [ { - "var": "isTalking", - "state": "idleTalk" + "var": "isLeftIndexPoint", + "state": "leftIndexPoint" + }, + { + "var": "isLeftThumbRaise", + "state": "leftThumbRaise" + }, + { + "var": "isLeftIndexPointAndThumbRaise", + "state": "leftIndexPointAndThumbRaise" } ] }, { - "id": "idleTalk", - "interpTarget": 6, - "interpDuration": 10, + "id": "leftIndexPoint", + "interpTarget": 15, + "interpDuration": 3, "transitions": [ { - "var": "notIsTalking", - "state": "idleStand" + "var": "isLeftHandGrasp", + "state": "leftHandGrasp" + }, + { + "var": "isLeftThumbRaise", + "state": "leftThumbRaise" + }, + { + "var": "isLeftIndexPointAndThumbRaise", + "state": "leftIndexPointAndThumbRaise" + } + ] + }, + { + "id": "leftThumbRaise", + "interpTarget": 15, + "interpDuration": 3, + "transitions": [ + { + "var": "isLeftHandGrasp", + "state": "leftHandGrasp" + }, + { + "var": "isLeftIndexPoint", + "state": "leftIndexPoint" + }, + { + "var": "isLeftIndexPointAndThumbRaise", + "state": "leftIndexPointAndThumbRaise" + } + ] + }, + { + "id": "leftIndexPointAndThumbRaise", + "interpTarget": 15, + "interpDuration": 3, + "transitions": [ + { + "var": "isLeftHandGrasp", + "state": "leftHandGrasp" + }, + { + "var": "isLeftIndexPoint", + "state": "leftIndexPoint" + }, + { + "var": "isLeftThumbRaise", + "state": "leftThumbRaise" } ] } @@ -1536,562 +515,1494 @@ }, "children": [ { - "id": "idleStand", - "type": "clip", + "id": "leftHandGrasp", + "type": "blendLinear", "data": { - "url": "qrc:///avatar/animations/idle.fbx", - "startFrame": 0.0, - "endFrame": 300.0, - "timeScale": 1.0, - "loopFlag": true + "alpha": 0.0, + "alphaVar": "leftHandGraspAlpha" }, - "children": [] + "children": [ + { + "id": "leftHandGraspOpen", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/hydra_pose_open_left.fbx", + "startFrame": 0.0, + "endFrame": 0.0, + "timeScale": 1.0, + "loopFlag": true + }, + "children": [] + }, + { + "id": "leftHandGraspClosed", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/hydra_pose_closed_left.fbx", + "startFrame": 10.0, + "endFrame": 10.0, + "timeScale": 1.0, + "loopFlag": true + }, + "children": [] + } + ] }, { - "id": "idleTalk", - "type": "clip", + "id": "leftIndexPoint", + "type": "blendLinear", "data": { - "url": "qrc:///avatar/animations/talk.fbx", - "startFrame": 0.0, - "endFrame": 800.0, - "timeScale": 1.0, - "loopFlag": true + "alpha": 0.0, + "alphaVar": "leftHandGraspAlpha" }, - "children": [] + "children": [ + { + "id": "leftIndexPointOpen", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/touch_point_open_left.fbx", + "startFrame": 15.0, + "endFrame": 15.0, + "timeScale": 1.0, + "loopFlag": true + }, + "children": [] + }, + { + "id": "leftIndexPointClosed", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/touch_point_closed_left.fbx", + "startFrame": 15.0, + "endFrame": 15.0, + "timeScale": 1.0, + "loopFlag": true + }, + "children": [] + } + ] + }, + { + "id": "leftThumbRaise", + "type": "blendLinear", + "data": { + "alpha": 0.0, + "alphaVar": "leftHandGraspAlpha" + }, + "children": [ + { + "id": "leftThumbRaiseOpen", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/touch_thumb_open_left.fbx", + "startFrame": 15.0, + "endFrame": 15.0, + "timeScale": 1.0, + "loopFlag": true + }, + "children": [] + }, + { + "id": "leftThumbRaiseClosed", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/touch_thumb_closed_left.fbx", + "startFrame": 15.0, + "endFrame": 15.0, + "timeScale": 1.0, + "loopFlag": true + }, + "children": [] + } + ] + }, + { + "id": "leftIndexPointAndThumbRaise", + "type": "blendLinear", + "data": { + "alpha": 0.0, + "alphaVar": "leftHandGraspAlpha" + }, + "children": [ + { + "id": "leftIndexPointAndThumbRaiseOpen", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/touch_thumb_point_open_left.fbx", + "startFrame": 15.0, + "endFrame": 15.0, + "timeScale": 1.0, + "loopFlag": true + }, + "children": [] + }, + { + "id": "leftIndexPointAndThumbRaiseClosed", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/touch_thumb_point_closed_left.fbx", + "startFrame": 15.0, + "endFrame": 15.0, + "timeScale": 1.0, + "loopFlag": true + }, + "children": [] + } + ] } ] }, { - "id": "WALKFWD", - "type": "blendLinearMove", + "id": "mainStateMachine", + "type": "stateMachine", "data": { - "alpha": 0.0, - "desiredSpeed": 1.4, - "characteristicSpeeds": [ 0.5, 1.8, 2.3, 3.2, 4.5 ], - "alphaVar": "moveForwardAlpha", - "desiredSpeedVar": "moveForwardSpeed" + "outputJoints": [ "LeftFoot", "RightFoot" ], + "currentState": "idle", + "states": [ + { + "id": "idle", + "interpTarget": 20, + "interpDuration": 8, + "interpType": "snapshotPrev", + "transitions": [ + { + "var": "isMovingForward", + "state": "WALKFWD" + }, + { + "var": "isMovingBackward", + "state": "WALKBWD" + }, + { + "var": "isMovingRight", + "state": "STRAFERIGHT" + }, + { + "var": "isMovingLeft", + "state": "STRAFELEFT" + }, + { + "var": "isTurningRight", + "state": "turnRight" + }, + { + "var": "isTurningLeft", + "state": "turnLeft" + }, + { + "var": "isFlying", + "state": "fly" + }, + { + "var": "isTakeoffStand", + "state": "takeoffStand" + }, + { + "var": "isTakeoffRun", + "state": "TAKEOFFRUN" + }, + { + "var": "isInAirStand", + "state": "inAirStand" + }, + { + "var": "isInAirRun", + "state": "INAIRRUN" + }, + { + "var": "isMovingRightHmd", + "state": "strafeRightHmd" + }, + { + "var": "isMovingLeftHmd", + "state": "strafeLeftHmd" + } + ] + }, + { + "id": "idleToWalkFwd", + "interpTarget": 12, + "interpDuration": 8, + "transitions": [ + { + "var": "idleToWalkFwdOnDone", + "state": "WALKFWD" + }, + { + "var": "isNotMoving", + "state": "idle" + }, + { + "var": "isMovingBackward", + "state": "WALKBWD" + }, + { + "var": "isMovingRight", + "state": "STRAFERIGHT" + }, + { + "var": "isMovingLeft", + "state": "STRAFELEFT" + }, + { + "var": "isTurningRight", + "state": "turnRight" + }, + { + "var": "isTurningLeft", + "state": "turnLeft" + }, + { + "var": "isFlying", + "state": "fly" + }, + { + "var": "isTakeoffStand", + "state": "takeoffStand" + }, + { + "var": "isTakeoffRun", + "state": "TAKEOFFRUN" + }, + { + "var": "isInAirStand", + "state": "inAirStand" + }, + { + "var": "isInAirRun", + "state": "INAIRRUN" + }, + { + "var": "isMovingRightHmd", + "state": "strafeRightHmd" + }, + { + "var": "isMovingLeftHmd", + "state": "strafeLeftHmd" + } + ] + }, + { + "id": "idleSettle", + "interpTarget": 15, + "interpDuration": 8, + "interpType": "snapshotPrev", + "transitions": [ + { + "var": "idleSettleOnDone", + "state": "idle" + }, + { + "var": "isMovingForward", + "state": "WALKFWD" + }, + { + "var": "isMovingBackward", + "state": "WALKBWD" + }, + { + "var": "isMovingRight", + "state": "STRAFERIGHT" + }, + { + "var": "isMovingLeft", + "state": "STRAFELEFT" + }, + { + "var": "isMovingRightHmd", + "state": "strafeRightHmd" + }, + { + "var": "isMovingLeftHmd", + "state": "strafeLeftHmd" + }, + { + "var": "isTurningRight", + "state": "turnRight" + }, + { + "var": "isTurningLeft", + "state": "turnLeft" + }, + { + "var": "isFlying", + "state": "fly" + }, + { + "var": "isTakeoffStand", + "state": "takeoffStand" + }, + { + "var": "isTakeoffRun", + "state": "TAKEOFFRUN" + }, + { + "var": "isInAirStand", + "state": "inAirStand" + }, + { + "var": "isInAirRun", + "state": "INAIRRUN" + } + ] + }, + { + "id": "WALKFWD", + "interpTarget": 35, + "interpDuration": 10, + "interpType": "snapshotPrev", + "transitions": [ + { + "var": "isNotMoving", + "state": "idleSettle" + }, + { + "var": "isMovingBackward", + "state": "WALKBWD" + }, + { + "var": "isMovingRight", + "state": "STRAFERIGHT" + }, + { + "var": "isMovingLeft", + "state": "STRAFELEFT" + }, + { + "var": "isTurningRight", + "state": "turnRight" + }, + { + "var": "isTurningLeft", + "state": "turnLeft" + }, + { + "var": "isFlying", + "state": "fly" + }, + { + "var": "isTakeoffStand", + "state": "takeoffStand" + }, + { + "var": "isTakeoffRun", + "state": "TAKEOFFRUN" + }, + { + "var": "isInAirStand", + "state": "inAirStand" + }, + { + "var": "isInAirRun", + "state": "INAIRRUN" + }, + { + "var": "isMovingRightHmd", + "state": "strafeRightHmd" + }, + { + "var": "isMovingLeftHmd", + "state": "strafeLeftHmd" + } + ] + }, + { + "id": "WALKBWD", + "interpTarget": 35, + "interpDuration": 10, + "interpType": "snapshotPrev", + "transitions": [ + { + "var": "isNotMoving", + "state": "idleSettle" + }, + { + "var": "isMovingForward", + "state": "WALKFWD" + }, + { + "var": "isMovingRight", + "state": "STRAFERIGHT" + }, + { + "var": "isMovingLeft", + "state": "STRAFELEFT" + }, + { + "var": "isTurningRight", + "state": "turnRight" + }, + { + "var": "isTurningLeft", + "state": "turnLeft" + }, + { + "var": "isFlying", + "state": "fly" + }, + { + "var": "isTakeoffStand", + "state": "takeoffStand" + }, + { + "var": "isTakeoffRun", + "state": "TAKEOFFRUN" + }, + { + "var": "isInAirStand", + "state": "inAirStand" + }, + { + "var": "isInAirRun", + "state": "INAIRRUN" + }, + { + "var": "isMovingRightHmd", + "state": "strafeRightHmd" + }, + { + "var": "isMovingLeftHmd", + "state": "strafeLeftHmd" + } + ] + }, + { + "id": "STRAFERIGHT", + "interpTarget": 25, + "interpDuration": 8, + "interpType": "snapshotPrev", + "transitions": [ + { + "var": "isNotMoving", + "state": "idleSettle" + }, + { + "var": "isMovingForward", + "state": "WALKFWD" + }, + { + "var": "isMovingBackward", + "state": "WALKBWD" + }, + { + "var": "isMovingLeft", + "state": "STRAFELEFT" + }, + { + "var": "isTurningRight", + "state": "turnRight" + }, + { + "var": "isTurningLeft", + "state": "turnLeft" + }, + { + "var": "isFlying", + "state": "fly" + }, + { + "var": "isTakeoffStand", + "state": "takeoffStand" + }, + { + "var": "isTakeoffRun", + "state": "TAKEOFFRUN" + }, + { + "var": "isInAirStand", + "state": "inAirStand" + }, + { + "var": "isInAirRun", + "state": "INAIRRUN" + }, + { + "var": "isMovingRightHmd", + "state": "strafeRightHmd" + }, + { + "var": "isMovingLeftHmd", + "state": "strafeLeftHmd" + } + ] + }, + { + "id": "STRAFELEFT", + "interpTarget": 25, + "interpDuration": 8, + "interpType": "snapshotPrev", + "transitions": [ + { + "var": "isNotMoving", + "state": "idleSettle" + }, + { + "var": "isMovingForward", + "state": "WALKFWD" + }, + { + "var": "isMovingBackward", + "state": "WALKBWD" + }, + { + "var": "isMovingRight", + "state": "STRAFERIGHT" + }, + { + "var": "isTurningRight", + "state": "turnRight" + }, + { + "var": "isTurningLeft", + "state": "turnLeft" + }, + { + "var": "isFlying", + "state": "fly" + }, + { + "var": "isTakeoffStand", + "state": "takeoffStand" + }, + { + "var": "isTakeoffRun", + "state": "TAKEOFFRUN" + }, + { + "var": "isInAirStand", + "state": "inAirStand" + }, + { + "var": "isInAirRun", + "state": "INAIRRUN" + }, + { + "var": "isMovingRightHmd", + "state": "strafeRightHmd" + }, + { + "var": "isMovingLeftHmd", + "state": "strafeLeftHmd" + } + ] + }, + { + "id": "turnRight", + "interpTarget": 6, + "interpDuration": 8, + "transitions": [ + { + "var": "isNotTurning", + "state": "idle" + }, + { + "var": "isMovingForward", + "state": "WALKFWD" + }, + { + "var": "isMovingBackward", + "state": "WALKBWD" + }, + { + "var": "isMovingRight", + "state": "STRAFERIGHT" + }, + { + "var": "isMovingLeft", + "state": "STRAFELEFT" + }, + { + "var": "isTurningLeft", + "state": "turnLeft" + }, + { + "var": "isFlying", + "state": "fly" + }, + { + "var": "isTakeoffStand", + "state": "takeoffStand" + }, + { + "var": "isTakeoffRun", + "state": "TAKEOFFRUN" + }, + { + "var": "isInAirStand", + "state": "inAirStand" + }, + { + "var": "isInAirRun", + "state": "INAIRRUN" + }, + { + "var": "isMovingRightHmd", + "state": "strafeRightHmd" + }, + { + "var": "isMovingLeftHmd", + "state": "strafeLeftHmd" + } + ] + }, + { + "id": "turnLeft", + "interpTarget": 6, + "interpDuration": 8, + "transitions": [ + { + "var": "isNotTurning", + "state": "idle" + }, + { + "var": "isMovingForward", + "state": "WALKFWD" + }, + { + "var": "isMovingBackward", + "state": "WALKBWD" + }, + { + "var": "isMovingRight", + "state": "STRAFERIGHT" + }, + { + "var": "isMovingLeft", + "state": "STRAFELEFT" + }, + { + "var": "isTurningRight", + "state": "turnRight" + }, + { + "var": "isFlying", + "state": "fly" + }, + { + "var": "isTakeoffStand", + "state": "takeoffStand" + }, + { + "var": "isTakeoffRun", + "state": "TAKEOFFRUN" + }, + { + "var": "isInAirStand", + "state": "inAirStand" + }, + { + "var": "isInAirRun", + "state": "INAIRRUN" + }, + { + "var": "isMovingRightHmd", + "state": "strafeRightHmd" + }, + { + "var": "isMovingLeftHmd", + "state": "strafeLeftHmd" + } + ] + }, + { + "id": "strafeRightHmd", + "interpTarget": 5, + "interpDuration": 8, + "interpType": "snapshotPrev", + "transitions": [ + { + "var": "isNotMoving", + "state": "idleSettle" + }, + { + "var": "isMovingForward", + "state": "WALKFWD" + }, + { + "var": "isMovingBackward", + "state": "WALKBWD" + }, + { + "var": "isMovingLeftHmd", + "state": "strafeLeftHmd" + }, + { + "var": "isMovingRight", + "state": "STRAFERIGHT" + }, + { + "var": "isMovingLeft", + "state": "STRAFELEFT" + }, + { + "var": "isTurningRight", + "state": "turnRight" + }, + { + "var": "isTurningLeft", + "state": "turnLeft" + }, + { + "var": "isFlying", + "state": "fly" + }, + { + "var": "isTakeoffStand", + "state": "takeoffStand" + }, + { + "var": "isTakeoffRun", + "state": "TAKEOFFRUN" + }, + { + "var": "isInAirStand", + "state": "inAirStand" + }, + { + "var": "isInAirRun", + "state": "INAIRRUN" + } + ] + }, + { + "id": "strafeLeftHmd", + "interpTarget": 5, + "interpDuration": 8, + "interpType": "snapshotPrev", + "transitions": [ + { + "var": "isNotMoving", + "state": "idleSettle" + }, + { + "var": "isMovingForward", + "state": "WALKFWD" + }, + { + "var": "isMovingBackward", + "state": "WALKBWD" + }, + { + "var": "isMovingRightHmd", + "state": "strafeRightHmd" + }, + { + "var": "isMovingRight", + "state": "STRAFERIGHT" + }, + { + "var": "isMovingLeft", + "state": "STRAFELEFT" + }, + { + "var": "isTurningRight", + "state": "turnRight" + }, + { + "var": "isTurningLeft", + "state": "turnLeft" + }, + { + "var": "isFlying", + "state": "fly" + }, + { + "var": "isTakeoffStand", + "state": "takeoffStand" + }, + { + "var": "isTakeoffRun", + "state": "TAKEOFFRUN" + }, + { + "var": "isInAirStand", + "state": "inAirStand" + }, + { + "var": "isInAirRun", + "state": "INAIRRUN" + } + ] + }, + { + "id": "fly", + "interpTarget": 6, + "interpDuration": 6, + "transitions": [ + { + "var": "isNotFlying", + "state": "idleSettle" + } + ] + }, + { + "id": "takeoffStand", + "interpTarget": 2, + "interpDuration": 2, + "transitions": [ + { + "var": "isNotTakeoff", + "state": "inAirStand" + } + ] + }, + { + "id": "TAKEOFFRUN", + "interpTarget": 2, + "interpDuration": 2, + "transitions": [ + { + "var": "isNotTakeoff", + "state": "INAIRRUN" + } + ] + }, + { + "id": "inAirStand", + "interpTarget": 3, + "interpDuration": 3, + "interpType": "snapshotPrev", + "transitions": [ + { + "var": "isNotInAir", + "state": "landStandImpact" + } + ] + }, + { + "id": "INAIRRUN", + "interpTarget": 3, + "interpDuration": 3, + "interpType": "snapshotPrev", + "transitions": [ + { + "var": "isNotInAir", + "state": "WALKFWD" + } + ] + }, + { + "id": "landStandImpact", + "interpTarget": 1, + "interpDuration": 1, + "transitions": [ + { + "var": "isFlying", + "state": "fly" + }, + { + "var": "isTakeoffStand", + "state": "takeoffStand" + }, + { + "var": "isTakeoffRun", + "state": "TAKEOFFRUN" + }, + { + "var": "landStandImpactOnDone", + "state": "landStand" + } + ] + }, + { + "id": "landStand", + "interpTarget": 1, + "interpDuration": 1, + "transitions": [ + { + "var": "isMovingForward", + "state": "WALKFWD" + }, + { + "var": "isMovingBackward", + "state": "WALKBWD" + }, + { + "var": "isMovingRight", + "state": "STRAFERIGHT" + }, + { + "var": "isMovingLeft", + "state": "STRAFELEFT" + }, + { + "var": "isTurningRight", + "state": "turnRight" + }, + { + "var": "isTurningLeft", + "state": "turnLeft" + }, + { + "var": "isFlying", + "state": "fly" + }, + { + "var": "isTakeoffStand", + "state": "takeoffStand" + }, + { + "var": "isTakeoffRun", + "state": "TAKEOFFRUN" + }, + { + "var": "isInAirStand", + "state": "inAirStand" + }, + { + "var": "isInAirRun", + "state": "INAIRRUN" + }, + { + "var": "landStandOnDone", + "state": "idle" + }, + { + "var": "isMovingRightHmd", + "state": "strafeRightHmd" + }, + { + "var": "isMovingLeftHmd", + "state": "strafeLeftHmd" + } + ] + }, + { + "id": "LANDRUN", + "interpTarget": 2, + "interpDuration": 2, + "transitions": [ + { + "var": "isFlying", + "state": "fly" + }, + { + "var": "isTakeoffStand", + "state": "takeoffStand" + }, + { + "var": "isTakeoffRun", + "state": "TAKEOFFRUN" + }, + { + "var": "landRunOnDone", + "state": "WALKFWD" + } + ] + } + ] }, "children": [ { - "id": "walkFwdShort_c", - "type": "clip", + "id": "idle", + "type": "stateMachine", "data": { - "url": "qrc:///avatar/animations/walk_short_fwd.fbx", - "startFrame": 0.0, - "endFrame": 39.0, - "timeScale": 1.0, - "loopFlag": true + "currentState": "idleStand", + "states": [ + { + "id": "idleStand", + "interpTarget": 6, + "interpDuration": 10, + "transitions": [ + { + "var": "isTalking", + "state": "idleTalk" + } + ] + }, + { + "id": "idleTalk", + "interpTarget": 6, + "interpDuration": 10, + "transitions": [ + { + "var": "notIsTalking", + "state": "idleStand" + } + ] + } + ] }, - "children": [] + "children": [ + { + "id": "idleStand", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/idle.fbx", + "startFrame": 0.0, + "endFrame": 300.0, + "timeScale": 1.0, + "loopFlag": true + }, + "children": [] + }, + { + "id": "idleTalk", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/talk.fbx", + "startFrame": 0.0, + "endFrame": 800.0, + "timeScale": 1.0, + "loopFlag": true + }, + "children": [] + } + ] }, { - "id": "walkFwdNormal_c", - "type": "clip", + "id": "WALKFWD", + "type": "blendLinearMove", "data": { - "url": "qrc:///avatar/animations/walk_fwd.fbx", - "startFrame": 0.0, - "endFrame": 30.0, - "timeScale": 1.0, - "loopFlag": true + "alpha": 0.0, + "desiredSpeed": 1.4, + "characteristicSpeeds": [ 0.5, 1.8, 2.3, 3.2, 4.5 ], + "alphaVar": "moveForwardAlpha", + "desiredSpeedVar": "moveForwardSpeed" }, - "children": [] + "children": [ + { + "id": "walkFwdShort_c", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/walk_short_fwd.fbx", + "startFrame": 0.0, + "endFrame": 39.0, + "timeScale": 1.0, + "loopFlag": true + }, + "children": [] + }, + { + "id": "walkFwdNormal_c", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/walk_fwd.fbx", + "startFrame": 0.0, + "endFrame": 30.0, + "timeScale": 1.0, + "loopFlag": true + }, + "children": [] + }, + { + "id": "walkFwdFast_c", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/walk_fwd_fast.fbx", + "startFrame": 0.0, + "endFrame": 25.0, + "timeScale": 1.0, + "loopFlag": true + }, + "children": [] + }, + { + "id": "walkFwdJog_c", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/jog_fwd.fbx", + "startFrame": 0.0, + "endFrame": 25.0, + "timeScale": 1.0, + "loopFlag": true + }, + "children": [] + }, + { + "id": "walkFwdRun_c", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/run_fwd.fbx", + "startFrame": 0.0, + "endFrame": 21.0, + "timeScale": 1.0, + "loopFlag": true + }, + "children": [] + } + ] }, { - "id": "walkFwdFast_c", + "id": "idleToWalkFwd", "type": "clip", "data": { - "url": "qrc:///avatar/animations/walk_fwd_fast.fbx", - "startFrame": 0.0, - "endFrame": 25.0, - "timeScale": 1.0, - "loopFlag": true - }, - "children": [] - }, - { - "id": "walkFwdJog_c", - "type": "clip", - "data": { - "url": "qrc:///avatar/animations/jog_fwd.fbx", - "startFrame": 0.0, - "endFrame": 25.0, - "timeScale": 1.0, - "loopFlag": true - }, - "children": [] - }, - { - "id": "walkFwdRun_c", - "type": "clip", - "data": { - "url": "qrc:///avatar/animations/run_fwd.fbx", - "startFrame": 0.0, - "endFrame": 21.0, - "timeScale": 1.0, - "loopFlag": true - }, - "children": [] - } - ] - }, - { - "id": "idleToWalkFwd", - "type": "clip", - "data": { - "url": "qrc:///avatar/animations/idle_to_walk.fbx", - "startFrame": 1.0, - "endFrame": 13.0, - "timeScale": 1.0, - "loopFlag": false - }, - "children": [] - }, - { - "id": "idleSettle", - "type": "clip", - "data": { - "url": "qrc:///avatar/animations/settle_to_idle.fbx", - "startFrame": 1.0, - "endFrame": 59.0, - "timeScale": 1.0, - "loopFlag": false - }, - "children": [] - }, - { - "id": "WALKBWD", - "type": "blendLinearMove", - "data": { - "alpha": 0.0, - "desiredSpeed": 1.4, - "characteristicSpeeds": [ 0.6, 1.6, 2.3, 3.1 ], - "alphaVar": "moveBackwardAlpha", - "desiredSpeedVar": "moveBackwardSpeed" - }, - "children": [ - { - "id": "walkBwdShort_c", - "type": "clip", - "data": { - "url": "qrc:///avatar/animations/walk_short_bwd.fbx", - "startFrame": 0.0, - "endFrame": 38.0, - "timeScale": 1.0, - "loopFlag": true - }, - "children": [] - }, - { - "id": "walkBwdFast_c", - "type": "clip", - "data": { - "url": "qrc:///avatar/animations/walk_bwd_fast.fbx", - "startFrame": 0.0, - "endFrame": 27.0, - "timeScale": 1.0, - "loopFlag": true - }, - "children": [] - }, - { - "id": "jogBwd_c", - "type": "clip", - "data": { - "url": "qrc:///avatar/animations/jog_bwd.fbx", - "startFrame": 0.0, - "endFrame": 24.0, - "timeScale": 1.0, - "loopFlag": true - }, - "children": [] - }, - { - "id": "runBwd_c", - "type": "clip", - "data": { - "url": "qrc:///avatar/animations/run_bwd.fbx", - "startFrame": 0.0, - "endFrame": 16.0, - "timeScale": 1.0, - "loopFlag": true - }, - "children": [] - } - ] - }, - { - "id": "turnLeft", - "type": "clip", - "data": { - "url": "qrc:///avatar/animations/turn_left.fbx", - "startFrame": 0.0, - "endFrame": 32.0, - "timeScale": 1.0, - "loopFlag": true - }, - "children": [] - }, - { - "id": "turnRight", - "type": "clip", - "data": { - "url": "qrc:///avatar/animations/turn_left.fbx", - "startFrame": 0.0, - "endFrame": 32.0, - "timeScale": 1.0, - "loopFlag": true, - "mirrorFlag": true - }, - "children": [] - }, - { - "id": "STRAFELEFT", - "type": "blendLinearMove", - "data": { - "alpha": 0.0, - "desiredSpeed": 1.4, - "characteristicSpeeds": [ 0.1, 0.5, 1.0, 2.6, 3.0 ], - "alphaVar": "moveLateralAlpha", - "desiredSpeedVar": "moveLateralSpeed" - }, - "children": [ - { - "id": "strafeLeftShortStep_c", - "type": "clip", - "data": { - "url": "qrc:///avatar/animations/side_step_short_left.fbx", - "startFrame": 0.0, - "endFrame": 29.0, - "timeScale": 1.0, - "loopFlag": true - }, - "children": [] - }, - { - "id": "strafeLeftStep_c", - "type": "clip", - "data": { - "url": "qrc:///avatar/animations/side_step_left.fbx", - "startFrame": 0.0, - "endFrame": 20.0, - "timeScale": 1.0, - "loopFlag": true - }, - "children": [] - }, - { - "id": "strafeLeftWalk_c", - "type": "clip", - "data": { - "url": "qrc:///avatar/animations/walk_left.fbx", - "startFrame": 0.0, - "endFrame": 35.0, - "timeScale": 1.0, - "loopFlag": true - }, - "children": [] - }, - { - "id": "strafeLeftWalkFast_c", - "type": "clip", - "data": { - "url": "qrc:///avatar/animations/walk_left_fast.fbx", - "startFrame": 0.0, - "endFrame": 21.0, - "timeScale": 1.0, - "loopFlag": true - }, - "children": [] - }, - { - "id": "strafeLeftJog_c", - "type": "clip", - "data": { - "url": "qrc:///avatar/animations/jog_left.fbx", - "startFrame": 0.0, - "endFrame": 24.0, - "timeScale": 1.0, - "loopFlag": true - }, - "children": [] - } - ] - }, - { - "id": "STRAFERIGHT", - "type": "blendLinearMove", - "data": { - "alpha": 0.0, - "desiredSpeed": 1.4, - "characteristicSpeeds": [ 0.1, 0.5, 1.0, 2.6, 3.0 ], - "alphaVar": "moveLateralAlpha", - "desiredSpeedVar": "moveLateralSpeed" - }, - "children": [ - { - "id": "strafeRightShortStep_c", - "type": "clip", - "data": { - "url": "qrc:///avatar/animations/side_step_short_left.fbx", - "startFrame": 0.0, - "endFrame": 29.0, - "timeScale": 1.0, - "loopFlag": true, - "mirrorFlag": true - }, - "children": [] - }, - { - "id": "strafeRightStep_c", - "type": "clip", - "data": { - "url": "qrc:///avatar/animations/side_step_left.fbx", - "startFrame": 0.0, - "endFrame": 20.0, - "timeScale": 1.0, - "loopFlag": true, - "mirrorFlag": true - }, - "children": [] - }, - { - "id": "strafeRightWalk_c", - "type": "clip", - "data": { - "url": "qrc:///avatar/animations/walk_left.fbx", - "startFrame": 0.0, - "endFrame": 35.0, - "timeScale": 1.0, - "loopFlag": true, - "mirrorFlag": true - }, - "children": [] - }, - { - "id": "strafeRightFast_c", - "type": "clip", - "data": { - "url": "qrc:///avatar/animations/walk_left_fast.fbx", - "startFrame": 0.0, - "endFrame": 21.0, - "timeScale": 1.0, - "loopFlag": true, - "mirrorFlag": true - }, - "children": [] - }, - { - "id": "strafeRightJog_c", - "type": "clip", - "data": { - "url": "qrc:///avatar/animations/jog_left.fbx", - "startFrame": 0.0, - "endFrame": 24.0, - "timeScale": 1.0, - "loopFlag": true, - "mirrorFlag": true - }, - "children": [] - } - ] - }, - { - "id": "strafeLeftHmd", - "type": "blendLinearMove", - "data": { - "alpha": 0.0, - "desiredSpeed": 1.4, - "characteristicSpeeds": [ 0, 0.5, 2.5 ], - "alphaVar": "moveLateralAlpha", - "desiredSpeedVar": "moveLateralSpeed" - }, - "children": [ - { - "id": "stepLeftShort_c", - "type": "clip", - "data": { - "url": "qrc:///avatar/animations/side_step_short_left.fbx", - "startFrame": 0.0, - "endFrame": 29.0, - "timeScale": 1.0, - "loopFlag": true - }, - "children": [] - }, - { - "id": "stepLeft_c", - "type": "clip", - "data": { - "url": "qrc:///avatar/animations/side_step_left.fbx", - "startFrame": 0.0, - "endFrame": 20.0, - "timeScale": 1.0, - "loopFlag": true - }, - "children": [] - }, - { - "id": "strafeLeftAnim_c", - "type": "clip", - "data": { - "url": "qrc:///avatar/animations/side_step_left_fast.fbx", - "startFrame": 0.0, - "endFrame": 16.0, - "timeScale": 1.0, - "loopFlag": true - }, - "children": [] - } - ] - }, - { - "id": "strafeRightHmd", - "type": "blendLinearMove", - "data": { - "alpha": 0.0, - "desiredSpeed": 1.4, - "characteristicSpeeds": [ 0, 0.5, 2.5 ], - "alphaVar": "moveLateralAlpha", - "desiredSpeedVar": "moveLateralSpeed" - }, - "children": [ - { - "id": "stepRightShort_c", - "type": "clip", - "data": { - "url": "qrc:///avatar/animations/side_step_short_left.fbx", - "startFrame": 0.0, - "endFrame": 29.0, - "timeScale": 1.0, - "loopFlag": true, - "mirrorFlag": true - }, - "children": [] - }, - { - "id": "stepRight_c", - "type": "clip", - "data": { - "url": "qrc:///avatar/animations/side_step_left.fbx", - "startFrame": 0.0, - "endFrame": 20.0, - "timeScale": 1.0, - "loopFlag": true, - "mirrorFlag": true - }, - "children": [] - }, - { - "id": "strafeRightAnim_c", - "type": "clip", - "data": { - "url": "qrc:///avatar/animations/side_step_left_fast.fbx", - "startFrame": 0.0, - "endFrame": 16.0, - "timeScale": 1.0, - "loopFlag": true, - "mirrorFlag": true - }, - "children": [] - } - ] - }, - { - "id": "fly", - "type": "clip", - "data": { - "url": "qrc:///avatar/animations/fly.fbx", - "startFrame": 1.0, - "endFrame": 80.0, - "timeScale": 1.0, - "loopFlag": true - }, - "children": [] - }, - { - "id": "takeoffStand", - "type": "clip", - "data": { - "url": "qrc:///avatar/animations/jump_standing_launch.fbx", - "startFrame": 2.0, - "endFrame": 16.0, - "timeScale": 1.0, - "loopFlag": false - }, - "children": [] - }, - { - "id": "TAKEOFFRUN", - "type": "clip", - "data": { - "url": "qrc:///avatar/animations/jump_running_launch_land.fbx", - "startFrame": 4.0, - "endFrame": 15.0, - "timeScale": 1.0, - "loopFlag": false - }, - "children": [] - }, - { - "id": "inAirStand", - "type": "blendLinear", - "data": { - "alpha": 0.0, - "alphaVar": "inAirAlpha" - }, - "children": [ - { - "id": "inAirStandPreApex", - "type": "clip", - "data": { - "url": "qrc:///avatar/animations/jump_standing_apex.fbx", - "startFrame": 0.0, - "endFrame": 0.0, - "timeScale": 1.0, - "loopFlag": false - }, - "children": [] - }, - { - "id": "inAirStandApex", - "type": "clip", - "data": { - "url": "qrc:///avatar/animations/jump_standing_apex.fbx", + "url": "qrc:///avatar/animations/idle_to_walk.fbx", "startFrame": 1.0, - "endFrame": 1.0, + "endFrame": 13.0, "timeScale": 1.0, "loopFlag": false }, "children": [] }, { - "id": "inAirStandPostApex", + "id": "idleSettle", "type": "clip", "data": { - "url": "qrc:///avatar/animations/jump_standing_apex.fbx", - "startFrame": 2.0, - "endFrame": 2.0, + "url": "qrc:///avatar/animations/settle_to_idle.fbx", + "startFrame": 1.0, + "endFrame": 59.0, "timeScale": 1.0, "loopFlag": false }, "children": [] - } - ] - }, - { - "id": "INAIRRUN", - "type": "blendLinear", - "data": { - "alpha": 0.0, - "alphaVar": "inAirAlpha" - }, - "children": [ + }, { - "id": "inAirRunPreApex", + "id": "WALKBWD", + "type": "blendLinearMove", + "data": { + "alpha": 0.0, + "desiredSpeed": 1.4, + "characteristicSpeeds": [ 0.6, 1.6, 2.3, 3.1 ], + "alphaVar": "moveBackwardAlpha", + "desiredSpeedVar": "moveBackwardSpeed" + }, + "children": [ + { + "id": "walkBwdShort_c", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/walk_short_bwd.fbx", + "startFrame": 0.0, + "endFrame": 38.0, + "timeScale": 1.0, + "loopFlag": true + }, + "children": [] + }, + { + "id": "walkBwdFast_c", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/walk_bwd_fast.fbx", + "startFrame": 0.0, + "endFrame": 27.0, + "timeScale": 1.0, + "loopFlag": true + }, + "children": [] + }, + { + "id": "jogBwd_c", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/jog_bwd.fbx", + "startFrame": 0.0, + "endFrame": 24.0, + "timeScale": 1.0, + "loopFlag": true + }, + "children": [] + }, + { + "id": "runBwd_c", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/run_bwd.fbx", + "startFrame": 0.0, + "endFrame": 16.0, + "timeScale": 1.0, + "loopFlag": true + }, + "children": [] + } + ] + }, + { + "id": "turnLeft", "type": "clip", "data": { - "url": "qrc:///avatar/animations/jump_running_launch_land.fbx", - "startFrame": 16.0, + "url": "qrc:///avatar/animations/turn_left.fbx", + "startFrame": 0.0, + "endFrame": 32.0, + "timeScale": 1.0, + "loopFlag": true + }, + "children": [] + }, + { + "id": "turnRight", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/turn_left.fbx", + "startFrame": 0.0, + "endFrame": 32.0, + "timeScale": 1.0, + "loopFlag": true, + "mirrorFlag": true + }, + "children": [] + }, + { + "id": "STRAFELEFT", + "type": "blendLinearMove", + "data": { + "alpha": 0.0, + "desiredSpeed": 1.4, + "characteristicSpeeds": [ 0.1, 0.5, 1.0, 2.6, 3.0 ], + "alphaVar": "moveLateralAlpha", + "desiredSpeedVar": "moveLateralSpeed" + }, + "children": [ + { + "id": "strafeLeftShortStep_c", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/side_step_short_left.fbx", + "startFrame": 0.0, + "endFrame": 29.0, + "timeScale": 1.0, + "loopFlag": true + }, + "children": [] + }, + { + "id": "strafeLeftStep_c", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/side_step_left.fbx", + "startFrame": 0.0, + "endFrame": 20.0, + "timeScale": 1.0, + "loopFlag": true + }, + "children": [] + }, + { + "id": "strafeLeftWalk_c", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/walk_left.fbx", + "startFrame": 0.0, + "endFrame": 35.0, + "timeScale": 1.0, + "loopFlag": true + }, + "children": [] + }, + { + "id": "strafeLeftWalkFast_c", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/walk_left_fast.fbx", + "startFrame": 0.0, + "endFrame": 21.0, + "timeScale": 1.0, + "loopFlag": true + }, + "children": [] + }, + { + "id": "strafeLeftJog_c", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/jog_left.fbx", + "startFrame": 0.0, + "endFrame": 24.0, + "timeScale": 1.0, + "loopFlag": true + }, + "children": [] + } + ] + }, + { + "id": "STRAFERIGHT", + "type": "blendLinearMove", + "data": { + "alpha": 0.0, + "desiredSpeed": 1.4, + "characteristicSpeeds": [ 0.1, 0.5, 1.0, 2.6, 3.0 ], + "alphaVar": "moveLateralAlpha", + "desiredSpeedVar": "moveLateralSpeed" + }, + "children": [ + { + "id": "strafeRightShortStep_c", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/side_step_short_left.fbx", + "startFrame": 0.0, + "endFrame": 29.0, + "timeScale": 1.0, + "loopFlag": true, + "mirrorFlag": true + }, + "children": [] + }, + { + "id": "strafeRightStep_c", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/side_step_left.fbx", + "startFrame": 0.0, + "endFrame": 20.0, + "timeScale": 1.0, + "loopFlag": true, + "mirrorFlag": true + }, + "children": [] + }, + { + "id": "strafeRightWalk_c", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/walk_left.fbx", + "startFrame": 0.0, + "endFrame": 35.0, + "timeScale": 1.0, + "loopFlag": true, + "mirrorFlag": true + }, + "children": [] + }, + { + "id": "strafeRightFast_c", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/walk_left_fast.fbx", + "startFrame": 0.0, + "endFrame": 21.0, + "timeScale": 1.0, + "loopFlag": true, + "mirrorFlag": true + }, + "children": [] + }, + { + "id": "strafeRightJog_c", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/jog_left.fbx", + "startFrame": 0.0, + "endFrame": 24.0, + "timeScale": 1.0, + "loopFlag": true, + "mirrorFlag": true + }, + "children": [] + } + ] + }, + { + "id": "strafeLeftHmd", + "type": "blendLinearMove", + "data": { + "alpha": 0.0, + "desiredSpeed": 1.4, + "characteristicSpeeds": [ 0, 0.5, 2.5 ], + "alphaVar": "moveLateralAlpha", + "desiredSpeedVar": "moveLateralSpeed" + }, + "children": [ + { + "id": "stepLeftShort_c", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/side_step_short_left.fbx", + "startFrame": 0.0, + "endFrame": 29.0, + "timeScale": 1.0, + "loopFlag": true + }, + "children": [] + }, + { + "id": "stepLeft_c", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/side_step_left.fbx", + "startFrame": 0.0, + "endFrame": 20.0, + "timeScale": 1.0, + "loopFlag": true + }, + "children": [] + }, + { + "id": "strafeLeftAnim_c", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/side_step_left_fast.fbx", + "startFrame": 0.0, + "endFrame": 16.0, + "timeScale": 1.0, + "loopFlag": true + }, + "children": [] + } + ] + }, + { + "id": "strafeRightHmd", + "type": "blendLinearMove", + "data": { + "alpha": 0.0, + "desiredSpeed": 1.4, + "characteristicSpeeds": [ 0, 0.5, 2.5 ], + "alphaVar": "moveLateralAlpha", + "desiredSpeedVar": "moveLateralSpeed" + }, + "children": [ + { + "id": "stepRightShort_c", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/side_step_short_left.fbx", + "startFrame": 0.0, + "endFrame": 29.0, + "timeScale": 1.0, + "loopFlag": true, + "mirrorFlag": true + }, + "children": [] + }, + { + "id": "stepRight_c", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/side_step_left.fbx", + "startFrame": 0.0, + "endFrame": 20.0, + "timeScale": 1.0, + "loopFlag": true, + "mirrorFlag": true + }, + "children": [] + }, + { + "id": "strafeRightAnim_c", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/side_step_left_fast.fbx", + "startFrame": 0.0, + "endFrame": 16.0, + "timeScale": 1.0, + "loopFlag": true, + "mirrorFlag": true + }, + "children": [] + } + ] + }, + { + "id": "fly", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/fly.fbx", + "startFrame": 1.0, + "endFrame": 80.0, + "timeScale": 1.0, + "loopFlag": true + }, + "children": [] + }, + { + "id": "takeoffStand", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/jump_standing_launch.fbx", + "startFrame": 2.0, "endFrame": 16.0, "timeScale": 1.0, "loopFlag": false @@ -2099,66 +2010,146 @@ "children": [] }, { - "id": "inAirRunApex", + "id": "TAKEOFFRUN", "type": "clip", "data": { "url": "qrc:///avatar/animations/jump_running_launch_land.fbx", - "startFrame": 22.0, - "endFrame": 22.0, + "startFrame": 4.0, + "endFrame": 15.0, "timeScale": 1.0, "loopFlag": false }, "children": [] }, { - "id": "inAirRunPostApex", + "id": "inAirStand", + "type": "blendLinear", + "data": { + "alpha": 0.0, + "alphaVar": "inAirAlpha" + }, + "children": [ + { + "id": "inAirStandPreApex", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/jump_standing_apex.fbx", + "startFrame": 0.0, + "endFrame": 0.0, + "timeScale": 1.0, + "loopFlag": false + }, + "children": [] + }, + { + "id": "inAirStandApex", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/jump_standing_apex.fbx", + "startFrame": 1.0, + "endFrame": 1.0, + "timeScale": 1.0, + "loopFlag": false + }, + "children": [] + }, + { + "id": "inAirStandPostApex", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/jump_standing_apex.fbx", + "startFrame": 2.0, + "endFrame": 2.0, + "timeScale": 1.0, + "loopFlag": false + }, + "children": [] + } + ] + }, + { + "id": "INAIRRUN", + "type": "blendLinear", + "data": { + "alpha": 0.0, + "alphaVar": "inAirAlpha" + }, + "children": [ + { + "id": "inAirRunPreApex", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/jump_running_launch_land.fbx", + "startFrame": 16.0, + "endFrame": 16.0, + "timeScale": 1.0, + "loopFlag": false + }, + "children": [] + }, + { + "id": "inAirRunApex", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/jump_running_launch_land.fbx", + "startFrame": 22.0, + "endFrame": 22.0, + "timeScale": 1.0, + "loopFlag": false + }, + "children": [] + }, + { + "id": "inAirRunPostApex", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/jump_running_launch_land.fbx", + "startFrame": 33.0, + "endFrame": 33.0, + "timeScale": 1.0, + "loopFlag": false + }, + "children": [] + } + ] + }, + { + "id": "landStandImpact", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/jump_standing_land_settle.fbx", + "startFrame": 1.0, + "endFrame": 6.0, + "timeScale": 1.0, + "loopFlag": false + }, + "children": [] + }, + { + "id": "landStand", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/jump_standing_land_settle.fbx", + "startFrame": 6.0, + "endFrame": 68.0, + "timeScale": 1.0, + "loopFlag": false + }, + "children": [] + }, + { + "id": "LANDRUN", "type": "clip", "data": { "url": "qrc:///avatar/animations/jump_running_launch_land.fbx", - "startFrame": 33.0, - "endFrame": 33.0, + "startFrame": 29.0, + "endFrame": 40.0, "timeScale": 1.0, "loopFlag": false }, "children": [] } ] - }, - { - "id": "landStandImpact", - "type": "clip", - "data": { - "url": "qrc:///avatar/animations/jump_standing_land_settle.fbx", - "startFrame": 1.0, - "endFrame": 6.0, - "timeScale": 1.0, - "loopFlag": false - }, - "children": [] - }, - { - "id": "landStand", - "type": "clip", - "data": { - "url": "qrc:///avatar/animations/jump_standing_land_settle.fbx", - "startFrame": 6.0, - "endFrame": 68.0, - "timeScale": 1.0, - "loopFlag": false - }, - "children": [] - }, - { - "id": "LANDRUN", - "type": "clip", - "data": { - "url": "qrc:///avatar/animations/jump_running_launch_land.fbx", - "startFrame": 29.0, - "endFrame": 40.0, - "timeScale": 1.0, - "loopFlag": false - }, - "children": [] } ] } diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index 2401bf5315..de773f2d20 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -4679,7 +4679,6 @@ void setupCpuMonitorThread() { void Application::idle() { PerformanceTimer perfTimer("idle"); - qCDebug(interfaceapp) << "idle called"; // Update the deadlock watchdog updateHeartbeat(); diff --git a/libraries/animation/src/AnimInverseKinematics.cpp b/libraries/animation/src/AnimInverseKinematics.cpp index e5509dc43d..8d2ba0fd78 100644 --- a/libraries/animation/src/AnimInverseKinematics.cpp +++ b/libraries/animation/src/AnimInverseKinematics.cpp @@ -886,7 +886,7 @@ const AnimPoseVec& AnimInverseKinematics::overlay(const AnimVariantMap& animVars if (dt > MAX_OVERLAY_DT) { dt = MAX_OVERLAY_DT; } - + if (_relativePoses.size() != underPoses.size()) { loadPoses(underPoses); } else { @@ -973,8 +973,8 @@ const AnimPoseVec& AnimInverseKinematics::overlay(const AnimVariantMap& animVars ::blend(1, &prevHipsAbsPose, &absPose, alpha, &absPose); } - _relativePoses[_hipsIndex] = parentAbsPose.inverse() * absPose; - _relativePoses[_hipsIndex].scale() = glm::vec3(1.0f); + //_relativePoses[_hipsIndex] = parentAbsPose.inverse() * absPose; + //_relativePoses[_hipsIndex].scale() = glm::vec3(1.0f); } // if there is an active jointChainInfo for the hips store the post shifted hips into it. @@ -1041,10 +1041,13 @@ const AnimPoseVec& AnimInverseKinematics::overlay(const AnimVariantMap& animVars preconditionRelativePosesToAvoidLimbLock(context, targets); - solve(context, targets, dt, jointChainInfoVec); + //qCDebug(animation) << "hips before ccd" << _relativePoses[_hipsIndex]; + //solve(context, targets, dt, jointChainInfoVec); + //qCDebug(animation) << "hips after ccd" << _relativePoses[_hipsIndex]; + } } - + if (context.getEnableDebugDrawIKConstraints()) { debugDrawConstraints(context); } diff --git a/libraries/animation/src/AnimSplineIK.cpp b/libraries/animation/src/AnimSplineIK.cpp index fe54aa5fe7..23bf8b2800 100644 --- a/libraries/animation/src/AnimSplineIK.cpp +++ b/libraries/animation/src/AnimSplineIK.cpp @@ -48,6 +48,22 @@ const AnimPoseVec& AnimSplineIK::evaluate(const AnimVariantMap& animVars, const // evalute underPoses AnimPoseVec underPoses = _children[0]->evaluate(animVars, context, dt, triggersOut); _poses = underPoses; + + // now we override the hips relative pose based on the hips target that has been set. + //////////////////////////////////////////////////// + if (_poses.size() > 0) { + AnimPose hipsUnderPose = _skeleton->getAbsolutePose(_hipsIndex, _poses); + glm::quat hipsTargetRotation = animVars.lookupRigToGeometry("hipsRotation", hipsUnderPose.rot()); + glm::vec3 hipsTargetTranslation = animVars.lookupRigToGeometry("hipsPosition", hipsUnderPose.trans()); + AnimPose absHipsTargetPose(hipsTargetRotation, hipsTargetTranslation); + + int hipsParentIndex = _skeleton->getParentIndex(_hipsIndex); + AnimPose hipsParentAbsPose = _skeleton->getAbsolutePose(hipsParentIndex, _poses); + + _poses[_hipsIndex] = hipsParentAbsPose.inverse() * absHipsTargetPose; + _poses[_hipsIndex].scale() = glm::vec3(1.0f); + } + ////////////////////////////////////////////////////////////////////////////////// // check to see if we actually need absolute poses. AnimPoseVec absolutePoses; @@ -65,7 +81,7 @@ const AnimPoseVec& AnimSplineIK::evaluate(const AnimVariantMap& animVars, const AnimPose origSpine1 = _skeleton->getAbsolutePose(_skeleton->nameToJointIndex("Spine1"),_poses); //origSpine2PoseRel = origSpine1.inverse() * origSpine2; //qCDebug(animation) << "origSpine2Pose: " << origSpine2Pose.rot(); - qCDebug(animation) << "original relative spine2 " << origSpine2PoseAbs; + //qCDebug(animation) << "original relative spine2 " << origSpine2PoseAbs; } @@ -116,8 +132,8 @@ const AnimPoseVec& AnimSplineIK::evaluate(const AnimVariantMap& animVars, const targetSpine2 = AnimPose(rotation3, afterSolveSpine2.trans()); finalSpine2 = afterSolveSpine1.inverse() * targetSpine2; - qCDebug(animation) << "relative spine2 after solve" << afterSolveSpine2Rel; - qCDebug(animation) << "relative spine2 orig" << originalSpine2Relative; + //qCDebug(animation) << "relative spine2 after solve" << afterSolveSpine2Rel; + //qCDebug(animation) << "relative spine2 orig" << originalSpine2Relative; AnimPose latestSpine2Relative(originalSpine2Relative.rot(), afterSolveSpine2Rel.trans()); //jointChain.setRelativePoseAtJointIndex(jointIndex2, finalSpine2); jointChain.outputRelativePoses(_poses); @@ -146,7 +162,7 @@ const AnimPoseVec& AnimSplineIK::evaluate(const AnimVariantMap& animVars, const glm::quat rotation2 = animVars.lookupRigToGeometry("spine2Rotation", absPose2.rot()); glm::vec3 translation2 = animVars.lookupRigToGeometry("spine2Position", absPose2.trans()); float weight2 = animVars.lookup("spine2Weight", "2.0"); - qCDebug(animation) << "rig to geometry" << rotation2; + // qCDebug(animation) << "rig to geometry" << rotation2; //target2.setPose(rotation2, translation2); target2.setPose(targetSpine2.rot(), targetSpine2.trans()); diff --git a/libraries/animation/src/AnimTwoBoneIK.cpp b/libraries/animation/src/AnimTwoBoneIK.cpp index 5df98df969..31397157ac 100644 --- a/libraries/animation/src/AnimTwoBoneIK.cpp +++ b/libraries/animation/src/AnimTwoBoneIK.cpp @@ -79,6 +79,7 @@ const AnimPoseVec& AnimTwoBoneIK::evaluate(const AnimVariantMap& animVars, const // determine if we should interpolate bool enabled = animVars.lookup(_enabledVar, _enabled); + // qCDebug(animation) << "two bone var " << _enabledVar; if (enabled != _enabled) { AnimChain poseChain; poseChain.buildFromRelativePoses(_skeleton, _poses, _tipJointIndex); @@ -91,7 +92,7 @@ const AnimPoseVec& AnimTwoBoneIK::evaluate(const AnimVariantMap& animVars, const _enabled = enabled; // don't build chains or do IK if we are disabled & not interping. - if (_interpType == InterpType::None){// && !enabled) { + if (_interpType == InterpType::None && !enabled) { _poses = underPoses; return _poses; } @@ -122,6 +123,7 @@ const AnimPoseVec& AnimTwoBoneIK::evaluate(const AnimVariantMap& animVars, const // First look in the triggers then look in the animVars, so we can follow output joints underneath us in the anim graph AnimPose targetPose(tipPose); if (triggersOut.hasKey(endEffectorRotationVar)) { + qCDebug(animation) << " end effector variable " << endEffectorRotationVar << " is " << triggersOut.lookupRigToGeometry(endEffectorRotationVar, tipPose.rot()); targetPose.rot() = triggersOut.lookupRigToGeometry(endEffectorRotationVar, tipPose.rot()); } else if (animVars.hasKey(endEffectorRotationVar)) { targetPose.rot() = animVars.lookupRigToGeometry(endEffectorRotationVar, tipPose.rot()); diff --git a/libraries/animation/src/Rig.cpp b/libraries/animation/src/Rig.cpp index e1db2fef8f..a34af09b27 100644 --- a/libraries/animation/src/Rig.cpp +++ b/libraries/animation/src/Rig.cpp @@ -1541,7 +1541,7 @@ void Rig::updateHands2(bool leftHandEnabled, bool rightHandEnabled, bool headEna int handJointIndex = _animSkeleton->nameToJointIndex("LeftHand"); int elbowJointIndex = _animSkeleton->nameToJointIndex("LeftForeArm"); int shoulderJointIndex = _animSkeleton->nameToJointIndex("LeftArm"); - int oppositeArmJointIndex = _animSkeleton->nameToJointIndex("LeftArm"); + int oppositeArmJointIndex = _animSkeleton->nameToJointIndex("RightArm"); glm::vec3 poleVector; bool usePoleVector = calculateElbowPoleVector(handJointIndex, elbowJointIndex, shoulderJointIndex, oppositeArmJointIndex, poleVector); glm::vec3 sensorPoleVector = transformVectorFast(rigToSensorMatrix, poleVector); @@ -1580,7 +1580,7 @@ void Rig::updateHands2(bool leftHandEnabled, bool rightHandEnabled, bool headEna int handJointIndex = _animSkeleton->nameToJointIndex("RightHand"); int elbowJointIndex = _animSkeleton->nameToJointIndex("RightForeArm"); int shoulderJointIndex = _animSkeleton->nameToJointIndex("RightArm"); - int oppositeArmJointIndex = _animSkeleton->nameToJointIndex("RightArm"); + int oppositeArmJointIndex = _animSkeleton->nameToJointIndex("LeftArm"); glm::vec3 poleVector; bool usePoleVector = calculateElbowPoleVector(handJointIndex, elbowJointIndex, shoulderJointIndex, oppositeArmJointIndex, poleVector); glm::vec3 sensorPoleVector = transformVectorFast(rigToSensorMatrix, poleVector); @@ -1856,10 +1856,10 @@ void Rig::updateFromControllerParameters(const ControllerParameters& params, flo updateHead(_headEnabled, hipsEnabled, params.primaryControllerPoses[PrimaryControllerType_Head]); - updateHands(leftHandEnabled, rightHandEnabled, hipsEnabled, hipsEstimated, leftArmEnabled, rightArmEnabled, _headEnabled, dt, - params.primaryControllerPoses[PrimaryControllerType_LeftHand], params.primaryControllerPoses[PrimaryControllerType_RightHand], - params.hipsShapeInfo, params.spineShapeInfo, params.spine1ShapeInfo, params.spine2ShapeInfo, - params.rigToSensorMatrix, sensorToRigMatrix); + //updateHands(leftHandEnabled, rightHandEnabled, hipsEnabled, hipsEstimated, leftArmEnabled, rightArmEnabled, _headEnabled, dt, + // params.primaryControllerPoses[PrimaryControllerType_LeftHand], params.primaryControllerPoses[PrimaryControllerType_RightHand], + // params.hipsShapeInfo, params.spineShapeInfo, params.spine1ShapeInfo, params.spine2ShapeInfo, + // params.rigToSensorMatrix, sensorToRigMatrix); updateHands2(leftHandEnabled, rightHandEnabled, _headEnabled, params.primaryControllerPoses[PrimaryControllerType_LeftHand], params.primaryControllerPoses[PrimaryControllerType_RightHand], @@ -1940,7 +1940,7 @@ void Rig::updateFromControllerParameters(const ControllerParameters& params, flo std::shared_ptr ikNode = getAnimInverseKinematicsNode(); for (int i = 0; i < (int)NumSecondaryControllerTypes; i++) { int index = indexOfJoint(secondaryControllerJointNames[i]); - if (index >= 0) { + if ((index >= 0) && (ikNode)) { if (params.secondaryControllerFlags[i] & (uint8_t)ControllerFlags::Enabled) { ikNode->setSecondaryTargetInRigFrame(index, params.secondaryControllerPoses[i]); } else { From dbd03e2eb411b297587fde8ea9d44ee5cc81aff3 Mon Sep 17 00:00:00 2001 From: amantley Date: Tue, 22 Jan 2019 11:53:18 -0800 Subject: [PATCH 017/436] got the spline arms and legs working without any inverse kinematic node in the json, using _withIKnode.json --- .../avatar/avatar-animation_withIKNode.json | 2240 +++++++++++++++++ .../animation/src/AnimInverseKinematics.cpp | 5 +- libraries/animation/src/AnimSplineIK.cpp | 15 + libraries/animation/src/AnimSplineIK.h | 2 + 4 files changed, 2260 insertions(+), 2 deletions(-) create mode 100644 interface/resources/avatar/avatar-animation_withIKNode.json diff --git a/interface/resources/avatar/avatar-animation_withIKNode.json b/interface/resources/avatar/avatar-animation_withIKNode.json new file mode 100644 index 0000000000..8a66ed21b3 --- /dev/null +++ b/interface/resources/avatar/avatar-animation_withIKNode.json @@ -0,0 +1,2240 @@ +{ + "version": "1.1", + "root": { + "id": "userAnimStateMachine", + "type": "stateMachine", + "data": { + "currentState": "userAnimNone", + "states": [ + { + "id": "userAnimNone", + "interpTarget": 6, + "interpDuration": 6, + "transitions": [ + { + "var": "userAnimA", + "state": "userAnimA" + }, + { + "var": "userAnimB", + "state": "userAnimB" + } + ] + }, + { + "id": "userAnimA", + "interpTarget": 6, + "interpDuration": 6, + "transitions": [ + { + "var": "userAnimNone", + "state": "userAnimNone" + }, + { + "var": "userAnimB", + "state": "userAnimB" + } + ] + }, + { + "id": "userAnimB", + "interpTarget": 6, + "interpDuration": 6, + "transitions": [ + { + "var": "userAnimNone", + "state": "userAnimNone" + }, + { + "var": "userAnimA", + "state": "userAnimA" + } + ] + } + ] + }, + "children": [ + { + "id": "userAnimNone", + "type": "poleVectorConstraint", + "data": { + "enabled": false, + "referenceVector": [ 0, 0, 1 ], + "baseJointName": "RightUpLeg", + "midJointName": "RightLeg", + "tipJointName": "RightFoot", + "enabledVar": "rightFootPoleVectorEnabled", + "poleVectorVar": "rightFootPoleVector" + }, + "children": [ + { + "id": "rightFootIK", + "type": "twoBoneIK", + "data": { + "alpha": 1.0, + "enabled": false, + "interpDuration": 15, + "baseJointName": "RightUpLeg", + "midJointName": "RightLeg", + "tipJointName": "RightFoot", + "midHingeAxis": [ -1, 0, 0 ], + "alphaVar": "rightFootIKAlpha", + "enabledVar": "rightFootIKEnabled", + "endEffectorRotationVarVar": "rightFootIKRotationVar", + "endEffectorPositionVarVar": "rightFootIKPositionVar" + }, + "children": [ + { + "id": "leftFootPoleVector", + "type": "poleVectorConstraint", + "data": { + "enabled": false, + "referenceVector": [ 0, 0, 1 ], + "baseJointName": "LeftUpLeg", + "midJointName": "LeftLeg", + "tipJointName": "LeftFoot", + "enabledVar": "leftFootPoleVectorEnabled", + "poleVectorVar": "leftFootPoleVector" + }, + "children": [ + { + "id": "leftFootIK", + "type": "twoBoneIK", + "data": { + "alpha": 1.0, + "enabled": false, + "interpDuration": 15, + "baseJointName": "LeftUpLeg", + "midJointName": "LeftLeg", + "tipJointName": "LeftFoot", + "midHingeAxis": [ -1, 0, 0 ], + "alphaVar": "leftFootIKAlpha", + "enabledVar": "leftFootIKEnabled", + "endEffectorRotationVarVar": "leftFootIKRotationVar", + "endEffectorPositionVarVar": "leftFootIKPositionVar" + }, + "children": [ + { + "id": "rightHandPoleVector", + "type": "poleVectorConstraint", + "data": { + "enabled": false, + "referenceVector": [ 0, 0, 1 ], + "baseJointName": "RightArm", + "midJointName": "RightForeArm", + "tipJointName": "RightHand", + "enabledVar": "rightHandPoleVectorEnabled", + "poleVectorVar": "rightHandPoleVector" + }, + "children": [ + { + "id": "rightHandIK", + "type": "twoBoneIK", + "data": { + "alpha": 1.0, + "enabled": false, + "interpDuration": 15, + "baseJointName": "RightArm", + "midJointName": "RightForeArm", + "tipJointName": "RightHand", + "midHingeAxis": [ 0, 0, -1 ], + "alphaVar": "rightHandIKAlpha", + "enabledVar": "rightHandIKEnabled", + "endEffectorRotationVarVar": "rightHandIKRotationVar", + "endEffectorPositionVarVar": "rightHandIKPositionVar" + }, + "children": [ + { + "id": "leftHandPoleVector", + "type": "poleVectorConstraint", + "data": { + "enabled": false, + "referenceVector": [ 0, 0, 1 ], + "baseJointName": "LeftArm", + "midJointName": "LeftForeArm", + "tipJointName": "LeftHand", + "enabledVar": "leftHandPoleVectorEnabled", + "poleVectorVar": "leftHandPoleVector" + }, + "children": [ + { + "id": "leftHandIK", + "type": "twoBoneIK", + "data": { + "alpha": 1.0, + "enabled": false, + "interpDuration": 15, + "baseJointName": "LeftArm", + "midJointName": "LeftForeArm", + "tipJointName": "LeftHand", + "midHingeAxis": [ 0, 0, 1 ], + "alphaVar": "leftHandIKAlpha", + "enabledVar": "leftHandIKEnabled", + "endEffectorRotationVarVar": "leftHandIKRotationVar", + "endEffectorPositionVarVar": "leftHandIKPositionVar" + }, + "children": [ + { + "id": "userSplineIK", + "type": "splineIK", + "data": { + "alpha": 1.0, + "enabled": false, + "interpDuration": 15, + "baseJointName": "Hips", + "tipJointName": "Head", + "alphaVar": "splineIKAlpha", + "enabledVar": "splineIKEnabled", + "endEffectorRotationVarVar": "splineIKRotationVar", + "endEffectorPositionVarVar": "splineIKPositionVar" + }, + "children": [ + { + "id": "ikOverlay", + "type": "overlay", + "data": { + "alpha": 0.0, + "alphaVar": "ikOverlayAlpha", + "boneSet": "fullBody" + }, + "children": [ + { + "id": "defaultPose", + "type": "defaultPose", + "data": { + }, + "children": [] + }, + { + "id": "defaultPoseOverlay", + "type": "overlay", + "data": { + "alpha": 0.0, + "alphaVar": "defaultPoseOverlayAlpha", + "boneSet": "fullBody", + "boneSetVar": "defaultPoseOverlayBoneSet" + }, + "children": [ + { + "id": "defaultPose", + "type": "defaultPose", + "data": { + }, + "children": [] + }, + { + "id": "rightHandOverlay", + "type": "overlay", + "data": { + "alpha": 0.0, + "boneSet": "rightHand", + "alphaVar": "rightHandOverlayAlpha" + }, + "children": [ + { + "id": "rightHandStateMachine", + "type": "stateMachine", + "data": { + "currentState": "rightHandGrasp", + "states": [ + { + "id": "rightHandGrasp", + "interpTarget": 3, + "interpDuration": 3, + "transitions": [ + { + "var": "isRightIndexPoint", + "state": "rightIndexPoint" + }, + { + "var": "isRightThumbRaise", + "state": "rightThumbRaise" + }, + { + "var": "isRightIndexPointAndThumbRaise", + "state": "rightIndexPointAndThumbRaise" + } + ] + }, + { + "id": "rightIndexPoint", + "interpTarget": 15, + "interpDuration": 3, + "transitions": [ + { + "var": "isRightHandGrasp", + "state": "rightHandGrasp" + }, + { + "var": "isRightThumbRaise", + "state": "rightThumbRaise" + }, + { + "var": "isRightIndexPointAndThumbRaise", + "state": "rightIndexPointAndThumbRaise" + } + ] + }, + { + "id": "rightThumbRaise", + "interpTarget": 15, + "interpDuration": 3, + "transitions": [ + { + "var": "isRightHandGrasp", + "state": "rightHandGrasp" + }, + { + "var": "isRightIndexPoint", + "state": "rightIndexPoint" + }, + { + "var": "isRightIndexPointAndThumbRaise", + "state": "rightIndexPointAndThumbRaise" + } + ] + }, + { + "id": "rightIndexPointAndThumbRaise", + "interpTarget": 15, + "interpDuration": 3, + "transitions": [ + { + "var": "isRightHandGrasp", + "state": "rightHandGrasp" + }, + { + "var": "isRightIndexPoint", + "state": "rightIndexPoint" + }, + { + "var": "isRightThumbRaise", + "state": "rightThumbRaise" + } + ] + } + ] + }, + "children": [ + { + "id": "rightHandGrasp", + "type": "blendLinear", + "data": { + "alpha": 0.0, + "alphaVar": "rightHandGraspAlpha" + }, + "children": [ + { + "id": "rightHandGraspOpen", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/hydra_pose_open_right.fbx", + "startFrame": 0.0, + "endFrame": 0.0, + "timeScale": 1.0, + "loopFlag": true + }, + "children": [] + }, + { + "id": "rightHandGraspClosed", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/hydra_pose_closed_right.fbx", + "startFrame": 0.0, + "endFrame": 0.0, + "timeScale": 1.0, + "loopFlag": true + }, + "children": [] + } + ] + }, + { + "id": "rightIndexPoint", + "type": "blendLinear", + "data": { + "alpha": 0.0, + "alphaVar": "rightHandGraspAlpha" + }, + "children": [ + { + "id": "rightIndexPointOpen", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/touch_point_open_right.fbx", + "startFrame": 15.0, + "endFrame": 15.0, + "timeScale": 1.0, + "loopFlag": true + }, + "children": [] + }, + { + "id": "rightIndexPointClosed", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/touch_point_closed_right.fbx", + "startFrame": 15.0, + "endFrame": 15.0, + "timeScale": 1.0, + "loopFlag": true + }, + "children": [] + } + ] + }, + { + "id": "rightThumbRaise", + "type": "blendLinear", + "data": { + "alpha": 0.0, + "alphaVar": "rightHandGraspAlpha" + }, + "children": [ + { + "id": "rightThumbRaiseOpen", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/touch_thumb_open_right.fbx", + "startFrame": 15.0, + "endFrame": 15.0, + "timeScale": 1.0, + "loopFlag": true + }, + "children": [] + }, + { + "id": "rightThumbRaiseClosed", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/touch_thumb_closed_right.fbx", + "startFrame": 15.0, + "endFrame": 15.0, + "timeScale": 1.0, + "loopFlag": true + }, + "children": [] + } + ] + }, + { + "id": "rightIndexPointAndThumbRaise", + "type": "blendLinear", + "data": { + "alpha": 0.0, + "alphaVar": "rightHandGraspAlpha" + }, + "children": [ + { + "id": "rightIndexPointAndThumbRaiseOpen", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/touch_thumb_point_open_right.fbx", + "startFrame": 15.0, + "endFrame": 15.0, + "timeScale": 1.0, + "loopFlag": true + }, + "children": [] + }, + { + "id": "rightIndexPointAndThumbRaiseClosed", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/touch_thumb_point_closed_right.fbx", + "startFrame": 15.0, + "endFrame": 15.0, + "timeScale": 1.0, + "loopFlag": true + }, + "children": [] + } + ] + } + ] + }, + { + "id": "leftHandOverlay", + "type": "overlay", + "data": { + "alpha": 0.0, + "boneSet": "leftHand", + "alphaVar": "leftHandOverlayAlpha" + }, + "children": [ + { + "id": "leftHandStateMachine", + "type": "stateMachine", + "data": { + "currentState": "leftHandGrasp", + "states": [ + { + "id": "leftHandGrasp", + "interpTarget": 3, + "interpDuration": 3, + "transitions": [ + { + "var": "isLeftIndexPoint", + "state": "leftIndexPoint" + }, + { + "var": "isLeftThumbRaise", + "state": "leftThumbRaise" + }, + { + "var": "isLeftIndexPointAndThumbRaise", + "state": "leftIndexPointAndThumbRaise" + } + ] + }, + { + "id": "leftIndexPoint", + "interpTarget": 15, + "interpDuration": 3, + "transitions": [ + { + "var": "isLeftHandGrasp", + "state": "leftHandGrasp" + }, + { + "var": "isLeftThumbRaise", + "state": "leftThumbRaise" + }, + { + "var": "isLeftIndexPointAndThumbRaise", + "state": "leftIndexPointAndThumbRaise" + } + ] + }, + { + "id": "leftThumbRaise", + "interpTarget": 15, + "interpDuration": 3, + "transitions": [ + { + "var": "isLeftHandGrasp", + "state": "leftHandGrasp" + }, + { + "var": "isLeftIndexPoint", + "state": "leftIndexPoint" + }, + { + "var": "isLeftIndexPointAndThumbRaise", + "state": "leftIndexPointAndThumbRaise" + } + ] + }, + { + "id": "leftIndexPointAndThumbRaise", + "interpTarget": 15, + "interpDuration": 3, + "transitions": [ + { + "var": "isLeftHandGrasp", + "state": "leftHandGrasp" + }, + { + "var": "isLeftIndexPoint", + "state": "leftIndexPoint" + }, + { + "var": "isLeftThumbRaise", + "state": "leftThumbRaise" + } + ] + } + ] + }, + "children": [ + { + "id": "leftHandGrasp", + "type": "blendLinear", + "data": { + "alpha": 0.0, + "alphaVar": "leftHandGraspAlpha" + }, + "children": [ + { + "id": "leftHandGraspOpen", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/hydra_pose_open_left.fbx", + "startFrame": 0.0, + "endFrame": 0.0, + "timeScale": 1.0, + "loopFlag": true + }, + "children": [] + }, + { + "id": "leftHandGraspClosed", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/hydra_pose_closed_left.fbx", + "startFrame": 10.0, + "endFrame": 10.0, + "timeScale": 1.0, + "loopFlag": true + }, + "children": [] + } + ] + }, + { + "id": "leftIndexPoint", + "type": "blendLinear", + "data": { + "alpha": 0.0, + "alphaVar": "leftHandGraspAlpha" + }, + "children": [ + { + "id": "leftIndexPointOpen", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/touch_point_open_left.fbx", + "startFrame": 15.0, + "endFrame": 15.0, + "timeScale": 1.0, + "loopFlag": true + }, + "children": [] + }, + { + "id": "leftIndexPointClosed", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/touch_point_closed_left.fbx", + "startFrame": 15.0, + "endFrame": 15.0, + "timeScale": 1.0, + "loopFlag": true + }, + "children": [] + } + ] + }, + { + "id": "leftThumbRaise", + "type": "blendLinear", + "data": { + "alpha": 0.0, + "alphaVar": "leftHandGraspAlpha" + }, + "children": [ + { + "id": "leftThumbRaiseOpen", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/touch_thumb_open_left.fbx", + "startFrame": 15.0, + "endFrame": 15.0, + "timeScale": 1.0, + "loopFlag": true + }, + "children": [] + }, + { + "id": "leftThumbRaiseClosed", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/touch_thumb_closed_left.fbx", + "startFrame": 15.0, + "endFrame": 15.0, + "timeScale": 1.0, + "loopFlag": true + }, + "children": [] + } + ] + }, + { + "id": "leftIndexPointAndThumbRaise", + "type": "blendLinear", + "data": { + "alpha": 0.0, + "alphaVar": "leftHandGraspAlpha" + }, + "children": [ + { + "id": "leftIndexPointAndThumbRaiseOpen", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/touch_thumb_point_open_left.fbx", + "startFrame": 15.0, + "endFrame": 15.0, + "timeScale": 1.0, + "loopFlag": true + }, + "children": [] + }, + { + "id": "leftIndexPointAndThumbRaiseClosed", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/touch_thumb_point_closed_left.fbx", + "startFrame": 15.0, + "endFrame": 15.0, + "timeScale": 1.0, + "loopFlag": true + }, + "children": [] + } + ] + } + ] + }, + { + "id": "mainStateMachine", + "type": "stateMachine", + "data": { + "outputJoints": [ "LeftFoot", "RightFoot" ], + "currentState": "idle", + "states": [ + { + "id": "idle", + "interpTarget": 20, + "interpDuration": 8, + "interpType": "snapshotPrev", + "transitions": [ + { + "var": "isMovingForward", + "state": "WALKFWD" + }, + { + "var": "isMovingBackward", + "state": "WALKBWD" + }, + { + "var": "isMovingRight", + "state": "STRAFERIGHT" + }, + { + "var": "isMovingLeft", + "state": "STRAFELEFT" + }, + { + "var": "isTurningRight", + "state": "turnRight" + }, + { + "var": "isTurningLeft", + "state": "turnLeft" + }, + { + "var": "isFlying", + "state": "fly" + }, + { + "var": "isTakeoffStand", + "state": "takeoffStand" + }, + { + "var": "isTakeoffRun", + "state": "TAKEOFFRUN" + }, + { + "var": "isInAirStand", + "state": "inAirStand" + }, + { + "var": "isInAirRun", + "state": "INAIRRUN" + }, + { + "var": "isMovingRightHmd", + "state": "strafeRightHmd" + }, + { + "var": "isMovingLeftHmd", + "state": "strafeLeftHmd" + } + ] + }, + { + "id": "idleToWalkFwd", + "interpTarget": 12, + "interpDuration": 8, + "transitions": [ + { + "var": "idleToWalkFwdOnDone", + "state": "WALKFWD" + }, + { + "var": "isNotMoving", + "state": "idle" + }, + { + "var": "isMovingBackward", + "state": "WALKBWD" + }, + { + "var": "isMovingRight", + "state": "STRAFERIGHT" + }, + { + "var": "isMovingLeft", + "state": "STRAFELEFT" + }, + { + "var": "isTurningRight", + "state": "turnRight" + }, + { + "var": "isTurningLeft", + "state": "turnLeft" + }, + { + "var": "isFlying", + "state": "fly" + }, + { + "var": "isTakeoffStand", + "state": "takeoffStand" + }, + { + "var": "isTakeoffRun", + "state": "TAKEOFFRUN" + }, + { + "var": "isInAirStand", + "state": "inAirStand" + }, + { + "var": "isInAirRun", + "state": "INAIRRUN" + }, + { + "var": "isMovingRightHmd", + "state": "strafeRightHmd" + }, + { + "var": "isMovingLeftHmd", + "state": "strafeLeftHmd" + } + ] + }, + { + "id": "idleSettle", + "interpTarget": 15, + "interpDuration": 8, + "interpType": "snapshotPrev", + "transitions": [ + { + "var": "idleSettleOnDone", + "state": "idle" + }, + { + "var": "isMovingForward", + "state": "WALKFWD" + }, + { + "var": "isMovingBackward", + "state": "WALKBWD" + }, + { + "var": "isMovingRight", + "state": "STRAFERIGHT" + }, + { + "var": "isMovingLeft", + "state": "STRAFELEFT" + }, + { + "var": "isMovingRightHmd", + "state": "strafeRightHmd" + }, + { + "var": "isMovingLeftHmd", + "state": "strafeLeftHmd" + }, + { + "var": "isTurningRight", + "state": "turnRight" + }, + { + "var": "isTurningLeft", + "state": "turnLeft" + }, + { + "var": "isFlying", + "state": "fly" + }, + { + "var": "isTakeoffStand", + "state": "takeoffStand" + }, + { + "var": "isTakeoffRun", + "state": "TAKEOFFRUN" + }, + { + "var": "isInAirStand", + "state": "inAirStand" + }, + { + "var": "isInAirRun", + "state": "INAIRRUN" + } + ] + }, + { + "id": "WALKFWD", + "interpTarget": 35, + "interpDuration": 10, + "interpType": "snapshotPrev", + "transitions": [ + { + "var": "isNotMoving", + "state": "idleSettle" + }, + { + "var": "isMovingBackward", + "state": "WALKBWD" + }, + { + "var": "isMovingRight", + "state": "STRAFERIGHT" + }, + { + "var": "isMovingLeft", + "state": "STRAFELEFT" + }, + { + "var": "isTurningRight", + "state": "turnRight" + }, + { + "var": "isTurningLeft", + "state": "turnLeft" + }, + { + "var": "isFlying", + "state": "fly" + }, + { + "var": "isTakeoffStand", + "state": "takeoffStand" + }, + { + "var": "isTakeoffRun", + "state": "TAKEOFFRUN" + }, + { + "var": "isInAirStand", + "state": "inAirStand" + }, + { + "var": "isInAirRun", + "state": "INAIRRUN" + }, + { + "var": "isMovingRightHmd", + "state": "strafeRightHmd" + }, + { + "var": "isMovingLeftHmd", + "state": "strafeLeftHmd" + } + ] + }, + { + "id": "WALKBWD", + "interpTarget": 35, + "interpDuration": 10, + "interpType": "snapshotPrev", + "transitions": [ + { + "var": "isNotMoving", + "state": "idleSettle" + }, + { + "var": "isMovingForward", + "state": "WALKFWD" + }, + { + "var": "isMovingRight", + "state": "STRAFERIGHT" + }, + { + "var": "isMovingLeft", + "state": "STRAFELEFT" + }, + { + "var": "isTurningRight", + "state": "turnRight" + }, + { + "var": "isTurningLeft", + "state": "turnLeft" + }, + { + "var": "isFlying", + "state": "fly" + }, + { + "var": "isTakeoffStand", + "state": "takeoffStand" + }, + { + "var": "isTakeoffRun", + "state": "TAKEOFFRUN" + }, + { + "var": "isInAirStand", + "state": "inAirStand" + }, + { + "var": "isInAirRun", + "state": "INAIRRUN" + }, + { + "var": "isMovingRightHmd", + "state": "strafeRightHmd" + }, + { + "var": "isMovingLeftHmd", + "state": "strafeLeftHmd" + } + ] + }, + { + "id": "STRAFERIGHT", + "interpTarget": 25, + "interpDuration": 8, + "interpType": "snapshotPrev", + "transitions": [ + { + "var": "isNotMoving", + "state": "idleSettle" + }, + { + "var": "isMovingForward", + "state": "WALKFWD" + }, + { + "var": "isMovingBackward", + "state": "WALKBWD" + }, + { + "var": "isMovingLeft", + "state": "STRAFELEFT" + }, + { + "var": "isTurningRight", + "state": "turnRight" + }, + { + "var": "isTurningLeft", + "state": "turnLeft" + }, + { + "var": "isFlying", + "state": "fly" + }, + { + "var": "isTakeoffStand", + "state": "takeoffStand" + }, + { + "var": "isTakeoffRun", + "state": "TAKEOFFRUN" + }, + { + "var": "isInAirStand", + "state": "inAirStand" + }, + { + "var": "isInAirRun", + "state": "INAIRRUN" + }, + { + "var": "isMovingRightHmd", + "state": "strafeRightHmd" + }, + { + "var": "isMovingLeftHmd", + "state": "strafeLeftHmd" + } + ] + }, + { + "id": "STRAFELEFT", + "interpTarget": 25, + "interpDuration": 8, + "interpType": "snapshotPrev", + "transitions": [ + { + "var": "isNotMoving", + "state": "idleSettle" + }, + { + "var": "isMovingForward", + "state": "WALKFWD" + }, + { + "var": "isMovingBackward", + "state": "WALKBWD" + }, + { + "var": "isMovingRight", + "state": "STRAFERIGHT" + }, + { + "var": "isTurningRight", + "state": "turnRight" + }, + { + "var": "isTurningLeft", + "state": "turnLeft" + }, + { + "var": "isFlying", + "state": "fly" + }, + { + "var": "isTakeoffStand", + "state": "takeoffStand" + }, + { + "var": "isTakeoffRun", + "state": "TAKEOFFRUN" + }, + { + "var": "isInAirStand", + "state": "inAirStand" + }, + { + "var": "isInAirRun", + "state": "INAIRRUN" + }, + { + "var": "isMovingRightHmd", + "state": "strafeRightHmd" + }, + { + "var": "isMovingLeftHmd", + "state": "strafeLeftHmd" + } + ] + }, + { + "id": "turnRight", + "interpTarget": 6, + "interpDuration": 8, + "transitions": [ + { + "var": "isNotTurning", + "state": "idle" + }, + { + "var": "isMovingForward", + "state": "WALKFWD" + }, + { + "var": "isMovingBackward", + "state": "WALKBWD" + }, + { + "var": "isMovingRight", + "state": "STRAFERIGHT" + }, + { + "var": "isMovingLeft", + "state": "STRAFELEFT" + }, + { + "var": "isTurningLeft", + "state": "turnLeft" + }, + { + "var": "isFlying", + "state": "fly" + }, + { + "var": "isTakeoffStand", + "state": "takeoffStand" + }, + { + "var": "isTakeoffRun", + "state": "TAKEOFFRUN" + }, + { + "var": "isInAirStand", + "state": "inAirStand" + }, + { + "var": "isInAirRun", + "state": "INAIRRUN" + }, + { + "var": "isMovingRightHmd", + "state": "strafeRightHmd" + }, + { + "var": "isMovingLeftHmd", + "state": "strafeLeftHmd" + } + ] + }, + { + "id": "turnLeft", + "interpTarget": 6, + "interpDuration": 8, + "transitions": [ + { + "var": "isNotTurning", + "state": "idle" + }, + { + "var": "isMovingForward", + "state": "WALKFWD" + }, + { + "var": "isMovingBackward", + "state": "WALKBWD" + }, + { + "var": "isMovingRight", + "state": "STRAFERIGHT" + }, + { + "var": "isMovingLeft", + "state": "STRAFELEFT" + }, + { + "var": "isTurningRight", + "state": "turnRight" + }, + { + "var": "isFlying", + "state": "fly" + }, + { + "var": "isTakeoffStand", + "state": "takeoffStand" + }, + { + "var": "isTakeoffRun", + "state": "TAKEOFFRUN" + }, + { + "var": "isInAirStand", + "state": "inAirStand" + }, + { + "var": "isInAirRun", + "state": "INAIRRUN" + }, + { + "var": "isMovingRightHmd", + "state": "strafeRightHmd" + }, + { + "var": "isMovingLeftHmd", + "state": "strafeLeftHmd" + } + ] + }, + { + "id": "strafeRightHmd", + "interpTarget": 5, + "interpDuration": 8, + "interpType": "snapshotPrev", + "transitions": [ + { + "var": "isNotMoving", + "state": "idleSettle" + }, + { + "var": "isMovingForward", + "state": "WALKFWD" + }, + { + "var": "isMovingBackward", + "state": "WALKBWD" + }, + { + "var": "isMovingLeftHmd", + "state": "strafeLeftHmd" + }, + { + "var": "isMovingRight", + "state": "STRAFERIGHT" + }, + { + "var": "isMovingLeft", + "state": "STRAFELEFT" + }, + { + "var": "isTurningRight", + "state": "turnRight" + }, + { + "var": "isTurningLeft", + "state": "turnLeft" + }, + { + "var": "isFlying", + "state": "fly" + }, + { + "var": "isTakeoffStand", + "state": "takeoffStand" + }, + { + "var": "isTakeoffRun", + "state": "TAKEOFFRUN" + }, + { + "var": "isInAirStand", + "state": "inAirStand" + }, + { + "var": "isInAirRun", + "state": "INAIRRUN" + } + ] + }, + { + "id": "strafeLeftHmd", + "interpTarget": 5, + "interpDuration": 8, + "interpType": "snapshotPrev", + "transitions": [ + { + "var": "isNotMoving", + "state": "idleSettle" + }, + { + "var": "isMovingForward", + "state": "WALKFWD" + }, + { + "var": "isMovingBackward", + "state": "WALKBWD" + }, + { + "var": "isMovingRightHmd", + "state": "strafeRightHmd" + }, + { + "var": "isMovingRight", + "state": "STRAFERIGHT" + }, + { + "var": "isMovingLeft", + "state": "STRAFELEFT" + }, + { + "var": "isTurningRight", + "state": "turnRight" + }, + { + "var": "isTurningLeft", + "state": "turnLeft" + }, + { + "var": "isFlying", + "state": "fly" + }, + { + "var": "isTakeoffStand", + "state": "takeoffStand" + }, + { + "var": "isTakeoffRun", + "state": "TAKEOFFRUN" + }, + { + "var": "isInAirStand", + "state": "inAirStand" + }, + { + "var": "isInAirRun", + "state": "INAIRRUN" + } + ] + }, + { + "id": "fly", + "interpTarget": 6, + "interpDuration": 6, + "transitions": [ + { + "var": "isNotFlying", + "state": "idleSettle" + } + ] + }, + { + "id": "takeoffStand", + "interpTarget": 2, + "interpDuration": 2, + "transitions": [ + { + "var": "isNotTakeoff", + "state": "inAirStand" + } + ] + }, + { + "id": "TAKEOFFRUN", + "interpTarget": 2, + "interpDuration": 2, + "transitions": [ + { + "var": "isNotTakeoff", + "state": "INAIRRUN" + } + ] + }, + { + "id": "inAirStand", + "interpTarget": 3, + "interpDuration": 3, + "interpType": "snapshotPrev", + "transitions": [ + { + "var": "isNotInAir", + "state": "landStandImpact" + } + ] + }, + { + "id": "INAIRRUN", + "interpTarget": 3, + "interpDuration": 3, + "interpType": "snapshotPrev", + "transitions": [ + { + "var": "isNotInAir", + "state": "WALKFWD" + } + ] + }, + { + "id": "landStandImpact", + "interpTarget": 1, + "interpDuration": 1, + "transitions": [ + { + "var": "isFlying", + "state": "fly" + }, + { + "var": "isTakeoffStand", + "state": "takeoffStand" + }, + { + "var": "isTakeoffRun", + "state": "TAKEOFFRUN" + }, + { + "var": "landStandImpactOnDone", + "state": "landStand" + } + ] + }, + { + "id": "landStand", + "interpTarget": 1, + "interpDuration": 1, + "transitions": [ + { + "var": "isMovingForward", + "state": "WALKFWD" + }, + { + "var": "isMovingBackward", + "state": "WALKBWD" + }, + { + "var": "isMovingRight", + "state": "STRAFERIGHT" + }, + { + "var": "isMovingLeft", + "state": "STRAFELEFT" + }, + { + "var": "isTurningRight", + "state": "turnRight" + }, + { + "var": "isTurningLeft", + "state": "turnLeft" + }, + { + "var": "isFlying", + "state": "fly" + }, + { + "var": "isTakeoffStand", + "state": "takeoffStand" + }, + { + "var": "isTakeoffRun", + "state": "TAKEOFFRUN" + }, + { + "var": "isInAirStand", + "state": "inAirStand" + }, + { + "var": "isInAirRun", + "state": "INAIRRUN" + }, + { + "var": "landStandOnDone", + "state": "idle" + }, + { + "var": "isMovingRightHmd", + "state": "strafeRightHmd" + }, + { + "var": "isMovingLeftHmd", + "state": "strafeLeftHmd" + } + ] + }, + { + "id": "LANDRUN", + "interpTarget": 2, + "interpDuration": 2, + "transitions": [ + { + "var": "isFlying", + "state": "fly" + }, + { + "var": "isTakeoffStand", + "state": "takeoffStand" + }, + { + "var": "isTakeoffRun", + "state": "TAKEOFFRUN" + }, + { + "var": "landRunOnDone", + "state": "WALKFWD" + } + ] + } + ] + }, + "children": [ + { + "id": "idle", + "type": "stateMachine", + "data": { + "currentState": "idleStand", + "states": [ + { + "id": "idleStand", + "interpTarget": 6, + "interpDuration": 10, + "transitions": [ + { + "var": "isTalking", + "state": "idleTalk" + } + ] + }, + { + "id": "idleTalk", + "interpTarget": 6, + "interpDuration": 10, + "transitions": [ + { + "var": "notIsTalking", + "state": "idleStand" + } + ] + } + ] + }, + "children": [ + { + "id": "idleStand", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/idle.fbx", + "startFrame": 0.0, + "endFrame": 300.0, + "timeScale": 1.0, + "loopFlag": true + }, + "children": [] + }, + { + "id": "idleTalk", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/talk.fbx", + "startFrame": 0.0, + "endFrame": 800.0, + "timeScale": 1.0, + "loopFlag": true + }, + "children": [] + } + ] + }, + { + "id": "WALKFWD", + "type": "blendLinearMove", + "data": { + "alpha": 0.0, + "desiredSpeed": 1.4, + "characteristicSpeeds": [ 0.5, 1.8, 2.3, 3.2, 4.5 ], + "alphaVar": "moveForwardAlpha", + "desiredSpeedVar": "moveForwardSpeed" + }, + "children": [ + { + "id": "walkFwdShort_c", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/walk_short_fwd.fbx", + "startFrame": 0.0, + "endFrame": 39.0, + "timeScale": 1.0, + "loopFlag": true + }, + "children": [] + }, + { + "id": "walkFwdNormal_c", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/walk_fwd.fbx", + "startFrame": 0.0, + "endFrame": 30.0, + "timeScale": 1.0, + "loopFlag": true + }, + "children": [] + }, + { + "id": "walkFwdFast_c", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/walk_fwd_fast.fbx", + "startFrame": 0.0, + "endFrame": 25.0, + "timeScale": 1.0, + "loopFlag": true + }, + "children": [] + }, + { + "id": "walkFwdJog_c", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/jog_fwd.fbx", + "startFrame": 0.0, + "endFrame": 25.0, + "timeScale": 1.0, + "loopFlag": true + }, + "children": [] + }, + { + "id": "walkFwdRun_c", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/run_fwd.fbx", + "startFrame": 0.0, + "endFrame": 21.0, + "timeScale": 1.0, + "loopFlag": true + }, + "children": [] + } + ] + }, + { + "id": "idleToWalkFwd", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/idle_to_walk.fbx", + "startFrame": 1.0, + "endFrame": 13.0, + "timeScale": 1.0, + "loopFlag": false + }, + "children": [] + }, + { + "id": "idleSettle", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/settle_to_idle.fbx", + "startFrame": 1.0, + "endFrame": 59.0, + "timeScale": 1.0, + "loopFlag": false + }, + "children": [] + }, + { + "id": "WALKBWD", + "type": "blendLinearMove", + "data": { + "alpha": 0.0, + "desiredSpeed": 1.4, + "characteristicSpeeds": [ 0.6, 1.6, 2.3, 3.1 ], + "alphaVar": "moveBackwardAlpha", + "desiredSpeedVar": "moveBackwardSpeed" + }, + "children": [ + { + "id": "walkBwdShort_c", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/walk_short_bwd.fbx", + "startFrame": 0.0, + "endFrame": 38.0, + "timeScale": 1.0, + "loopFlag": true + }, + "children": [] + }, + { + "id": "walkBwdFast_c", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/walk_bwd_fast.fbx", + "startFrame": 0.0, + "endFrame": 27.0, + "timeScale": 1.0, + "loopFlag": true + }, + "children": [] + }, + { + "id": "jogBwd_c", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/jog_bwd.fbx", + "startFrame": 0.0, + "endFrame": 24.0, + "timeScale": 1.0, + "loopFlag": true + }, + "children": [] + }, + { + "id": "runBwd_c", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/run_bwd.fbx", + "startFrame": 0.0, + "endFrame": 16.0, + "timeScale": 1.0, + "loopFlag": true + }, + "children": [] + } + ] + }, + { + "id": "turnLeft", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/turn_left.fbx", + "startFrame": 0.0, + "endFrame": 32.0, + "timeScale": 1.0, + "loopFlag": true + }, + "children": [] + }, + { + "id": "turnRight", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/turn_left.fbx", + "startFrame": 0.0, + "endFrame": 32.0, + "timeScale": 1.0, + "loopFlag": true, + "mirrorFlag": true + }, + "children": [] + }, + { + "id": "STRAFELEFT", + "type": "blendLinearMove", + "data": { + "alpha": 0.0, + "desiredSpeed": 1.4, + "characteristicSpeeds": [ 0.1, 0.5, 1.0, 2.6, 3.0 ], + "alphaVar": "moveLateralAlpha", + "desiredSpeedVar": "moveLateralSpeed" + }, + "children": [ + { + "id": "strafeLeftShortStep_c", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/side_step_short_left.fbx", + "startFrame": 0.0, + "endFrame": 29.0, + "timeScale": 1.0, + "loopFlag": true + }, + "children": [] + }, + { + "id": "strafeLeftStep_c", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/side_step_left.fbx", + "startFrame": 0.0, + "endFrame": 20.0, + "timeScale": 1.0, + "loopFlag": true + }, + "children": [] + }, + { + "id": "strafeLeftWalk_c", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/walk_left.fbx", + "startFrame": 0.0, + "endFrame": 35.0, + "timeScale": 1.0, + "loopFlag": true + }, + "children": [] + }, + { + "id": "strafeLeftWalkFast_c", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/walk_left_fast.fbx", + "startFrame": 0.0, + "endFrame": 21.0, + "timeScale": 1.0, + "loopFlag": true + }, + "children": [] + }, + { + "id": "strafeLeftJog_c", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/jog_left.fbx", + "startFrame": 0.0, + "endFrame": 24.0, + "timeScale": 1.0, + "loopFlag": true + }, + "children": [] + } + ] + }, + { + "id": "STRAFERIGHT", + "type": "blendLinearMove", + "data": { + "alpha": 0.0, + "desiredSpeed": 1.4, + "characteristicSpeeds": [ 0.1, 0.5, 1.0, 2.6, 3.0 ], + "alphaVar": "moveLateralAlpha", + "desiredSpeedVar": "moveLateralSpeed" + }, + "children": [ + { + "id": "strafeRightShortStep_c", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/side_step_short_left.fbx", + "startFrame": 0.0, + "endFrame": 29.0, + "timeScale": 1.0, + "loopFlag": true, + "mirrorFlag": true + }, + "children": [] + }, + { + "id": "strafeRightStep_c", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/side_step_left.fbx", + "startFrame": 0.0, + "endFrame": 20.0, + "timeScale": 1.0, + "loopFlag": true, + "mirrorFlag": true + }, + "children": [] + }, + { + "id": "strafeRightWalk_c", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/walk_left.fbx", + "startFrame": 0.0, + "endFrame": 35.0, + "timeScale": 1.0, + "loopFlag": true, + "mirrorFlag": true + }, + "children": [] + }, + { + "id": "strafeRightFast_c", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/walk_left_fast.fbx", + "startFrame": 0.0, + "endFrame": 21.0, + "timeScale": 1.0, + "loopFlag": true, + "mirrorFlag": true + }, + "children": [] + }, + { + "id": "strafeRightJog_c", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/jog_left.fbx", + "startFrame": 0.0, + "endFrame": 24.0, + "timeScale": 1.0, + "loopFlag": true, + "mirrorFlag": true + }, + "children": [] + } + ] + }, + { + "id": "strafeLeftHmd", + "type": "blendLinearMove", + "data": { + "alpha": 0.0, + "desiredSpeed": 1.4, + "characteristicSpeeds": [ 0, 0.5, 2.5 ], + "alphaVar": "moveLateralAlpha", + "desiredSpeedVar": "moveLateralSpeed" + }, + "children": [ + { + "id": "stepLeftShort_c", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/side_step_short_left.fbx", + "startFrame": 0.0, + "endFrame": 29.0, + "timeScale": 1.0, + "loopFlag": true + }, + "children": [] + }, + { + "id": "stepLeft_c", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/side_step_left.fbx", + "startFrame": 0.0, + "endFrame": 20.0, + "timeScale": 1.0, + "loopFlag": true + }, + "children": [] + }, + { + "id": "strafeLeftAnim_c", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/side_step_left_fast.fbx", + "startFrame": 0.0, + "endFrame": 16.0, + "timeScale": 1.0, + "loopFlag": true + }, + "children": [] + } + ] + }, + { + "id": "strafeRightHmd", + "type": "blendLinearMove", + "data": { + "alpha": 0.0, + "desiredSpeed": 1.4, + "characteristicSpeeds": [ 0, 0.5, 2.5 ], + "alphaVar": "moveLateralAlpha", + "desiredSpeedVar": "moveLateralSpeed" + }, + "children": [ + { + "id": "stepRightShort_c", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/side_step_short_left.fbx", + "startFrame": 0.0, + "endFrame": 29.0, + "timeScale": 1.0, + "loopFlag": true, + "mirrorFlag": true + }, + "children": [] + }, + { + "id": "stepRight_c", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/side_step_left.fbx", + "startFrame": 0.0, + "endFrame": 20.0, + "timeScale": 1.0, + "loopFlag": true, + "mirrorFlag": true + }, + "children": [] + }, + { + "id": "strafeRightAnim_c", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/side_step_left_fast.fbx", + "startFrame": 0.0, + "endFrame": 16.0, + "timeScale": 1.0, + "loopFlag": true, + "mirrorFlag": true + }, + "children": [] + } + ] + }, + { + "id": "fly", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/fly.fbx", + "startFrame": 1.0, + "endFrame": 80.0, + "timeScale": 1.0, + "loopFlag": true + }, + "children": [] + }, + { + "id": "takeoffStand", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/jump_standing_launch.fbx", + "startFrame": 2.0, + "endFrame": 16.0, + "timeScale": 1.0, + "loopFlag": false + }, + "children": [] + }, + { + "id": "TAKEOFFRUN", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/jump_running_launch_land.fbx", + "startFrame": 4.0, + "endFrame": 15.0, + "timeScale": 1.0, + "loopFlag": false + }, + "children": [] + }, + { + "id": "inAirStand", + "type": "blendLinear", + "data": { + "alpha": 0.0, + "alphaVar": "inAirAlpha" + }, + "children": [ + { + "id": "inAirStandPreApex", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/jump_standing_apex.fbx", + "startFrame": 0.0, + "endFrame": 0.0, + "timeScale": 1.0, + "loopFlag": false + }, + "children": [] + }, + { + "id": "inAirStandApex", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/jump_standing_apex.fbx", + "startFrame": 1.0, + "endFrame": 1.0, + "timeScale": 1.0, + "loopFlag": false + }, + "children": [] + }, + { + "id": "inAirStandPostApex", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/jump_standing_apex.fbx", + "startFrame": 2.0, + "endFrame": 2.0, + "timeScale": 1.0, + "loopFlag": false + }, + "children": [] + } + ] + }, + { + "id": "INAIRRUN", + "type": "blendLinear", + "data": { + "alpha": 0.0, + "alphaVar": "inAirAlpha" + }, + "children": [ + { + "id": "inAirRunPreApex", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/jump_running_launch_land.fbx", + "startFrame": 16.0, + "endFrame": 16.0, + "timeScale": 1.0, + "loopFlag": false + }, + "children": [] + }, + { + "id": "inAirRunApex", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/jump_running_launch_land.fbx", + "startFrame": 22.0, + "endFrame": 22.0, + "timeScale": 1.0, + "loopFlag": false + }, + "children": [] + }, + { + "id": "inAirRunPostApex", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/jump_running_launch_land.fbx", + "startFrame": 33.0, + "endFrame": 33.0, + "timeScale": 1.0, + "loopFlag": false + }, + "children": [] + } + ] + }, + { + "id": "landStandImpact", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/jump_standing_land_settle.fbx", + "startFrame": 1.0, + "endFrame": 6.0, + "timeScale": 1.0, + "loopFlag": false + }, + "children": [] + }, + { + "id": "landStand", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/jump_standing_land_settle.fbx", + "startFrame": 6.0, + "endFrame": 68.0, + "timeScale": 1.0, + "loopFlag": false + }, + "children": [] + }, + { + "id": "LANDRUN", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/jump_running_launch_land.fbx", + "startFrame": 29.0, + "endFrame": 40.0, + "timeScale": 1.0, + "loopFlag": false + }, + "children": [] + } + ] + } + ] + } + ] + } + ] + } + ] + } + ] + } + ] + } + ] + } + ] + } + ] + } + ] + } + ] + } + ] + } + ] + }, + { + "id": "userAnimA", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/idle.fbx", + "startFrame": 0.0, + "endFrame": 90.0, + "timeScale": 1.0, + "loopFlag": true + }, + "children": [] + }, + { + "id": "userAnimB", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/idle.fbx", + "startFrame": 0.0, + "endFrame": 90.0, + "timeScale": 1.0, + "loopFlag": true + }, + "children": [] + } + ] + } +} diff --git a/libraries/animation/src/AnimInverseKinematics.cpp b/libraries/animation/src/AnimInverseKinematics.cpp index 8d2ba0fd78..7a29ff4001 100644 --- a/libraries/animation/src/AnimInverseKinematics.cpp +++ b/libraries/animation/src/AnimInverseKinematics.cpp @@ -886,7 +886,8 @@ const AnimPoseVec& AnimInverseKinematics::overlay(const AnimVariantMap& animVars if (dt > MAX_OVERLAY_DT) { dt = MAX_OVERLAY_DT; } - + loadPoses(underPoses); + /* if (_relativePoses.size() != underPoses.size()) { loadPoses(underPoses); } else { @@ -1054,7 +1055,7 @@ const AnimPoseVec& AnimInverseKinematics::overlay(const AnimVariantMap& animVars } processOutputJoints(triggersOut); - + */ return _relativePoses; } diff --git a/libraries/animation/src/AnimSplineIK.cpp b/libraries/animation/src/AnimSplineIK.cpp index 23bf8b2800..847d512a51 100644 --- a/libraries/animation/src/AnimSplineIK.cpp +++ b/libraries/animation/src/AnimSplineIK.cpp @@ -40,6 +40,12 @@ AnimSplineIK::~AnimSplineIK() { } +//virtual +const AnimPoseVec& AnimSplineIK::overlay(const AnimVariantMap& animVars, const AnimContext& context, float dt, AnimVariantMap& triggersOut, const AnimPoseVec& underPoses) { + loadPoses(underPoses); + return _poses; +} + const AnimPoseVec& AnimSplineIK::evaluate(const AnimVariantMap& animVars, const AnimContext& context, float dt, AnimVariantMap& triggersOut) { assert(_children.size() == 1); if (_children.size() != 1) { @@ -444,4 +450,13 @@ void AnimSplineIK::computeAndCacheSplineJointInfosForIKTarget(const AnimContext& } _splineJointInfoMap[target.getIndex()] = splineJointInfoVec; +} + +void AnimSplineIK ::loadPoses(const AnimPoseVec& poses) { + assert(_skeleton && ((poses.size() == 0) || (_skeleton->getNumJoints() == (int)poses.size()))); + if (_skeleton->getNumJoints() == (int)poses.size()) { + _poses = poses; + } else { + _poses.clear(); + } } \ No newline at end of file diff --git a/libraries/animation/src/AnimSplineIK.h b/libraries/animation/src/AnimSplineIK.h index d303f81053..12f43fa680 100644 --- a/libraries/animation/src/AnimSplineIK.h +++ b/libraries/animation/src/AnimSplineIK.h @@ -25,6 +25,7 @@ public: virtual ~AnimSplineIK() override; virtual const AnimPoseVec& evaluate(const AnimVariantMap& animVars, const AnimContext& context, float dt, AnimVariantMap& triggersOut) override; + virtual const AnimPoseVec& overlay(const AnimVariantMap& animVars, const AnimContext& context, float dt, AnimVariantMap& triggersOut, const AnimPoseVec& underPoses) override; protected: @@ -36,6 +37,7 @@ protected: }; void computeAbsolutePoses(AnimPoseVec& absolutePoses) const; + void loadPoses(const AnimPoseVec& poses); // for AnimDebugDraw rendering virtual const AnimPoseVec& getPosesInternal() const override; From cdd03646c2ab95b5de2af30720a3735ca5ba93c1 Mon Sep 17 00:00:00 2001 From: amantley Date: Wed, 23 Jan 2019 17:22:13 -0800 Subject: [PATCH 018/436] latest spline code with ik node removed started cleanup --- .../resources/avatar/avatar-animation.json | 3086 +++++++---------- .../avatar/avatar-animation_withIKNode.json | 4 +- .../animation/src/AnimInverseKinematics.cpp | 11 +- libraries/animation/src/AnimSplineIK.cpp | 158 +- libraries/animation/src/Rig.cpp | 19 +- 5 files changed, 1321 insertions(+), 1957 deletions(-) diff --git a/interface/resources/avatar/avatar-animation.json b/interface/resources/avatar/avatar-animation.json index f68d7e61d4..50fe5019f9 100644 --- a/interface/resources/avatar/avatar-animation.json +++ b/interface/resources/avatar/avatar-animation.json @@ -38,256 +38,419 @@ "children": [ { "id": "userAnimNone", - "type": "splineIK", + "type": "poleVectorConstraint", "data": { - "alpha": 1.0, "enabled": false, - "interpDuration": 15, - "baseJointName": "Hips", - "tipJointName": "Head", - "alphaVar": "splineIKAlpha", - "enabledVar": "splineIKEnabled", - "endEffectorRotationVarVar": "splineIKRotationVar", - "endEffectorPositionVarVar": "splineIKPositionVar" + "referenceVector": [0, 0, 1], + "baseJointName": "RightUpLeg", + "midJointName": "RightLeg", + "tipJointName": "RightFoot", + "enabledVar": "rightFootPoleVectorEnabled", + "poleVectorVar": "rightFootPoleVector" }, "children": [ { - "id": "rightFootPoleVector", - "type": "poleVectorConstraint", + "id": "rightFootIK", + "type": "twoBoneIK", "data": { + "alpha": 1.0, "enabled": false, - "referenceVector": [ 0, 0, 1 ], + "interpDuration": 15, "baseJointName": "RightUpLeg", "midJointName": "RightLeg", "tipJointName": "RightFoot", - "enabledVar": "rightFootPoleVectorEnabled", - "poleVectorVar": "rightFootPoleVector" + "midHingeAxis": [-1, 0, 0], + "alphaVar": "rightFootIKAlpha", + "enabledVar": "rightFootIKEnabled", + "endEffectorRotationVarVar": "rightFootIKRotationVar", + "endEffectorPositionVarVar": "rightFootIKPositionVar" }, "children": [ { - "id": "rightFootIK", - "type": "twoBoneIK", + "id": "leftFootPoleVector", + "type": "poleVectorConstraint", "data": { - "alpha": 1.0, "enabled": false, - "interpDuration": 15, - "baseJointName": "RightUpLeg", - "midJointName": "RightLeg", - "tipJointName": "RightFoot", - "midHingeAxis": [ -1, 0, 0 ], - "alphaVar": "rightFootIKAlpha", - "enabledVar": "rightFootIKEnabled", - "endEffectorRotationVarVar": "rightFootIKRotationVar", - "endEffectorPositionVarVar": "rightFootIKPositionVar" + "referenceVector": [0, 0, 1], + "baseJointName": "LeftUpLeg", + "midJointName": "LeftLeg", + "tipJointName": "LeftFoot", + "enabledVar": "leftFootPoleVectorEnabled", + "poleVectorVar": "leftFootPoleVector" }, "children": [ { - "id": "leftFootPoleVector", - "type": "poleVectorConstraint", + "id": "leftFootIK", + "type": "twoBoneIK", "data": { + "alpha": 1.0, "enabled": false, - "referenceVector": [ 0, 0, 1 ], + "interpDuration": 15, "baseJointName": "LeftUpLeg", "midJointName": "LeftLeg", "tipJointName": "LeftFoot", - "enabledVar": "leftFootPoleVectorEnabled", - "poleVectorVar": "leftFootPoleVector" + "midHingeAxis": [-1, 0, 0], + "alphaVar": "leftFootIKAlpha", + "enabledVar": "leftFootIKEnabled", + "endEffectorRotationVarVar": "leftFootIKRotationVar", + "endEffectorPositionVarVar": "leftFootIKPositionVar" }, "children": [ { - "id": "leftFootIK", - "type": "twoBoneIK", + "id": "ikOverlay", + "type": "overlay", "data": { "alpha": 1.0, - "enabled": false, - "interpDuration": 15, - "baseJointName": "LeftUpLeg", - "midJointName": "LeftLeg", - "tipJointName": "LeftFoot", - "midHingeAxis": [ -1, 0, 0 ], - "alphaVar": "leftFootIKAlpha", - "enabledVar": "leftFootIKEnabled", - "endEffectorRotationVarVar": "leftFootIKRotationVar", - "endEffectorPositionVarVar": "leftFootIKPositionVar" + "alphaVar": "ikOverlayAlpha", + "boneSet": "fullBody" }, "children": [ { - "id": "ikOverlay", + "id": "ik", + "type": "inverseKinematics", + "data": { + "solutionSource": "relaxToUnderPoses", + "solutionSourceVar": "solutionSource", + "targets": [ + { + "jointName": "Hips", + "positionVar": "hipsPosition", + "rotationVar": "hipsRotation", + "typeVar": "hipsType", + "weightVar": "hipsWeight", + "weight": 1.0, + "flexCoefficients": [1] + }, + { + "jointName": "RightHand", + "positionVar": "rightHandPosition", + "rotationVar": "rightHandRotation", + "typeVar": "rightHandType", + "weightVar": "rightHandWeight", + "weight": 1.0, + "flexCoefficients": [1, 0.5, 0.5, 0.2, 0.01, 0.005, 0.001, 0.0, 0.0], + "poleVectorEnabledVar": "rightHandPoleVectorEnabled", + "poleReferenceVectorVar": "rightHandPoleReferenceVector", + "poleVectorVar": "rightHandPoleVector" + }, + { + "jointName": "LeftHand", + "positionVar": "leftHandPosition", + "rotationVar": "leftHandRotation", + "typeVar": "leftHandType", + "weightVar": "leftHandWeight", + "weight": 1.0, + "flexCoefficients": [1, 0.5, 0.5, 0.2, 0.01, 0.005, 0.001, 0.0, 0.0], + "poleVectorEnabledVar": "leftHandPoleVectorEnabled", + "poleReferenceVectorVar": "leftHandPoleReferenceVector", + "poleVectorVar": "leftHandPoleVector" + }, + { + "jointName": "Spine2", + "positionVar": "spine2Position", + "rotationVar": "spine2Rotation", + "typeVar": "spine2Type", + "weightVar": "spine2Weight", + "weight": 2.0, + "flexCoefficients": [1.0, 0.5, 0.25] + }, + { + "jointName": "Head", + "positionVar": "headPosition", + "rotationVar": "headRotation", + "typeVar": "headType", + "weightVar": "headWeight", + "weight": 4.0, + "flexCoefficients": [1, 0.5, 0.25, 0.2, 0.1] + } + ] + }, + "children": [] + }, + { + "id": "defaultPoseOverlay", "type": "overlay", "data": { - "alpha": 1.0, - "alphaVar": "ikOverlayAlpha", - "boneSet": "fullBody" + "alpha": 0.0, + "alphaVar": "defaultPoseOverlayAlpha", + "boneSet": "fullBody", + "boneSetVar": "defaultPoseOverlayBoneSet" }, "children": [ { - "id": "ik", - "type": "inverseKinematics", + "id": "defaultPose", + "type": "defaultPose", "data": { - "solutionSource": "relaxToUnderPoses", - "solutionSourceVar": "solutionSource", - "targets": [ - { - "jointName": "Hips", - "positionVar": "hipsPosition", - "rotationVar": "hipsRotation", - "typeVar": "hipsType", - "weightVar": "hipsWeight", - "weight": 1.0, - "flexCoefficients": [ 1 ] - }, - { - "jointName": "RightHand", - "positionVar": "rightHandPosition", - "rotationVar": "rightHandRotation", - "typeVar": "rightHandType", - "weightVar": "rightHandWeight", - "weight": 1.0, - "flexCoefficients": [ 1, 0.5, 0.5, 0.2, 0.01, 0.005, 0.001, 0.0, 0.0 ], - "poleVectorEnabledVar": "rightHandPoleVectorEnabled", - "poleReferenceVectorVar": "rightHandPoleReferenceVector", - "poleVectorVar": "rightHandPoleVector" - }, - { - "jointName": "LeftHand", - "positionVar": "leftHandPosition", - "rotationVar": "leftHandRotation", - "typeVar": "leftHandType", - "weightVar": "leftHandWeight", - "weight": 1.0, - "flexCoefficients": [ 1, 0.5, 0.5, 0.2, 0.01, 0.005, 0.001, 0.0, 0.0 ], - "poleVectorEnabledVar": "leftHandPoleVectorEnabled", - "poleReferenceVectorVar": "leftHandPoleReferenceVector", - "poleVectorVar": "leftHandPoleVector" - } - ] }, "children": [] }, { - "id": "defaultPoseOverlay", + "id": "rightHandOverlay", "type": "overlay", "data": { "alpha": 0.0, - "alphaVar": "defaultPoseOverlayAlpha", - "boneSet": "fullBody", - "boneSetVar": "defaultPoseOverlayBoneSet" + "boneSet": "rightHand", + "alphaVar": "rightHandOverlayAlpha" }, "children": [ { - "id": "defaultPose", - "type": "defaultPose", + "id": "rightHandStateMachine", + "type": "stateMachine", "data": { - }, - "children": [] - }, - { - "id": "rightHandOverlay", - "type": "overlay", - "data": { - "alpha": 0.0, - "boneSet": "rightHand", - "alphaVar": "rightHandOverlayAlpha" + "currentState": "rightHandGrasp", + "states": [ + { + "id": "rightHandGrasp", + "interpTarget": 3, + "interpDuration": 3, + "transitions": [ + { "var": "isRightIndexPoint", "state": "rightIndexPoint" }, + { "var": "isRightThumbRaise", "state": "rightThumbRaise" }, + { "var": "isRightIndexPointAndThumbRaise", "state": "rightIndexPointAndThumbRaise" } + ] + }, + { + "id": "rightIndexPoint", + "interpTarget": 15, + "interpDuration": 3, + "transitions": [ + { "var": "isRightHandGrasp", "state": "rightHandGrasp" }, + { "var": "isRightThumbRaise", "state": "rightThumbRaise" }, + { "var": "isRightIndexPointAndThumbRaise", "state": "rightIndexPointAndThumbRaise" } + ] + }, + { + "id": "rightThumbRaise", + "interpTarget": 15, + "interpDuration": 3, + "transitions": [ + { "var": "isRightHandGrasp", "state": "rightHandGrasp" }, + { "var": "isRightIndexPoint", "state": "rightIndexPoint" }, + { "var": "isRightIndexPointAndThumbRaise", "state": "rightIndexPointAndThumbRaise" } + ] + }, + { + "id": "rightIndexPointAndThumbRaise", + "interpTarget": 15, + "interpDuration": 3, + "transitions": [ + { "var": "isRightHandGrasp", "state": "rightHandGrasp" }, + { "var": "isRightIndexPoint", "state": "rightIndexPoint" }, + { "var": "isRightThumbRaise", "state": "rightThumbRaise" } + ] + } + ] }, "children": [ { - "id": "rightHandStateMachine", + "id": "rightHandGrasp", + "type": "blendLinear", + "data": { + "alpha": 0.0, + "alphaVar": "rightHandGraspAlpha" + }, + "children": [ + { + "id": "rightHandGraspOpen", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/hydra_pose_open_right.fbx", + "startFrame": 0.0, + "endFrame": 0.0, + "timeScale": 1.0, + "loopFlag": true + }, + "children": [] + }, + { + "id": "rightHandGraspClosed", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/hydra_pose_closed_right.fbx", + "startFrame": 0.0, + "endFrame": 0.0, + "timeScale": 1.0, + "loopFlag": true + }, + "children": [] + } + ] + }, + { + "id": "rightIndexPoint", + "type": "blendLinear", + "data": { + "alpha": 0.0, + "alphaVar": "rightHandGraspAlpha" + }, + "children": [ + { + "id": "rightIndexPointOpen", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/touch_point_open_right.fbx", + "startFrame": 15.0, + "endFrame": 15.0, + "timeScale": 1.0, + "loopFlag": true + }, + "children": [] + }, + { + "id": "rightIndexPointClosed", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/touch_point_closed_right.fbx", + "startFrame": 15.0, + "endFrame": 15.0, + "timeScale": 1.0, + "loopFlag": true + }, + "children": [] + } + ] + }, + { + "id": "rightThumbRaise", + "type": "blendLinear", + "data": { + "alpha": 0.0, + "alphaVar": "rightHandGraspAlpha" + }, + "children": [ + { + "id": "rightThumbRaiseOpen", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/touch_thumb_open_right.fbx", + "startFrame": 15.0, + "endFrame": 15.0, + "timeScale": 1.0, + "loopFlag": true + }, + "children": [] + }, + { + "id": "rightThumbRaiseClosed", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/touch_thumb_closed_right.fbx", + "startFrame": 15.0, + "endFrame": 15.0, + "timeScale": 1.0, + "loopFlag": true + }, + "children": [] + } + ] + }, + { + "id": "rightIndexPointAndThumbRaise", + "type": "blendLinear", + "data": { + "alpha": 0.0, + "alphaVar": "rightHandGraspAlpha" + }, + "children": [ + { + "id": "rightIndexPointAndThumbRaiseOpen", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/touch_thumb_point_open_right.fbx", + "startFrame": 15.0, + "endFrame": 15.0, + "timeScale": 1.0, + "loopFlag": true + }, + "children": [] + }, + { + "id": "rightIndexPointAndThumbRaiseClosed", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/touch_thumb_point_closed_right.fbx", + "startFrame": 15.0, + "endFrame": 15.0, + "timeScale": 1.0, + "loopFlag": true + }, + "children": [] + } + ] + } + ] + }, + { + "id": "leftHandOverlay", + "type": "overlay", + "data": { + "alpha": 0.0, + "boneSet": "leftHand", + "alphaVar": "leftHandOverlayAlpha" + }, + "children": [ + { + "id": "leftHandStateMachine", "type": "stateMachine", "data": { - "currentState": "rightHandGrasp", + "currentState": "leftHandGrasp", "states": [ { - "id": "rightHandGrasp", + "id": "leftHandGrasp", "interpTarget": 3, "interpDuration": 3, "transitions": [ - { - "var": "isRightIndexPoint", - "state": "rightIndexPoint" - }, - { - "var": "isRightThumbRaise", - "state": "rightThumbRaise" - }, - { - "var": "isRightIndexPointAndThumbRaise", - "state": "rightIndexPointAndThumbRaise" - } + { "var": "isLeftIndexPoint", "state": "leftIndexPoint" }, + { "var": "isLeftThumbRaise", "state": "leftThumbRaise" }, + { "var": "isLeftIndexPointAndThumbRaise", "state": "leftIndexPointAndThumbRaise" } ] }, { - "id": "rightIndexPoint", + "id": "leftIndexPoint", "interpTarget": 15, "interpDuration": 3, "transitions": [ - { - "var": "isRightHandGrasp", - "state": "rightHandGrasp" - }, - { - "var": "isRightThumbRaise", - "state": "rightThumbRaise" - }, - { - "var": "isRightIndexPointAndThumbRaise", - "state": "rightIndexPointAndThumbRaise" - } + { "var": "isLeftHandGrasp", "state": "leftHandGrasp" }, + { "var": "isLeftThumbRaise", "state": "leftThumbRaise" }, + { "var": "isLeftIndexPointAndThumbRaise", "state": "leftIndexPointAndThumbRaise" } ] }, { - "id": "rightThumbRaise", + "id": "leftThumbRaise", "interpTarget": 15, "interpDuration": 3, "transitions": [ - { - "var": "isRightHandGrasp", - "state": "rightHandGrasp" - }, - { - "var": "isRightIndexPoint", - "state": "rightIndexPoint" - }, - { - "var": "isRightIndexPointAndThumbRaise", - "state": "rightIndexPointAndThumbRaise" - } + { "var": "isLeftHandGrasp", "state": "leftHandGrasp" }, + { "var": "isLeftIndexPoint", "state": "leftIndexPoint" }, + { "var": "isLeftIndexPointAndThumbRaise", "state": "leftIndexPointAndThumbRaise" } ] }, { - "id": "rightIndexPointAndThumbRaise", + "id": "leftIndexPointAndThumbRaise", "interpTarget": 15, "interpDuration": 3, "transitions": [ - { - "var": "isRightHandGrasp", - "state": "rightHandGrasp" - }, - { - "var": "isRightIndexPoint", - "state": "rightIndexPoint" - }, - { - "var": "isRightThumbRaise", - "state": "rightThumbRaise" - } + { "var": "isLeftHandGrasp", "state": "leftHandGrasp" }, + { "var": "isLeftIndexPoint", "state": "leftIndexPoint" }, + { "var": "isLeftThumbRaise", "state": "leftThumbRaise" } ] } ] }, "children": [ { - "id": "rightHandGrasp", + "id": "leftHandGrasp", "type": "blendLinear", "data": { "alpha": 0.0, - "alphaVar": "rightHandGraspAlpha" + "alphaVar": "leftHandGraspAlpha" }, "children": [ { - "id": "rightHandGraspOpen", + "id": "leftHandGraspOpen", "type": "clip", "data": { - "url": "qrc:///avatar/animations/hydra_pose_open_right.fbx", + "url": "qrc:///avatar/animations/hydra_pose_open_left.fbx", "startFrame": 0.0, "endFrame": 0.0, "timeScale": 1.0, @@ -296,12 +459,12 @@ "children": [] }, { - "id": "rightHandGraspClosed", + "id": "leftHandGraspClosed", "type": "clip", "data": { - "url": "qrc:///avatar/animations/hydra_pose_closed_right.fbx", - "startFrame": 0.0, - "endFrame": 0.0, + "url": "qrc:///avatar/animations/hydra_pose_closed_left.fbx", + "startFrame": 10.0, + "endFrame": 10.0, "timeScale": 1.0, "loopFlag": true }, @@ -310,18 +473,18 @@ ] }, { - "id": "rightIndexPoint", + "id": "leftIndexPoint", "type": "blendLinear", - "data": { + "data": { "alpha": 0.0, - "alphaVar": "rightHandGraspAlpha" + "alphaVar": "leftHandGraspAlpha" }, "children": [ { - "id": "rightIndexPointOpen", + "id": "leftIndexPointOpen", "type": "clip", "data": { - "url": "qrc:///avatar/animations/touch_point_open_right.fbx", + "url": "qrc:///avatar/animations/touch_point_open_left.fbx", "startFrame": 15.0, "endFrame": 15.0, "timeScale": 1.0, @@ -330,10 +493,10 @@ "children": [] }, { - "id": "rightIndexPointClosed", + "id": "leftIndexPointClosed", "type": "clip", "data": { - "url": "qrc:///avatar/animations/touch_point_closed_right.fbx", + "url": "qrc:///avatar/animations/touch_point_closed_left.fbx", "startFrame": 15.0, "endFrame": 15.0, "timeScale": 1.0, @@ -344,18 +507,18 @@ ] }, { - "id": "rightThumbRaise", + "id": "leftThumbRaise", "type": "blendLinear", - "data": { + "data": { "alpha": 0.0, - "alphaVar": "rightHandGraspAlpha" + "alphaVar": "leftHandGraspAlpha" }, "children": [ { - "id": "rightThumbRaiseOpen", + "id": "leftThumbRaiseOpen", "type": "clip", "data": { - "url": "qrc:///avatar/animations/touch_thumb_open_right.fbx", + "url": "qrc:///avatar/animations/touch_thumb_open_left.fbx", "startFrame": 15.0, "endFrame": 15.0, "timeScale": 1.0, @@ -364,10 +527,10 @@ "children": [] }, { - "id": "rightThumbRaiseClosed", + "id": "leftThumbRaiseClosed", "type": "clip", "data": { - "url": "qrc:///avatar/animations/touch_thumb_closed_right.fbx", + "url": "qrc:///avatar/animations/touch_thumb_closed_left.fbx", "startFrame": 15.0, "endFrame": 15.0, "timeScale": 1.0, @@ -378,18 +541,18 @@ ] }, { - "id": "rightIndexPointAndThumbRaise", + "id": "leftIndexPointAndThumbRaise", "type": "blendLinear", - "data": { + "data": { "alpha": 0.0, - "alphaVar": "rightHandGraspAlpha" + "alphaVar": "leftHandGraspAlpha" }, "children": [ { - "id": "rightIndexPointAndThumbRaiseOpen", + "id": "leftIndexPointAndThumbRaiseOpen", "type": "clip", "data": { - "url": "qrc:///avatar/animations/touch_thumb_point_open_right.fbx", + "url": "qrc:///avatar/animations/touch_thumb_point_open_left.fbx", "startFrame": 15.0, "endFrame": 15.0, "timeScale": 1.0, @@ -398,10 +561,10 @@ "children": [] }, { - "id": "rightIndexPointAndThumbRaiseClosed", + "id": "leftIndexPointAndThumbRaiseClosed", "type": "clip", "data": { - "url": "qrc:///avatar/animations/touch_thumb_point_closed_right.fbx", + "url": "qrc:///avatar/animations/touch_thumb_point_closed_left.fbx", "startFrame": 15.0, "endFrame": 15.0, "timeScale": 1.0, @@ -414,1312 +577,654 @@ ] }, { - "id": "leftHandOverlay", - "type": "overlay", + "id": "mainStateMachine", + "type": "stateMachine", "data": { - "alpha": 0.0, - "boneSet": "leftHand", - "alphaVar": "leftHandOverlayAlpha" + "outputJoints": ["LeftFoot", "RightFoot"], + "currentState": "idle", + "states": [ + { + "id": "idle", + "interpTarget": 20, + "interpDuration": 8, + "interpType": "snapshotPrev", + "transitions": [ + { "var": "isMovingForward", "state": "WALKFWD" }, + { "var": "isMovingBackward", "state": "WALKBWD" }, + { "var": "isMovingRight", "state": "STRAFERIGHT" }, + { "var": "isMovingLeft", "state": "STRAFELEFT" }, + { "var": "isTurningRight", "state": "turnRight" }, + { "var": "isTurningLeft", "state": "turnLeft" }, + { "var": "isFlying", "state": "fly" }, + { "var": "isTakeoffStand", "state": "takeoffStand" }, + { "var": "isTakeoffRun", "state": "TAKEOFFRUN" }, + { "var": "isInAirStand", "state": "inAirStand" }, + { "var": "isInAirRun", "state": "INAIRRUN" }, + { "var": "isMovingRightHmd", "state": "strafeRightHmd" }, + { "var": "isMovingLeftHmd", "state": "strafeLeftHmd" } + ] + }, + { + "id": "idleToWalkFwd", + "interpTarget": 12, + "interpDuration": 8, + "transitions": [ + { "var": "idleToWalkFwdOnDone", "state": "WALKFWD" }, + { "var": "isNotMoving", "state": "idle" }, + { "var": "isMovingBackward", "state": "WALKBWD" }, + { "var": "isMovingRight", "state": "STRAFERIGHT" }, + { "var": "isMovingLeft", "state": "STRAFELEFT" }, + { "var": "isTurningRight", "state": "turnRight" }, + { "var": "isTurningLeft", "state": "turnLeft" }, + { "var": "isFlying", "state": "fly" }, + { "var": "isTakeoffStand", "state": "takeoffStand" }, + { "var": "isTakeoffRun", "state": "TAKEOFFRUN" }, + { "var": "isInAirStand", "state": "inAirStand" }, + { "var": "isInAirRun", "state": "INAIRRUN" }, + { "var": "isMovingRightHmd", "state": "strafeRightHmd" }, + { "var": "isMovingLeftHmd", "state": "strafeLeftHmd" } + ] + }, + { + "id": "idleSettle", + "interpTarget": 15, + "interpDuration": 8, + "interpType": "snapshotPrev", + "transitions": [ + {"var": "idleSettleOnDone", "state": "idle" }, + {"var": "isMovingForward", "state": "WALKFWD" }, + { "var": "isMovingBackward", "state": "WALKBWD" }, + { "var": "isMovingRight", "state": "STRAFERIGHT" }, + { "var": "isMovingLeft", "state": "STRAFELEFT" }, + { "var": "isMovingRightHmd", "state": "strafeRightHmd" }, + { "var": "isMovingLeftHmd", "state": "strafeLeftHmd" }, + { "var": "isTurningRight", "state": "turnRight" }, + { "var": "isTurningLeft", "state": "turnLeft" }, + { "var": "isFlying", "state": "fly" }, + { "var": "isTakeoffStand", "state": "takeoffStand" }, + { "var": "isTakeoffRun", "state": "TAKEOFFRUN" }, + { "var": "isInAirStand", "state": "inAirStand" }, + { "var": "isInAirRun", "state": "INAIRRUN" } + ] + }, + { + "id": "WALKFWD", + "interpTarget": 35, + "interpDuration": 10, + "interpType": "snapshotPrev", + "transitions": [ + { "var": "isNotMoving", "state": "idleSettle" }, + { "var": "isMovingBackward", "state": "WALKBWD" }, + { "var": "isMovingRight", "state": "STRAFERIGHT" }, + { "var": "isMovingLeft", "state": "STRAFELEFT" }, + { "var": "isTurningRight", "state": "turnRight" }, + { "var": "isTurningLeft", "state": "turnLeft" }, + { "var": "isFlying", "state": "fly" }, + { "var": "isTakeoffStand", "state": "takeoffStand" }, + { "var": "isTakeoffRun", "state": "TAKEOFFRUN" }, + { "var": "isInAirStand", "state": "inAirStand" }, + { "var": "isInAirRun", "state": "INAIRRUN" }, + { "var": "isMovingRightHmd", "state": "strafeRightHmd" }, + { "var": "isMovingLeftHmd", "state": "strafeLeftHmd" } + ] + }, + { + "id": "WALKBWD", + "interpTarget": 35, + "interpDuration": 10, + "interpType": "snapshotPrev", + "transitions": [ + { "var": "isNotMoving", "state": "idleSettle" }, + { "var": "isMovingForward", "state": "WALKFWD" }, + { "var": "isMovingRight", "state": "STRAFERIGHT" }, + { "var": "isMovingLeft", "state": "STRAFELEFT" }, + { "var": "isTurningRight", "state": "turnRight" }, + { "var": "isTurningLeft", "state": "turnLeft" }, + { "var": "isFlying", "state": "fly" }, + { "var": "isTakeoffStand", "state": "takeoffStand" }, + { "var": "isTakeoffRun", "state": "TAKEOFFRUN" }, + { "var": "isInAirStand", "state": "inAirStand" }, + { "var": "isInAirRun", "state": "INAIRRUN" }, + { "var": "isMovingRightHmd", "state": "strafeRightHmd" }, + { "var": "isMovingLeftHmd", "state": "strafeLeftHmd" } + ] + }, + { + "id": "STRAFERIGHT", + "interpTarget": 25, + "interpDuration": 8, + "interpType": "snapshotPrev", + "transitions": [ + { "var": "isNotMoving", "state": "idleSettle" }, + { "var": "isMovingForward", "state": "WALKFWD" }, + { "var": "isMovingBackward", "state": "WALKBWD" }, + { "var": "isMovingLeft", "state": "STRAFELEFT" }, + { "var": "isTurningRight", "state": "turnRight" }, + { "var": "isTurningLeft", "state": "turnLeft" }, + { "var": "isFlying", "state": "fly" }, + { "var": "isTakeoffStand", "state": "takeoffStand" }, + { "var": "isTakeoffRun", "state": "TAKEOFFRUN" }, + { "var": "isInAirStand", "state": "inAirStand" }, + { "var": "isInAirRun", "state": "INAIRRUN" }, + { "var": "isMovingRightHmd", "state": "strafeRightHmd" }, + { "var": "isMovingLeftHmd", "state": "strafeLeftHmd" } + ] + }, + { + "id": "STRAFELEFT", + "interpTarget": 25, + "interpDuration": 8, + "interpType": "snapshotPrev", + "transitions": [ + { "var": "isNotMoving", "state": "idleSettle" }, + { "var": "isMovingForward", "state": "WALKFWD" }, + { "var": "isMovingBackward", "state": "WALKBWD" }, + { "var": "isMovingRight", "state": "STRAFERIGHT" }, + { "var": "isTurningRight", "state": "turnRight" }, + { "var": "isTurningLeft", "state": "turnLeft" }, + { "var": "isFlying", "state": "fly" }, + { "var": "isTakeoffStand", "state": "takeoffStand" }, + { "var": "isTakeoffRun", "state": "TAKEOFFRUN" }, + { "var": "isInAirStand", "state": "inAirStand" }, + { "var": "isInAirRun", "state": "INAIRRUN" }, + { "var": "isMovingRightHmd", "state": "strafeRightHmd" }, + { "var": "isMovingLeftHmd", "state": "strafeLeftHmd" } + ] + }, + { + "id": "turnRight", + "interpTarget": 6, + "interpDuration": 8, + "transitions": [ + { "var": "isNotTurning", "state": "idle" }, + { "var": "isMovingForward", "state": "WALKFWD" }, + { "var": "isMovingBackward", "state": "WALKBWD" }, + { "var": "isMovingRight", "state": "STRAFERIGHT" }, + { "var": "isMovingLeft", "state": "STRAFELEFT" }, + { "var": "isTurningLeft", "state": "turnLeft" }, + { "var": "isFlying", "state": "fly" }, + { "var": "isTakeoffStand", "state": "takeoffStand" }, + { "var": "isTakeoffRun", "state": "TAKEOFFRUN" }, + { "var": "isInAirStand", "state": "inAirStand" }, + { "var": "isInAirRun", "state": "INAIRRUN" }, + { "var": "isMovingRightHmd", "state": "strafeRightHmd" }, + { "var": "isMovingLeftHmd", "state": "strafeLeftHmd" } + ] + }, + { + "id": "turnLeft", + "interpTarget": 6, + "interpDuration": 8, + "transitions": [ + { "var": "isNotTurning", "state": "idle" }, + { "var": "isMovingForward", "state": "WALKFWD" }, + { "var": "isMovingBackward", "state": "WALKBWD" }, + { "var": "isMovingRight", "state": "STRAFERIGHT" }, + { "var": "isMovingLeft", "state": "STRAFELEFT" }, + { "var": "isTurningRight", "state": "turnRight" }, + { "var": "isFlying", "state": "fly" }, + { "var": "isTakeoffStand", "state": "takeoffStand" }, + { "var": "isTakeoffRun", "state": "TAKEOFFRUN" }, + { "var": "isInAirStand", "state": "inAirStand" }, + { "var": "isInAirRun", "state": "INAIRRUN" }, + { "var": "isMovingRightHmd", "state": "strafeRightHmd" }, + { "var": "isMovingLeftHmd", "state": "strafeLeftHmd" } + ] + }, + { + "id": "strafeRightHmd", + "interpTarget": 5, + "interpDuration": 8, + "interpType": "snapshotPrev", + "transitions": [ + { "var": "isNotMoving", "state": "idleSettle" }, + { "var": "isMovingForward", "state": "WALKFWD" }, + { "var": "isMovingBackward", "state": "WALKBWD" }, + { "var": "isMovingLeftHmd", "state": "strafeLeftHmd" }, + { "var": "isMovingRight", "state": "STRAFERIGHT" }, + { "var": "isMovingLeft", "state": "STRAFELEFT" }, + { "var": "isTurningRight", "state": "turnRight" }, + { "var": "isTurningLeft", "state": "turnLeft" }, + { "var": "isFlying", "state": "fly" }, + { "var": "isTakeoffStand", "state": "takeoffStand" }, + { "var": "isTakeoffRun", "state": "TAKEOFFRUN" }, + { "var": "isInAirStand", "state": "inAirStand" }, + { "var": "isInAirRun", "state": "INAIRRUN" } + ] + }, + { + "id": "strafeLeftHmd", + "interpTarget": 5, + "interpDuration": 8, + "interpType": "snapshotPrev", + "transitions": [ + { "var": "isNotMoving", "state": "idleSettle" }, + { "var": "isMovingForward", "state": "WALKFWD" }, + { "var": "isMovingBackward", "state": "WALKBWD" }, + { "var": "isMovingRightHmd", "state": "strafeRightHmd" }, + { "var": "isMovingRight", "state": "STRAFERIGHT" }, + { "var": "isMovingLeft", "state": "STRAFELEFT" }, + { "var": "isTurningRight", "state": "turnRight" }, + { "var": "isTurningLeft", "state": "turnLeft" }, + { "var": "isFlying", "state": "fly" }, + { "var": "isTakeoffStand", "state": "takeoffStand" }, + { "var": "isTakeoffRun", "state": "TAKEOFFRUN" }, + { "var": "isInAirStand", "state": "inAirStand" }, + { "var": "isInAirRun", "state": "INAIRRUN" } + ] + }, + { + "id": "fly", + "interpTarget": 6, + "interpDuration": 6, + "transitions": [ + { "var": "isNotFlying", "state": "idleSettle" } + ] + }, + { + "id": "takeoffStand", + "interpTarget": 2, + "interpDuration": 2, + "transitions": [ + { "var": "isNotTakeoff", "state": "inAirStand" } + ] + }, + { + "id": "TAKEOFFRUN", + "interpTarget": 2, + "interpDuration": 2, + "transitions": [ + { "var": "isNotTakeoff", "state": "INAIRRUN" } + ] + }, + { + "id": "inAirStand", + "interpTarget": 3, + "interpDuration": 3, + "interpType": "snapshotPrev", + "transitions": [ + { "var": "isNotInAir", "state": "landStandImpact" } + ] + }, + { + "id": "INAIRRUN", + "interpTarget": 3, + "interpDuration": 3, + "interpType": "snapshotPrev", + "transitions": [ + { "var": "isNotInAir", "state": "WALKFWD" } + ] + }, + { + "id": "landStandImpact", + "interpTarget": 1, + "interpDuration": 1, + "transitions": [ + { "var": "isFlying", "state": "fly" }, + { "var": "isTakeoffStand", "state": "takeoffStand" }, + { "var": "isTakeoffRun", "state": "TAKEOFFRUN" }, + { "var": "landStandImpactOnDone", "state": "landStand" } + ] + }, + { + "id": "landStand", + "interpTarget": 1, + "interpDuration": 1, + "transitions": [ + { "var": "isMovingForward", "state": "WALKFWD" }, + { "var": "isMovingBackward", "state": "WALKBWD" }, + { "var": "isMovingRight", "state": "STRAFERIGHT" }, + { "var": "isMovingLeft", "state": "STRAFELEFT" }, + { "var": "isTurningRight", "state": "turnRight" }, + { "var": "isTurningLeft", "state": "turnLeft" }, + { "var": "isFlying", "state": "fly" }, + { "var": "isTakeoffStand", "state": "takeoffStand" }, + { "var": "isTakeoffRun", "state": "TAKEOFFRUN" }, + { "var": "isInAirStand", "state": "inAirStand" }, + { "var": "isInAirRun", "state": "INAIRRUN" }, + { "var": "landStandOnDone", "state": "idle" }, + { "var": "isMovingRightHmd", "state": "strafeRightHmd" }, + { "var": "isMovingLeftHmd", "state": "strafeLeftHmd" } + ] + }, + { + "id": "LANDRUN", + "interpTarget": 2, + "interpDuration": 2, + "transitions": [ + { "var": "isFlying", "state": "fly" }, + { "var": "isTakeoffStand", "state": "takeoffStand" }, + { "var": "isTakeoffRun", "state": "TAKEOFFRUN" }, + { "var": "landRunOnDone", "state": "WALKFWD" } + ] + } + ] }, "children": [ { - "id": "leftHandStateMachine", + "id": "idle", "type": "stateMachine", "data": { - "currentState": "leftHandGrasp", + "currentState": "idleStand", "states": [ { - "id": "leftHandGrasp", - "interpTarget": 3, - "interpDuration": 3, + "id": "idleStand", + "interpTarget": 6, + "interpDuration": 10, "transitions": [ - { - "var": "isLeftIndexPoint", - "state": "leftIndexPoint" - }, - { - "var": "isLeftThumbRaise", - "state": "leftThumbRaise" - }, - { - "var": "isLeftIndexPointAndThumbRaise", - "state": "leftIndexPointAndThumbRaise" - } + { "var": "isTalking", "state": "idleTalk" } ] }, { - "id": "leftIndexPoint", - "interpTarget": 15, - "interpDuration": 3, + "id": "idleTalk", + "interpTarget": 6, + "interpDuration": 10, "transitions": [ - { - "var": "isLeftHandGrasp", - "state": "leftHandGrasp" - }, - { - "var": "isLeftThumbRaise", - "state": "leftThumbRaise" - }, - { - "var": "isLeftIndexPointAndThumbRaise", - "state": "leftIndexPointAndThumbRaise" - } - ] - }, - { - "id": "leftThumbRaise", - "interpTarget": 15, - "interpDuration": 3, - "transitions": [ - { - "var": "isLeftHandGrasp", - "state": "leftHandGrasp" - }, - { - "var": "isLeftIndexPoint", - "state": "leftIndexPoint" - }, - { - "var": "isLeftIndexPointAndThumbRaise", - "state": "leftIndexPointAndThumbRaise" - } - ] - }, - { - "id": "leftIndexPointAndThumbRaise", - "interpTarget": 15, - "interpDuration": 3, - "transitions": [ - { - "var": "isLeftHandGrasp", - "state": "leftHandGrasp" - }, - { - "var": "isLeftIndexPoint", - "state": "leftIndexPoint" - }, - { - "var": "isLeftThumbRaise", - "state": "leftThumbRaise" - } + { "var": "notIsTalking", "state": "idleStand" } ] } ] }, "children": [ { - "id": "leftHandGrasp", - "type": "blendLinear", - "data": { - "alpha": 0.0, - "alphaVar": "leftHandGraspAlpha" - }, - "children": [ - { - "id": "leftHandGraspOpen", - "type": "clip", - "data": { - "url": "qrc:///avatar/animations/hydra_pose_open_left.fbx", - "startFrame": 0.0, - "endFrame": 0.0, - "timeScale": 1.0, - "loopFlag": true - }, - "children": [] - }, - { - "id": "leftHandGraspClosed", - "type": "clip", - "data": { - "url": "qrc:///avatar/animations/hydra_pose_closed_left.fbx", - "startFrame": 10.0, - "endFrame": 10.0, - "timeScale": 1.0, - "loopFlag": true - }, - "children": [] - } - ] - }, - { - "id": "leftIndexPoint", - "type": "blendLinear", - "data": { - "alpha": 0.0, - "alphaVar": "leftHandGraspAlpha" - }, - "children": [ - { - "id": "leftIndexPointOpen", - "type": "clip", - "data": { - "url": "qrc:///avatar/animations/touch_point_open_left.fbx", - "startFrame": 15.0, - "endFrame": 15.0, - "timeScale": 1.0, - "loopFlag": true - }, - "children": [] - }, - { - "id": "leftIndexPointClosed", - "type": "clip", - "data": { - "url": "qrc:///avatar/animations/touch_point_closed_left.fbx", - "startFrame": 15.0, - "endFrame": 15.0, - "timeScale": 1.0, - "loopFlag": true - }, - "children": [] - } - ] - }, - { - "id": "leftThumbRaise", - "type": "blendLinear", - "data": { - "alpha": 0.0, - "alphaVar": "leftHandGraspAlpha" - }, - "children": [ - { - "id": "leftThumbRaiseOpen", - "type": "clip", - "data": { - "url": "qrc:///avatar/animations/touch_thumb_open_left.fbx", - "startFrame": 15.0, - "endFrame": 15.0, - "timeScale": 1.0, - "loopFlag": true - }, - "children": [] - }, - { - "id": "leftThumbRaiseClosed", - "type": "clip", - "data": { - "url": "qrc:///avatar/animations/touch_thumb_closed_left.fbx", - "startFrame": 15.0, - "endFrame": 15.0, - "timeScale": 1.0, - "loopFlag": true - }, - "children": [] - } - ] - }, - { - "id": "leftIndexPointAndThumbRaise", - "type": "blendLinear", - "data": { - "alpha": 0.0, - "alphaVar": "leftHandGraspAlpha" - }, - "children": [ - { - "id": "leftIndexPointAndThumbRaiseOpen", - "type": "clip", - "data": { - "url": "qrc:///avatar/animations/touch_thumb_point_open_left.fbx", - "startFrame": 15.0, - "endFrame": 15.0, - "timeScale": 1.0, - "loopFlag": true - }, - "children": [] - }, - { - "id": "leftIndexPointAndThumbRaiseClosed", - "type": "clip", - "data": { - "url": "qrc:///avatar/animations/touch_thumb_point_closed_left.fbx", - "startFrame": 15.0, - "endFrame": 15.0, - "timeScale": 1.0, - "loopFlag": true - }, - "children": [] - } - ] - } - ] - }, - { - "id": "mainStateMachine", - "type": "stateMachine", - "data": { - "outputJoints": [ "LeftFoot", "RightFoot" ], - "currentState": "idle", - "states": [ - { - "id": "idle", - "interpTarget": 20, - "interpDuration": 8, - "interpType": "snapshotPrev", - "transitions": [ - { - "var": "isMovingForward", - "state": "WALKFWD" - }, - { - "var": "isMovingBackward", - "state": "WALKBWD" - }, - { - "var": "isMovingRight", - "state": "STRAFERIGHT" - }, - { - "var": "isMovingLeft", - "state": "STRAFELEFT" - }, - { - "var": "isTurningRight", - "state": "turnRight" - }, - { - "var": "isTurningLeft", - "state": "turnLeft" - }, - { - "var": "isFlying", - "state": "fly" - }, - { - "var": "isTakeoffStand", - "state": "takeoffStand" - }, - { - "var": "isTakeoffRun", - "state": "TAKEOFFRUN" - }, - { - "var": "isInAirStand", - "state": "inAirStand" - }, - { - "var": "isInAirRun", - "state": "INAIRRUN" - }, - { - "var": "isMovingRightHmd", - "state": "strafeRightHmd" - }, - { - "var": "isMovingLeftHmd", - "state": "strafeLeftHmd" - } - ] - }, - { - "id": "idleToWalkFwd", - "interpTarget": 12, - "interpDuration": 8, - "transitions": [ - { - "var": "idleToWalkFwdOnDone", - "state": "WALKFWD" - }, - { - "var": "isNotMoving", - "state": "idle" - }, - { - "var": "isMovingBackward", - "state": "WALKBWD" - }, - { - "var": "isMovingRight", - "state": "STRAFERIGHT" - }, - { - "var": "isMovingLeft", - "state": "STRAFELEFT" - }, - { - "var": "isTurningRight", - "state": "turnRight" - }, - { - "var": "isTurningLeft", - "state": "turnLeft" - }, - { - "var": "isFlying", - "state": "fly" - }, - { - "var": "isTakeoffStand", - "state": "takeoffStand" - }, - { - "var": "isTakeoffRun", - "state": "TAKEOFFRUN" - }, - { - "var": "isInAirStand", - "state": "inAirStand" - }, - { - "var": "isInAirRun", - "state": "INAIRRUN" - }, - { - "var": "isMovingRightHmd", - "state": "strafeRightHmd" - }, - { - "var": "isMovingLeftHmd", - "state": "strafeLeftHmd" - } - ] - }, - { - "id": "idleSettle", - "interpTarget": 15, - "interpDuration": 8, - "interpType": "snapshotPrev", - "transitions": [ - { - "var": "idleSettleOnDone", - "state": "idle" - }, - { - "var": "isMovingForward", - "state": "WALKFWD" - }, - { - "var": "isMovingBackward", - "state": "WALKBWD" - }, - { - "var": "isMovingRight", - "state": "STRAFERIGHT" - }, - { - "var": "isMovingLeft", - "state": "STRAFELEFT" - }, - { - "var": "isMovingRightHmd", - "state": "strafeRightHmd" - }, - { - "var": "isMovingLeftHmd", - "state": "strafeLeftHmd" - }, - { - "var": "isTurningRight", - "state": "turnRight" - }, - { - "var": "isTurningLeft", - "state": "turnLeft" - }, - { - "var": "isFlying", - "state": "fly" - }, - { - "var": "isTakeoffStand", - "state": "takeoffStand" - }, - { - "var": "isTakeoffRun", - "state": "TAKEOFFRUN" - }, - { - "var": "isInAirStand", - "state": "inAirStand" - }, - { - "var": "isInAirRun", - "state": "INAIRRUN" - } - ] - }, - { - "id": "WALKFWD", - "interpTarget": 35, - "interpDuration": 10, - "interpType": "snapshotPrev", - "transitions": [ - { - "var": "isNotMoving", - "state": "idleSettle" - }, - { - "var": "isMovingBackward", - "state": "WALKBWD" - }, - { - "var": "isMovingRight", - "state": "STRAFERIGHT" - }, - { - "var": "isMovingLeft", - "state": "STRAFELEFT" - }, - { - "var": "isTurningRight", - "state": "turnRight" - }, - { - "var": "isTurningLeft", - "state": "turnLeft" - }, - { - "var": "isFlying", - "state": "fly" - }, - { - "var": "isTakeoffStand", - "state": "takeoffStand" - }, - { - "var": "isTakeoffRun", - "state": "TAKEOFFRUN" - }, - { - "var": "isInAirStand", - "state": "inAirStand" - }, - { - "var": "isInAirRun", - "state": "INAIRRUN" - }, - { - "var": "isMovingRightHmd", - "state": "strafeRightHmd" - }, - { - "var": "isMovingLeftHmd", - "state": "strafeLeftHmd" - } - ] - }, - { - "id": "WALKBWD", - "interpTarget": 35, - "interpDuration": 10, - "interpType": "snapshotPrev", - "transitions": [ - { - "var": "isNotMoving", - "state": "idleSettle" - }, - { - "var": "isMovingForward", - "state": "WALKFWD" - }, - { - "var": "isMovingRight", - "state": "STRAFERIGHT" - }, - { - "var": "isMovingLeft", - "state": "STRAFELEFT" - }, - { - "var": "isTurningRight", - "state": "turnRight" - }, - { - "var": "isTurningLeft", - "state": "turnLeft" - }, - { - "var": "isFlying", - "state": "fly" - }, - { - "var": "isTakeoffStand", - "state": "takeoffStand" - }, - { - "var": "isTakeoffRun", - "state": "TAKEOFFRUN" - }, - { - "var": "isInAirStand", - "state": "inAirStand" - }, - { - "var": "isInAirRun", - "state": "INAIRRUN" - }, - { - "var": "isMovingRightHmd", - "state": "strafeRightHmd" - }, - { - "var": "isMovingLeftHmd", - "state": "strafeLeftHmd" - } - ] - }, - { - "id": "STRAFERIGHT", - "interpTarget": 25, - "interpDuration": 8, - "interpType": "snapshotPrev", - "transitions": [ - { - "var": "isNotMoving", - "state": "idleSettle" - }, - { - "var": "isMovingForward", - "state": "WALKFWD" - }, - { - "var": "isMovingBackward", - "state": "WALKBWD" - }, - { - "var": "isMovingLeft", - "state": "STRAFELEFT" - }, - { - "var": "isTurningRight", - "state": "turnRight" - }, - { - "var": "isTurningLeft", - "state": "turnLeft" - }, - { - "var": "isFlying", - "state": "fly" - }, - { - "var": "isTakeoffStand", - "state": "takeoffStand" - }, - { - "var": "isTakeoffRun", - "state": "TAKEOFFRUN" - }, - { - "var": "isInAirStand", - "state": "inAirStand" - }, - { - "var": "isInAirRun", - "state": "INAIRRUN" - }, - { - "var": "isMovingRightHmd", - "state": "strafeRightHmd" - }, - { - "var": "isMovingLeftHmd", - "state": "strafeLeftHmd" - } - ] - }, - { - "id": "STRAFELEFT", - "interpTarget": 25, - "interpDuration": 8, - "interpType": "snapshotPrev", - "transitions": [ - { - "var": "isNotMoving", - "state": "idleSettle" - }, - { - "var": "isMovingForward", - "state": "WALKFWD" - }, - { - "var": "isMovingBackward", - "state": "WALKBWD" - }, - { - "var": "isMovingRight", - "state": "STRAFERIGHT" - }, - { - "var": "isTurningRight", - "state": "turnRight" - }, - { - "var": "isTurningLeft", - "state": "turnLeft" - }, - { - "var": "isFlying", - "state": "fly" - }, - { - "var": "isTakeoffStand", - "state": "takeoffStand" - }, - { - "var": "isTakeoffRun", - "state": "TAKEOFFRUN" - }, - { - "var": "isInAirStand", - "state": "inAirStand" - }, - { - "var": "isInAirRun", - "state": "INAIRRUN" - }, - { - "var": "isMovingRightHmd", - "state": "strafeRightHmd" - }, - { - "var": "isMovingLeftHmd", - "state": "strafeLeftHmd" - } - ] - }, - { - "id": "turnRight", - "interpTarget": 6, - "interpDuration": 8, - "transitions": [ - { - "var": "isNotTurning", - "state": "idle" - }, - { - "var": "isMovingForward", - "state": "WALKFWD" - }, - { - "var": "isMovingBackward", - "state": "WALKBWD" - }, - { - "var": "isMovingRight", - "state": "STRAFERIGHT" - }, - { - "var": "isMovingLeft", - "state": "STRAFELEFT" - }, - { - "var": "isTurningLeft", - "state": "turnLeft" - }, - { - "var": "isFlying", - "state": "fly" - }, - { - "var": "isTakeoffStand", - "state": "takeoffStand" - }, - { - "var": "isTakeoffRun", - "state": "TAKEOFFRUN" - }, - { - "var": "isInAirStand", - "state": "inAirStand" - }, - { - "var": "isInAirRun", - "state": "INAIRRUN" - }, - { - "var": "isMovingRightHmd", - "state": "strafeRightHmd" - }, - { - "var": "isMovingLeftHmd", - "state": "strafeLeftHmd" - } - ] - }, - { - "id": "turnLeft", - "interpTarget": 6, - "interpDuration": 8, - "transitions": [ - { - "var": "isNotTurning", - "state": "idle" - }, - { - "var": "isMovingForward", - "state": "WALKFWD" - }, - { - "var": "isMovingBackward", - "state": "WALKBWD" - }, - { - "var": "isMovingRight", - "state": "STRAFERIGHT" - }, - { - "var": "isMovingLeft", - "state": "STRAFELEFT" - }, - { - "var": "isTurningRight", - "state": "turnRight" - }, - { - "var": "isFlying", - "state": "fly" - }, - { - "var": "isTakeoffStand", - "state": "takeoffStand" - }, - { - "var": "isTakeoffRun", - "state": "TAKEOFFRUN" - }, - { - "var": "isInAirStand", - "state": "inAirStand" - }, - { - "var": "isInAirRun", - "state": "INAIRRUN" - }, - { - "var": "isMovingRightHmd", - "state": "strafeRightHmd" - }, - { - "var": "isMovingLeftHmd", - "state": "strafeLeftHmd" - } - ] - }, - { - "id": "strafeRightHmd", - "interpTarget": 5, - "interpDuration": 8, - "interpType": "snapshotPrev", - "transitions": [ - { - "var": "isNotMoving", - "state": "idleSettle" - }, - { - "var": "isMovingForward", - "state": "WALKFWD" - }, - { - "var": "isMovingBackward", - "state": "WALKBWD" - }, - { - "var": "isMovingLeftHmd", - "state": "strafeLeftHmd" - }, - { - "var": "isMovingRight", - "state": "STRAFERIGHT" - }, - { - "var": "isMovingLeft", - "state": "STRAFELEFT" - }, - { - "var": "isTurningRight", - "state": "turnRight" - }, - { - "var": "isTurningLeft", - "state": "turnLeft" - }, - { - "var": "isFlying", - "state": "fly" - }, - { - "var": "isTakeoffStand", - "state": "takeoffStand" - }, - { - "var": "isTakeoffRun", - "state": "TAKEOFFRUN" - }, - { - "var": "isInAirStand", - "state": "inAirStand" - }, - { - "var": "isInAirRun", - "state": "INAIRRUN" - } - ] - }, - { - "id": "strafeLeftHmd", - "interpTarget": 5, - "interpDuration": 8, - "interpType": "snapshotPrev", - "transitions": [ - { - "var": "isNotMoving", - "state": "idleSettle" - }, - { - "var": "isMovingForward", - "state": "WALKFWD" - }, - { - "var": "isMovingBackward", - "state": "WALKBWD" - }, - { - "var": "isMovingRightHmd", - "state": "strafeRightHmd" - }, - { - "var": "isMovingRight", - "state": "STRAFERIGHT" - }, - { - "var": "isMovingLeft", - "state": "STRAFELEFT" - }, - { - "var": "isTurningRight", - "state": "turnRight" - }, - { - "var": "isTurningLeft", - "state": "turnLeft" - }, - { - "var": "isFlying", - "state": "fly" - }, - { - "var": "isTakeoffStand", - "state": "takeoffStand" - }, - { - "var": "isTakeoffRun", - "state": "TAKEOFFRUN" - }, - { - "var": "isInAirStand", - "state": "inAirStand" - }, - { - "var": "isInAirRun", - "state": "INAIRRUN" - } - ] - }, - { - "id": "fly", - "interpTarget": 6, - "interpDuration": 6, - "transitions": [ - { - "var": "isNotFlying", - "state": "idleSettle" - } - ] - }, - { - "id": "takeoffStand", - "interpTarget": 2, - "interpDuration": 2, - "transitions": [ - { - "var": "isNotTakeoff", - "state": "inAirStand" - } - ] - }, - { - "id": "TAKEOFFRUN", - "interpTarget": 2, - "interpDuration": 2, - "transitions": [ - { - "var": "isNotTakeoff", - "state": "INAIRRUN" - } - ] - }, - { - "id": "inAirStand", - "interpTarget": 3, - "interpDuration": 3, - "interpType": "snapshotPrev", - "transitions": [ - { - "var": "isNotInAir", - "state": "landStandImpact" - } - ] - }, - { - "id": "INAIRRUN", - "interpTarget": 3, - "interpDuration": 3, - "interpType": "snapshotPrev", - "transitions": [ - { - "var": "isNotInAir", - "state": "WALKFWD" - } - ] - }, - { - "id": "landStandImpact", - "interpTarget": 1, - "interpDuration": 1, - "transitions": [ - { - "var": "isFlying", - "state": "fly" - }, - { - "var": "isTakeoffStand", - "state": "takeoffStand" - }, - { - "var": "isTakeoffRun", - "state": "TAKEOFFRUN" - }, - { - "var": "landStandImpactOnDone", - "state": "landStand" - } - ] - }, - { - "id": "landStand", - "interpTarget": 1, - "interpDuration": 1, - "transitions": [ - { - "var": "isMovingForward", - "state": "WALKFWD" - }, - { - "var": "isMovingBackward", - "state": "WALKBWD" - }, - { - "var": "isMovingRight", - "state": "STRAFERIGHT" - }, - { - "var": "isMovingLeft", - "state": "STRAFELEFT" - }, - { - "var": "isTurningRight", - "state": "turnRight" - }, - { - "var": "isTurningLeft", - "state": "turnLeft" - }, - { - "var": "isFlying", - "state": "fly" - }, - { - "var": "isTakeoffStand", - "state": "takeoffStand" - }, - { - "var": "isTakeoffRun", - "state": "TAKEOFFRUN" - }, - { - "var": "isInAirStand", - "state": "inAirStand" - }, - { - "var": "isInAirRun", - "state": "INAIRRUN" - }, - { - "var": "landStandOnDone", - "state": "idle" - }, - { - "var": "isMovingRightHmd", - "state": "strafeRightHmd" - }, - { - "var": "isMovingLeftHmd", - "state": "strafeLeftHmd" - } - ] - }, - { - "id": "LANDRUN", - "interpTarget": 2, - "interpDuration": 2, - "transitions": [ - { - "var": "isFlying", - "state": "fly" - }, - { - "var": "isTakeoffStand", - "state": "takeoffStand" - }, - { - "var": "isTakeoffRun", - "state": "TAKEOFFRUN" - }, - { - "var": "landRunOnDone", - "state": "WALKFWD" - } - ] - } - ] - }, - "children": [ - { - "id": "idle", - "type": "stateMachine", - "data": { - "currentState": "idleStand", - "states": [ - { - "id": "idleStand", - "interpTarget": 6, - "interpDuration": 10, - "transitions": [ - { - "var": "isTalking", - "state": "idleTalk" - } - ] - }, - { - "id": "idleTalk", - "interpTarget": 6, - "interpDuration": 10, - "transitions": [ - { - "var": "notIsTalking", - "state": "idleStand" - } - ] - } - ] - }, - "children": [ - { - "id": "idleStand", - "type": "clip", - "data": { - "url": "qrc:///avatar/animations/idle.fbx", - "startFrame": 0.0, - "endFrame": 300.0, - "timeScale": 1.0, - "loopFlag": true - }, - "children": [] - }, - { - "id": "idleTalk", - "type": "clip", - "data": { - "url": "qrc:///avatar/animations/talk.fbx", - "startFrame": 0.0, - "endFrame": 800.0, - "timeScale": 1.0, - "loopFlag": true - }, - "children": [] - } - ] - }, - { - "id": "WALKFWD", - "type": "blendLinearMove", - "data": { - "alpha": 0.0, - "desiredSpeed": 1.4, - "characteristicSpeeds": [ 0.5, 1.8, 2.3, 3.2, 4.5 ], - "alphaVar": "moveForwardAlpha", - "desiredSpeedVar": "moveForwardSpeed" - }, - "children": [ - { - "id": "walkFwdShort_c", - "type": "clip", - "data": { - "url": "qrc:///avatar/animations/walk_short_fwd.fbx", - "startFrame": 0.0, - "endFrame": 39.0, - "timeScale": 1.0, - "loopFlag": true - }, - "children": [] - }, - { - "id": "walkFwdNormal_c", - "type": "clip", - "data": { - "url": "qrc:///avatar/animations/walk_fwd.fbx", - "startFrame": 0.0, - "endFrame": 30.0, - "timeScale": 1.0, - "loopFlag": true - }, - "children": [] - }, - { - "id": "walkFwdFast_c", - "type": "clip", - "data": { - "url": "qrc:///avatar/animations/walk_fwd_fast.fbx", - "startFrame": 0.0, - "endFrame": 25.0, - "timeScale": 1.0, - "loopFlag": true - }, - "children": [] - }, - { - "id": "walkFwdJog_c", - "type": "clip", - "data": { - "url": "qrc:///avatar/animations/jog_fwd.fbx", - "startFrame": 0.0, - "endFrame": 25.0, - "timeScale": 1.0, - "loopFlag": true - }, - "children": [] - }, - { - "id": "walkFwdRun_c", - "type": "clip", - "data": { - "url": "qrc:///avatar/animations/run_fwd.fbx", - "startFrame": 0.0, - "endFrame": 21.0, - "timeScale": 1.0, - "loopFlag": true - }, - "children": [] - } - ] - }, - { - "id": "idleToWalkFwd", + "id": "idleStand", "type": "clip", "data": { - "url": "qrc:///avatar/animations/idle_to_walk.fbx", - "startFrame": 1.0, - "endFrame": 13.0, - "timeScale": 1.0, - "loopFlag": false - }, - "children": [] - }, - { - "id": "idleSettle", - "type": "clip", - "data": { - "url": "qrc:///avatar/animations/settle_to_idle.fbx", - "startFrame": 1.0, - "endFrame": 59.0, - "timeScale": 1.0, - "loopFlag": false - }, - "children": [] - }, - { - "id": "WALKBWD", - "type": "blendLinearMove", - "data": { - "alpha": 0.0, - "desiredSpeed": 1.4, - "characteristicSpeeds": [ 0.6, 1.6, 2.3, 3.1 ], - "alphaVar": "moveBackwardAlpha", - "desiredSpeedVar": "moveBackwardSpeed" - }, - "children": [ - { - "id": "walkBwdShort_c", - "type": "clip", - "data": { - "url": "qrc:///avatar/animations/walk_short_bwd.fbx", - "startFrame": 0.0, - "endFrame": 38.0, - "timeScale": 1.0, - "loopFlag": true - }, - "children": [] - }, - { - "id": "walkBwdFast_c", - "type": "clip", - "data": { - "url": "qrc:///avatar/animations/walk_bwd_fast.fbx", - "startFrame": 0.0, - "endFrame": 27.0, - "timeScale": 1.0, - "loopFlag": true - }, - "children": [] - }, - { - "id": "jogBwd_c", - "type": "clip", - "data": { - "url": "qrc:///avatar/animations/jog_bwd.fbx", - "startFrame": 0.0, - "endFrame": 24.0, - "timeScale": 1.0, - "loopFlag": true - }, - "children": [] - }, - { - "id": "runBwd_c", - "type": "clip", - "data": { - "url": "qrc:///avatar/animations/run_bwd.fbx", - "startFrame": 0.0, - "endFrame": 16.0, - "timeScale": 1.0, - "loopFlag": true - }, - "children": [] - } - ] - }, - { - "id": "turnLeft", - "type": "clip", - "data": { - "url": "qrc:///avatar/animations/turn_left.fbx", + "url": "qrc:///avatar/animations/idle.fbx", "startFrame": 0.0, - "endFrame": 32.0, + "endFrame": 300.0, "timeScale": 1.0, "loopFlag": true }, "children": [] }, { - "id": "turnRight", + "id": "idleTalk", "type": "clip", "data": { - "url": "qrc:///avatar/animations/turn_left.fbx", + "url": "qrc:///avatar/animations/talk.fbx", "startFrame": 0.0, - "endFrame": 32.0, + "endFrame": 800.0, + "timeScale": 1.0, + "loopFlag": true + }, + "children": [] + } + ] + }, + { + "id": "WALKFWD", + "type": "blendLinearMove", + "data": { + "alpha": 0.0, + "desiredSpeed": 1.4, + "characteristicSpeeds": [0.5, 1.8, 2.3, 3.2, 4.5], + "alphaVar": "moveForwardAlpha", + "desiredSpeedVar": "moveForwardSpeed" + }, + "children": [ + { + "id": "walkFwdShort_c", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/walk_short_fwd.fbx", + "startFrame": 0.0, + "endFrame": 39.0, + "timeScale": 1.0, + "loopFlag": true + }, + "children": [] + }, + { + "id": "walkFwdNormal_c", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/walk_fwd.fbx", + "startFrame": 0.0, + "endFrame": 30.0, + "timeScale": 1.0, + "loopFlag": true + }, + "children": [] + }, + { + "id": "walkFwdFast_c", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/walk_fwd_fast.fbx", + "startFrame": 0.0, + "endFrame": 25.0, + "timeScale": 1.0, + "loopFlag": true + }, + "children": [] + }, + { + "id": "walkFwdJog_c", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/jog_fwd.fbx", + "startFrame": 0.0, + "endFrame": 25.0, + "timeScale": 1.0, + "loopFlag": true + }, + "children": [] + }, + { + "id": "walkFwdRun_c", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/run_fwd.fbx", + "startFrame": 0.0, + "endFrame": 21.0, + "timeScale": 1.0, + "loopFlag": true + }, + "children": [] + } + ] + }, + { + "id": "idleToWalkFwd", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/idle_to_walk.fbx", + "startFrame": 1.0, + "endFrame": 13.0, + "timeScale": 1.0, + "loopFlag": false + }, + "children": [] + }, + { + "id": "idleSettle", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/settle_to_idle.fbx", + "startFrame": 1.0, + "endFrame": 59.0, + "timeScale": 1.0, + "loopFlag": false + }, + "children": [] + }, + { + "id": "WALKBWD", + "type": "blendLinearMove", + "data": { + "alpha": 0.0, + "desiredSpeed": 1.4, + "characteristicSpeeds": [0.6, 1.6, 2.3, 3.1], + "alphaVar": "moveBackwardAlpha", + "desiredSpeedVar": "moveBackwardSpeed" + }, + "children": [ + { + "id": "walkBwdShort_c", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/walk_short_bwd.fbx", + "startFrame": 0.0, + "endFrame": 38.0, + "timeScale": 1.0, + "loopFlag": true + }, + "children": [] + }, + { + "id": "walkBwdFast_c", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/walk_bwd_fast.fbx", + "startFrame": 0.0, + "endFrame": 27.0, + "timeScale": 1.0, + "loopFlag": true + }, + "children": [] + }, + { + "id": "jogBwd_c", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/jog_bwd.fbx", + "startFrame": 0.0, + "endFrame": 24.0, + "timeScale": 1.0, + "loopFlag": true + }, + "children": [] + }, + { + "id": "runBwd_c", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/run_bwd.fbx", + "startFrame": 0.0, + "endFrame": 16.0, + "timeScale": 1.0, + "loopFlag": true + }, + "children": [] + } + ] + }, + { + "id": "turnLeft", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/turn_left.fbx", + "startFrame": 0.0, + "endFrame": 32.0, + "timeScale": 1.0, + "loopFlag": true + }, + "children": [] + }, + { + "id": "turnRight", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/turn_left.fbx", + "startFrame": 0.0, + "endFrame": 32.0, + "timeScale": 1.0, + "loopFlag": true, + "mirrorFlag": true + }, + "children": [] + }, + { + "id": "STRAFELEFT", + "type": "blendLinearMove", + "data": { + "alpha": 0.0, + "desiredSpeed": 1.4, + "characteristicSpeeds": [0.1, 0.5, 1.0, 2.6, 3.0], + "alphaVar": "moveLateralAlpha", + "desiredSpeedVar": "moveLateralSpeed" + }, + "children": [ + { + "id": "strafeLeftShortStep_c", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/side_step_short_left.fbx", + "startFrame": 0.0, + "endFrame": 29.0, + "timeScale": 1.0, + "loopFlag": true + }, + "children": [] + }, + { + "id": "strafeLeftStep_c", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/side_step_left.fbx", + "startFrame": 0.0, + "endFrame": 20.0, + "timeScale": 1.0, + "loopFlag": true + }, + "children": [] + }, + { + "id": "strafeLeftWalk_c", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/walk_left.fbx", + "startFrame": 0.0, + "endFrame": 35.0, + "timeScale": 1.0, + "loopFlag": true + }, + "children": [] + }, + { + "id": "strafeLeftWalkFast_c", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/walk_left_fast.fbx", + "startFrame": 0.0, + "endFrame": 21.0, + "timeScale": 1.0, + "loopFlag": true + }, + "children": [] + }, + { + "id": "strafeLeftJog_c", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/jog_left.fbx", + "startFrame": 0.0, + "endFrame": 24.0, + "timeScale": 1.0, + "loopFlag": true + }, + "children": [] + } + ] + }, + { + "id": "STRAFERIGHT", + "type": "blendLinearMove", + "data": { + "alpha": 0.0, + "desiredSpeed": 1.4, + "characteristicSpeeds": [0.1, 0.5, 1.0, 2.6, 3.0], + "alphaVar": "moveLateralAlpha", + "desiredSpeedVar": "moveLateralSpeed" + }, + "children": [ { + "id": "strafeRightShortStep_c", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/side_step_short_left.fbx", + "startFrame": 0.0, + "endFrame": 29.0, "timeScale": 1.0, "loopFlag": true, "mirrorFlag": true @@ -1727,275 +1232,256 @@ "children": [] }, { - "id": "STRAFELEFT", - "type": "blendLinearMove", - "data": { - "alpha": 0.0, - "desiredSpeed": 1.4, - "characteristicSpeeds": [ 0.1, 0.5, 1.0, 2.6, 3.0 ], - "alphaVar": "moveLateralAlpha", - "desiredSpeedVar": "moveLateralSpeed" - }, - "children": [ - { - "id": "strafeLeftShortStep_c", - "type": "clip", - "data": { - "url": "qrc:///avatar/animations/side_step_short_left.fbx", - "startFrame": 0.0, - "endFrame": 29.0, - "timeScale": 1.0, - "loopFlag": true - }, - "children": [] - }, - { - "id": "strafeLeftStep_c", - "type": "clip", - "data": { - "url": "qrc:///avatar/animations/side_step_left.fbx", - "startFrame": 0.0, - "endFrame": 20.0, - "timeScale": 1.0, - "loopFlag": true - }, - "children": [] - }, - { - "id": "strafeLeftWalk_c", - "type": "clip", - "data": { - "url": "qrc:///avatar/animations/walk_left.fbx", - "startFrame": 0.0, - "endFrame": 35.0, - "timeScale": 1.0, - "loopFlag": true - }, - "children": [] - }, - { - "id": "strafeLeftWalkFast_c", - "type": "clip", - "data": { - "url": "qrc:///avatar/animations/walk_left_fast.fbx", - "startFrame": 0.0, - "endFrame": 21.0, - "timeScale": 1.0, - "loopFlag": true - }, - "children": [] - }, - { - "id": "strafeLeftJog_c", - "type": "clip", - "data": { - "url": "qrc:///avatar/animations/jog_left.fbx", - "startFrame": 0.0, - "endFrame": 24.0, - "timeScale": 1.0, - "loopFlag": true - }, - "children": [] - } - ] - }, - { - "id": "STRAFERIGHT", - "type": "blendLinearMove", - "data": { - "alpha": 0.0, - "desiredSpeed": 1.4, - "characteristicSpeeds": [ 0.1, 0.5, 1.0, 2.6, 3.0 ], - "alphaVar": "moveLateralAlpha", - "desiredSpeedVar": "moveLateralSpeed" - }, - "children": [ - { - "id": "strafeRightShortStep_c", - "type": "clip", - "data": { - "url": "qrc:///avatar/animations/side_step_short_left.fbx", - "startFrame": 0.0, - "endFrame": 29.0, - "timeScale": 1.0, - "loopFlag": true, - "mirrorFlag": true - }, - "children": [] - }, - { - "id": "strafeRightStep_c", - "type": "clip", - "data": { - "url": "qrc:///avatar/animations/side_step_left.fbx", - "startFrame": 0.0, - "endFrame": 20.0, - "timeScale": 1.0, - "loopFlag": true, - "mirrorFlag": true - }, - "children": [] - }, - { - "id": "strafeRightWalk_c", - "type": "clip", - "data": { - "url": "qrc:///avatar/animations/walk_left.fbx", - "startFrame": 0.0, - "endFrame": 35.0, - "timeScale": 1.0, - "loopFlag": true, - "mirrorFlag": true - }, - "children": [] - }, - { - "id": "strafeRightFast_c", - "type": "clip", - "data": { - "url": "qrc:///avatar/animations/walk_left_fast.fbx", - "startFrame": 0.0, - "endFrame": 21.0, - "timeScale": 1.0, - "loopFlag": true, - "mirrorFlag": true - }, - "children": [] - }, - { - "id": "strafeRightJog_c", - "type": "clip", - "data": { - "url": "qrc:///avatar/animations/jog_left.fbx", - "startFrame": 0.0, - "endFrame": 24.0, - "timeScale": 1.0, - "loopFlag": true, - "mirrorFlag": true - }, - "children": [] - } - ] - }, - { - "id": "strafeLeftHmd", - "type": "blendLinearMove", - "data": { - "alpha": 0.0, - "desiredSpeed": 1.4, - "characteristicSpeeds": [ 0, 0.5, 2.5 ], - "alphaVar": "moveLateralAlpha", - "desiredSpeedVar": "moveLateralSpeed" - }, - "children": [ - { - "id": "stepLeftShort_c", - "type": "clip", - "data": { - "url": "qrc:///avatar/animations/side_step_short_left.fbx", - "startFrame": 0.0, - "endFrame": 29.0, - "timeScale": 1.0, - "loopFlag": true - }, - "children": [] - }, - { - "id": "stepLeft_c", - "type": "clip", - "data": { - "url": "qrc:///avatar/animations/side_step_left.fbx", - "startFrame": 0.0, - "endFrame": 20.0, - "timeScale": 1.0, - "loopFlag": true - }, - "children": [] - }, - { - "id": "strafeLeftAnim_c", - "type": "clip", - "data": { - "url": "qrc:///avatar/animations/side_step_left_fast.fbx", - "startFrame": 0.0, - "endFrame": 16.0, - "timeScale": 1.0, - "loopFlag": true - }, - "children": [] - } - ] - }, - { - "id": "strafeRightHmd", - "type": "blendLinearMove", - "data": { - "alpha": 0.0, - "desiredSpeed": 1.4, - "characteristicSpeeds": [ 0, 0.5, 2.5 ], - "alphaVar": "moveLateralAlpha", - "desiredSpeedVar": "moveLateralSpeed" - }, - "children": [ - { - "id": "stepRightShort_c", - "type": "clip", - "data": { - "url": "qrc:///avatar/animations/side_step_short_left.fbx", - "startFrame": 0.0, - "endFrame": 29.0, - "timeScale": 1.0, - "loopFlag": true, - "mirrorFlag": true - }, - "children": [] - }, - { - "id": "stepRight_c", - "type": "clip", - "data": { - "url": "qrc:///avatar/animations/side_step_left.fbx", - "startFrame": 0.0, - "endFrame": 20.0, - "timeScale": 1.0, - "loopFlag": true, - "mirrorFlag": true - }, - "children": [] - }, - { - "id": "strafeRightAnim_c", - "type": "clip", - "data": { - "url": "qrc:///avatar/animations/side_step_left_fast.fbx", - "startFrame": 0.0, - "endFrame": 16.0, - "timeScale": 1.0, - "loopFlag": true, - "mirrorFlag": true - }, - "children": [] - } - ] - }, - { - "id": "fly", + "id": "strafeRightStep_c", "type": "clip", "data": { - "url": "qrc:///avatar/animations/fly.fbx", - "startFrame": 1.0, - "endFrame": 80.0, + "url": "qrc:///avatar/animations/side_step_left.fbx", + "startFrame": 0.0, + "endFrame": 20.0, + "timeScale": 1.0, + "loopFlag": true, + "mirrorFlag": true + }, + "children": [] + }, + { + "id": "strafeRightWalk_c", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/walk_left.fbx", + "startFrame": 0.0, + "endFrame": 35.0, + "timeScale": 1.0, + "loopFlag": true, + "mirrorFlag": true + }, + "children": [] + }, + { + "id": "strafeRightFast_c", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/walk_left_fast.fbx", + "startFrame": 0.0, + "endFrame": 21.0, + "timeScale": 1.0, + "loopFlag": true, + "mirrorFlag": true + }, + "children": [] + }, + { + "id": "strafeRightJog_c", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/jog_left.fbx", + "startFrame": 0.0, + "endFrame": 24.0, + "timeScale": 1.0, + "loopFlag": true, + "mirrorFlag": true + }, + "children": [] + } + ] + }, + { + "id": "strafeLeftHmd", + "type": "blendLinearMove", + "data": { + "alpha": 0.0, + "desiredSpeed": 1.4, + "characteristicSpeeds": [0, 0.5, 2.5], + "alphaVar": "moveLateralAlpha", + "desiredSpeedVar": "moveLateralSpeed" + }, + "children": [ + { + "id": "stepLeftShort_c", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/side_step_short_left.fbx", + "startFrame": 0.0, + "endFrame": 29.0, "timeScale": 1.0, "loopFlag": true }, "children": [] }, { - "id": "takeoffStand", + "id": "stepLeft_c", "type": "clip", "data": { - "url": "qrc:///avatar/animations/jump_standing_launch.fbx", + "url": "qrc:///avatar/animations/side_step_left.fbx", + "startFrame": 0.0, + "endFrame": 20.0, + "timeScale": 1.0, + "loopFlag": true + }, + "children": [] + }, + { + "id": "strafeLeftAnim_c", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/side_step_left_fast.fbx", + "startFrame": 0.0, + "endFrame": 16.0, + "timeScale": 1.0, + "loopFlag": true + }, + "children": [] + } + ] + }, + { + "id": "strafeRightHmd", + "type": "blendLinearMove", + "data": { + "alpha": 0.0, + "desiredSpeed": 1.4, + "characteristicSpeeds": [0, 0.5, 2.5], + "alphaVar": "moveLateralAlpha", + "desiredSpeedVar": "moveLateralSpeed" + }, + "children": [ + { + "id": "stepRightShort_c", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/side_step_short_left.fbx", + "startFrame": 0.0, + "endFrame": 29.0, + "timeScale": 1.0, + "loopFlag": true, + "mirrorFlag": true + }, + "children": [] + }, + { + "id": "stepRight_c", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/side_step_left.fbx", + "startFrame": 0.0, + "endFrame": 20.0, + "timeScale": 1.0, + "loopFlag": true, + "mirrorFlag": true + }, + "children": [] + }, + { + "id": "strafeRightAnim_c", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/side_step_left_fast.fbx", + "startFrame": 0.0, + "endFrame": 16.0, + "timeScale": 1.0, + "loopFlag": true, + "mirrorFlag": true + }, + "children": [] + } + ] + }, + { + "id": "fly", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/fly.fbx", + "startFrame": 1.0, + "endFrame": 80.0, + "timeScale": 1.0, + "loopFlag": true + }, + "children": [] + }, + { + "id": "takeoffStand", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/jump_standing_launch.fbx", + "startFrame": 2.0, + "endFrame": 16.0, + "timeScale": 1.0, + "loopFlag": false + }, + "children": [] + }, + { + "id": "TAKEOFFRUN", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/jump_running_launch_land.fbx", + "startFrame": 4.0, + "endFrame": 15.0, + "timeScale": 1.0, + "loopFlag": false + }, + "children": [] + }, + { + "id": "inAirStand", + "type": "blendLinear", + "data": { + "alpha": 0.0, + "alphaVar": "inAirAlpha" + }, + "children": [ + { + "id": "inAirStandPreApex", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/jump_standing_apex.fbx", + "startFrame": 0.0, + "endFrame": 0.0, + "timeScale": 1.0, + "loopFlag": false + }, + "children": [] + }, + { + "id": "inAirStandApex", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/jump_standing_apex.fbx", + "startFrame": 1.0, + "endFrame": 1.0, + "timeScale": 1.0, + "loopFlag": false + }, + "children": [] + }, + { + "id": "inAirStandPostApex", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/jump_standing_apex.fbx", "startFrame": 2.0, + "endFrame": 2.0, + "timeScale": 1.0, + "loopFlag": false + }, + "children": [] + } + ] + }, + { + "id": "INAIRRUN", + "type": "blendLinear", + "data": { + "alpha": 0.0, + "alphaVar": "inAirAlpha" + }, + "children": [ + { + "id": "inAirRunPreApex", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/jump_running_launch_land.fbx", + "startFrame": 16.0, "endFrame": 16.0, "timeScale": 1.0, "loopFlag": false @@ -2003,146 +1489,66 @@ "children": [] }, { - "id": "TAKEOFFRUN", + "id": "inAirRunApex", "type": "clip", "data": { "url": "qrc:///avatar/animations/jump_running_launch_land.fbx", - "startFrame": 4.0, - "endFrame": 15.0, + "startFrame": 22.0, + "endFrame": 22.0, "timeScale": 1.0, "loopFlag": false }, "children": [] }, { - "id": "inAirStand", - "type": "blendLinear", - "data": { - "alpha": 0.0, - "alphaVar": "inAirAlpha" - }, - "children": [ - { - "id": "inAirStandPreApex", - "type": "clip", - "data": { - "url": "qrc:///avatar/animations/jump_standing_apex.fbx", - "startFrame": 0.0, - "endFrame": 0.0, - "timeScale": 1.0, - "loopFlag": false - }, - "children": [] - }, - { - "id": "inAirStandApex", - "type": "clip", - "data": { - "url": "qrc:///avatar/animations/jump_standing_apex.fbx", - "startFrame": 1.0, - "endFrame": 1.0, - "timeScale": 1.0, - "loopFlag": false - }, - "children": [] - }, - { - "id": "inAirStandPostApex", - "type": "clip", - "data": { - "url": "qrc:///avatar/animations/jump_standing_apex.fbx", - "startFrame": 2.0, - "endFrame": 2.0, - "timeScale": 1.0, - "loopFlag": false - }, - "children": [] - } - ] - }, - { - "id": "INAIRRUN", - "type": "blendLinear", - "data": { - "alpha": 0.0, - "alphaVar": "inAirAlpha" - }, - "children": [ - { - "id": "inAirRunPreApex", - "type": "clip", - "data": { - "url": "qrc:///avatar/animations/jump_running_launch_land.fbx", - "startFrame": 16.0, - "endFrame": 16.0, - "timeScale": 1.0, - "loopFlag": false - }, - "children": [] - }, - { - "id": "inAirRunApex", - "type": "clip", - "data": { - "url": "qrc:///avatar/animations/jump_running_launch_land.fbx", - "startFrame": 22.0, - "endFrame": 22.0, - "timeScale": 1.0, - "loopFlag": false - }, - "children": [] - }, - { - "id": "inAirRunPostApex", - "type": "clip", - "data": { - "url": "qrc:///avatar/animations/jump_running_launch_land.fbx", - "startFrame": 33.0, - "endFrame": 33.0, - "timeScale": 1.0, - "loopFlag": false - }, - "children": [] - } - ] - }, - { - "id": "landStandImpact", - "type": "clip", - "data": { - "url": "qrc:///avatar/animations/jump_standing_land_settle.fbx", - "startFrame": 1.0, - "endFrame": 6.0, - "timeScale": 1.0, - "loopFlag": false - }, - "children": [] - }, - { - "id": "landStand", - "type": "clip", - "data": { - "url": "qrc:///avatar/animations/jump_standing_land_settle.fbx", - "startFrame": 6.0, - "endFrame": 68.0, - "timeScale": 1.0, - "loopFlag": false - }, - "children": [] - }, - { - "id": "LANDRUN", + "id": "inAirRunPostApex", "type": "clip", "data": { "url": "qrc:///avatar/animations/jump_running_launch_land.fbx", - "startFrame": 29.0, - "endFrame": 40.0, + "startFrame": 33.0, + "endFrame": 33.0, "timeScale": 1.0, "loopFlag": false }, "children": [] } ] + }, + { + "id": "landStandImpact", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/jump_standing_land_settle.fbx", + "startFrame": 1.0, + "endFrame": 6.0, + "timeScale": 1.0, + "loopFlag": false + }, + "children": [] + }, + { + "id": "landStand", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/jump_standing_land_settle.fbx", + "startFrame": 6.0, + "endFrame": 68.0, + "timeScale": 1.0, + "loopFlag": false + }, + "children": [] + }, + { + "id": "LANDRUN", + "type": "clip", + "data": { + "url": "qrc:///avatar/animations/jump_running_launch_land.fbx", + "startFrame": 29.0, + "endFrame": 40.0, + "timeScale": 1.0, + "loopFlag": false + }, + "children": [] } ] } diff --git a/interface/resources/avatar/avatar-animation_withIKNode.json b/interface/resources/avatar/avatar-animation_withIKNode.json index 8a66ed21b3..44b2b9c25f 100644 --- a/interface/resources/avatar/avatar-animation_withIKNode.json +++ b/interface/resources/avatar/avatar-animation_withIKNode.json @@ -119,7 +119,7 @@ "type": "poleVectorConstraint", "data": { "enabled": false, - "referenceVector": [ 0, 0, 1 ], + "referenceVector": [ -1, 0, 0 ], "baseJointName": "RightArm", "midJointName": "RightForeArm", "tipJointName": "RightHand", @@ -149,7 +149,7 @@ "type": "poleVectorConstraint", "data": { "enabled": false, - "referenceVector": [ 0, 0, 1 ], + "referenceVector": [ 1, 0, 0 ], "baseJointName": "LeftArm", "midJointName": "LeftForeArm", "tipJointName": "LeftHand", diff --git a/libraries/animation/src/AnimInverseKinematics.cpp b/libraries/animation/src/AnimInverseKinematics.cpp index 7a29ff4001..8c365d2561 100644 --- a/libraries/animation/src/AnimInverseKinematics.cpp +++ b/libraries/animation/src/AnimInverseKinematics.cpp @@ -886,8 +886,7 @@ const AnimPoseVec& AnimInverseKinematics::overlay(const AnimVariantMap& animVars if (dt > MAX_OVERLAY_DT) { dt = MAX_OVERLAY_DT; } - loadPoses(underPoses); - /* + if (_relativePoses.size() != underPoses.size()) { loadPoses(underPoses); } else { @@ -974,8 +973,8 @@ const AnimPoseVec& AnimInverseKinematics::overlay(const AnimVariantMap& animVars ::blend(1, &prevHipsAbsPose, &absPose, alpha, &absPose); } - //_relativePoses[_hipsIndex] = parentAbsPose.inverse() * absPose; - //_relativePoses[_hipsIndex].scale() = glm::vec3(1.0f); + _relativePoses[_hipsIndex] = parentAbsPose.inverse() * absPose; + _relativePoses[_hipsIndex].scale() = glm::vec3(1.0f); } // if there is an active jointChainInfo for the hips store the post shifted hips into it. @@ -1043,7 +1042,7 @@ const AnimPoseVec& AnimInverseKinematics::overlay(const AnimVariantMap& animVars preconditionRelativePosesToAvoidLimbLock(context, targets); //qCDebug(animation) << "hips before ccd" << _relativePoses[_hipsIndex]; - //solve(context, targets, dt, jointChainInfoVec); + solve(context, targets, dt, jointChainInfoVec); //qCDebug(animation) << "hips after ccd" << _relativePoses[_hipsIndex]; } @@ -1055,7 +1054,7 @@ const AnimPoseVec& AnimInverseKinematics::overlay(const AnimVariantMap& animVars } processOutputJoints(triggersOut); - */ + return _relativePoses; } diff --git a/libraries/animation/src/AnimSplineIK.cpp b/libraries/animation/src/AnimSplineIK.cpp index 847d512a51..39f8767465 100644 --- a/libraries/animation/src/AnimSplineIK.cpp +++ b/libraries/animation/src/AnimSplineIK.cpp @@ -71,133 +71,71 @@ const AnimPoseVec& AnimSplineIK::evaluate(const AnimVariantMap& animVars, const } ////////////////////////////////////////////////////////////////////////////////// - // check to see if we actually need absolute poses. AnimPoseVec absolutePoses; absolutePoses.resize(_poses.size()); computeAbsolutePoses(absolutePoses); - AnimPoseVec absolutePoses2; - absolutePoses2.resize(_poses.size()); - // do this later - //computeAbsolutePoses(absolutePoses2); - - int jointIndex2 = _skeleton->nameToJointIndex("Spine2"); - AnimPose origSpine2PoseAbs = _skeleton->getAbsolutePose(jointIndex2, _poses); - if ((jointIndex2 != -1) && (_poses.size() > 0)) { - AnimPose origSpine2 = _skeleton->getAbsolutePose(jointIndex2, _poses); - AnimPose origSpine1 = _skeleton->getAbsolutePose(_skeleton->nameToJointIndex("Spine1"),_poses); - //origSpine2PoseRel = origSpine1.inverse() * origSpine2; - //qCDebug(animation) << "origSpine2Pose: " << origSpine2Pose.rot(); - //qCDebug(animation) << "original relative spine2 " << origSpine2PoseAbs; - } - - IKTarget target; - int jointIndex = _skeleton->nameToJointIndex("Head"); - if (jointIndex != -1) { + if (_headIndex != -1) { target.setType(animVars.lookup("headType", (int)IKTarget::Type::RotationAndPosition)); - target.setIndex(jointIndex); - AnimPose absPose = _skeleton->getAbsolutePose(jointIndex, _poses); + target.setIndex(_headIndex); + AnimPose absPose = _skeleton->getAbsolutePose(_headIndex, _poses); glm::quat rotation = animVars.lookupRigToGeometry("headRotation", absPose.rot()); glm::vec3 translation = animVars.lookupRigToGeometry("headPosition", absPose.trans()); float weight = animVars.lookup("headWeight", "4.0"); - //qCDebug(animation) << "target 1 rotation absolute" << rotation; target.setPose(rotation, translation); target.setWeight(weight); - //const float* flexCoefficients = new float[5]{ 1.0f, 0.5f, 0.25f, 0.2f, 0.1f }; - const float* flexCoefficients = new float[2]{ 1.0f, 0.5f }; - target.setFlexCoefficients(2, flexCoefficients); - - // record the index of the hips ik target. - if (target.getIndex() == _hipsIndex) { - _hipsTargetIndex = 1; - } + const float* flexCoefficients = new float[5]{ 1.0f, 1.0f, 1.0f, 1.0f, 1.0f }; + //const float* flexCoefficients = new float[2]{ 0.0f, 1.0f }; + target.setFlexCoefficients(5, flexCoefficients); } - AnimPose origAbsAfterHeadSpline; - AnimPose finalSpine2; AnimChain jointChain; AnimPose targetSpine2; + AnimPoseVec absolutePoses2; + absolutePoses2.resize(_poses.size()); if (_poses.size() > 0) { - _snapshotChain.buildFromRelativePoses(_skeleton, _poses, target.getIndex()); + //_snapshotChain.buildFromRelativePoses(_skeleton, _poses, target.getIndex()); jointChain.buildFromRelativePoses(_skeleton, _poses, target.getIndex()); - // jointChain2.buildFromRelativePoses(_skeleton, _poses, target2.getIndex()); - - // for each target solve target with spline - //qCDebug(animation) << "before head spline"; - //jointChain.dump(); solveTargetWithSpline(context, target, absolutePoses, false, jointChain); - AnimPose afterSolveSpine2 = jointChain.getAbsolutePoseFromJointIndex(jointIndex2); - AnimPose afterSolveSpine1 = jointChain.getAbsolutePoseFromJointIndex(_skeleton->nameToJointIndex("Spine1")); - AnimPose afterSolveSpine2Rel = afterSolveSpine1.inverse() * afterSolveSpine2; - AnimPose originalSpine2Relative = afterSolveSpine1.inverse() * origSpine2PoseAbs; - glm::quat rotation3 = animVars.lookupRigToGeometry("spine2Rotation", afterSolveSpine2.rot()); - glm::vec3 translation3 = animVars.lookupRigToGeometry("spine2Position", afterSolveSpine2.trans()); - targetSpine2 = AnimPose(rotation3, afterSolveSpine2.trans()); - finalSpine2 = afterSolveSpine1.inverse() * targetSpine2; - - //qCDebug(animation) << "relative spine2 after solve" << afterSolveSpine2Rel; - //qCDebug(animation) << "relative spine2 orig" << originalSpine2Relative; - AnimPose latestSpine2Relative(originalSpine2Relative.rot(), afterSolveSpine2Rel.trans()); - //jointChain.setRelativePoseAtJointIndex(jointIndex2, finalSpine2); jointChain.outputRelativePoses(_poses); - //_poses[_headIndex] = jointChain.getRelativePoseAtJointIndex(_headIndex); - //_poses[_skeleton->nameToJointIndex("Neck")] = jointChain.getRelativePoseAtJointIndex(_skeleton->nameToJointIndex("Neck")); - //_poses[_spine2Index] = jointChain.getRelativePoseAtJointIndex(_spine2Index); - - //custom output code for the head. just do the head neck and spine2 - - //qCDebug(animation) << "after head spline"; - //jointChain.dump(); - - computeAbsolutePoses(absolutePoses2); - //origAbsAfterHeadSpline = _skeleton->getAbsolutePose(jointIndex2, _poses); - // qCDebug(animation) << "Spine2 trans after head spline: " << origAbsAfterHeadSpline.trans(); + AnimPose afterSolveSpine2 = _skeleton->getAbsolutePose(_spine2Index, _poses); + glm::quat spine2RotationTarget = animVars.lookupRigToGeometry("spine2Rotation", afterSolveSpine2.rot()); + targetSpine2 = AnimPose(spine2RotationTarget, afterSolveSpine2.trans()); } + /* IKTarget target2; - //int jointIndex2 = _skeleton->nameToJointIndex("Spine2"); - if (jointIndex2 != -1) { + computeAbsolutePoses(absolutePoses2); + if (_spine2Index != -1) { target2.setType(animVars.lookup("spine2Type", (int)IKTarget::Type::RotationAndPosition)); - target2.setIndex(jointIndex2); - AnimPose absPose2 = _skeleton->getAbsolutePose(jointIndex2, _poses); - glm::quat rotation2 = animVars.lookupRigToGeometry("spine2Rotation", absPose2.rot()); - glm::vec3 translation2 = animVars.lookupRigToGeometry("spine2Position", absPose2.trans()); - float weight2 = animVars.lookup("spine2Weight", "2.0"); - // qCDebug(animation) << "rig to geometry" << rotation2; + target2.setIndex(_spine2Index); - //target2.setPose(rotation2, translation2); + float weight2 = animVars.lookup("spine2Weight", "2.0"); + target2.setPose(targetSpine2.rot(), targetSpine2.trans()); target2.setWeight(weight2); - const float* flexCoefficients2 = new float[3]{ 1.0f, 0.5f, 0.25f }; + + const float* flexCoefficients2 = new float[3]{ 1.0f, 1.0f, 1.0f }; target2.setFlexCoefficients(3, flexCoefficients2); - - } + AnimChain jointChain2; + AnimPose beforeSolveChestNeck; if (_poses.size() > 0) { - // _snapshotChain.buildFromRelativePoses(_skeleton, _poses, target.getIndex()); - // jointChain.buildFromRelativePoses(_skeleton, _poses, target.getIndex()); - // jointChain2.buildFromRelativePoses(_skeleton, underPoses, target2.getIndex()); + + beforeSolveChestNeck = _skeleton->getAbsolutePose(_skeleton->nameToJointIndex("Neck"), _poses); + jointChain2.buildFromRelativePoses(_skeleton, _poses, target2.getIndex()); - - // for each target solve target with spline solveTargetWithSpline(context, target2, absolutePoses2, false, jointChain2); - - //jointChain.outputRelativePoses(_poses); jointChain2.outputRelativePoses(_poses); - //computeAbsolutePoses(absolutePoses); - //qCDebug(animation) << "Spine2 spline"; - //jointChain2.dump(); - //qCDebug(animation) << "Spine2Pose trans after spine2 spline: " << _skeleton->getAbsolutePose(jointIndex2, _poses).trans(); - } - + */ const float FRAMES_PER_SECOND = 30.0f; @@ -209,9 +147,26 @@ const AnimPoseVec& AnimSplineIK::evaluate(const AnimVariantMap& animVars, const // make the prevchain // interp from the previous chain to the new chain/or underposes if the ik is disabled. // update the relative poses and then we are done - - /**/ + // set the tip/head rotation to match the absolute rotation of the target. + int headParent = _skeleton->getParentIndex(_headIndex); + int spine2Parent = _skeleton->getParentIndex(_spine2Index); + if ((spine2Parent != -1) && (headParent != -1) && (_poses.size() > 0)) { + /* + AnimPose spine2Target(target2.getRotation(), target2.getTranslation()); + AnimPose finalSpine2RelativePose = _skeleton->getAbsolutePose(spine2Parent, _poses).inverse() * spine2Target; + _poses[_spine2Index] = finalSpine2RelativePose; + + + AnimPose neckAbsolute = _skeleton->getAbsolutePose(headParent, _poses); + AnimPose finalNeckAbsolute = AnimPose(safeLerp(target2.getRotation(), target.getRotation(), 1.0f),neckAbsolute.trans()); + _poses[headParent] = spine2Target.inverse() * beforeSolveChestNeck; + */ + AnimPose headTarget(target.getRotation(),target.getTranslation()); + AnimPose finalHeadRelativePose = _skeleton->getAbsolutePose(headParent,_poses).inverse() * headTarget; + _poses[_headIndex] = finalHeadRelativePose; + } + return _poses; } @@ -275,19 +230,19 @@ void AnimSplineIK::solveTargetWithSpline(const AnimContext& context, const IKTar // build spline from tip to base AnimPose tipPose = AnimPose(glm::vec3(1.0f), target.getRotation(), target.getTranslation()); AnimPose basePose; - if (target.getIndex() == _headIndex) { - basePose = absolutePoses[headBaseIndex]; - } else { + //if (target.getIndex() == _headIndex) { + // basePose = absolutePoses[headBaseIndex]; + //} else { basePose = absolutePoses[baseIndex]; - } + //} CubicHermiteSplineFunctorWithArcLength spline; if (target.getIndex() == _headIndex) { // set gain factors so that more curvature occurs near the tip of the spline. const float HIPS_GAIN = 0.5f; const float HEAD_GAIN = 1.0f; - //spline = computeSplineFromTipAndBase(tipPose, basePose, HIPS_GAIN, HEAD_GAIN); - spline = computeSplineFromTipAndBase(tipPose, basePose); + spline = computeSplineFromTipAndBase(tipPose, basePose, HIPS_GAIN, HEAD_GAIN); + // spline = computeSplineFromTipAndBase(tipPose, basePose); } else { spline = computeSplineFromTipAndBase(tipPose, basePose); } @@ -359,6 +314,9 @@ void AnimSplineIK::solveTargetWithSpline(const AnimContext& context, const IKTar if (!chainInfoOut.setRelativePoseAtJointIndex(splineJointInfo.jointIndex, relPose)) { qCDebug(animation) << "we didn't find the joint index for the spline!!!!"; } + if (splineJointInfo.jointIndex == _skeleton->nameToJointIndex("Neck")) { + qCDebug(animation) << "neck is " << relPose; + } parentAbsPose = flexedAbsPose; } @@ -393,8 +351,8 @@ void AnimSplineIK::computeAndCacheSplineJointInfosForIKTarget(const AnimContext& AnimPose tipPose = _skeleton->getAbsoluteDefaultPose(target.getIndex()); AnimPose basePose; if (target.getIndex() == _headIndex) { - //basePose = _skeleton->getAbsoluteDefaultPose(_hipsIndex); - basePose = _skeleton->getAbsoluteDefaultPose(_spine2Index); + basePose = _skeleton->getAbsoluteDefaultPose(_hipsIndex); + //basePose = _skeleton->getAbsoluteDefaultPose(_spine2Index); } else { basePose = _skeleton->getAbsoluteDefaultPose(_hipsIndex); } @@ -404,8 +362,8 @@ void AnimSplineIK::computeAndCacheSplineJointInfosForIKTarget(const AnimContext& // set gain factors so that more curvature occurs near the tip of the spline. const float HIPS_GAIN = 0.5f; const float HEAD_GAIN = 1.0f; - // spline = computeSplineFromTipAndBase(tipPose, basePose, HIPS_GAIN, HEAD_GAIN); - spline = computeSplineFromTipAndBase(tipPose, basePose); + spline = computeSplineFromTipAndBase(tipPose, basePose, HIPS_GAIN, HEAD_GAIN); + // spline = computeSplineFromTipAndBase(tipPose, basePose); } else { spline = computeSplineFromTipAndBase(tipPose, basePose); } diff --git a/libraries/animation/src/Rig.cpp b/libraries/animation/src/Rig.cpp index a34af09b27..70f1f9a1f7 100644 --- a/libraries/animation/src/Rig.cpp +++ b/libraries/animation/src/Rig.cpp @@ -1544,6 +1544,7 @@ void Rig::updateHands2(bool leftHandEnabled, bool rightHandEnabled, bool headEna int oppositeArmJointIndex = _animSkeleton->nameToJointIndex("RightArm"); glm::vec3 poleVector; bool usePoleVector = calculateElbowPoleVector(handJointIndex, elbowJointIndex, shoulderJointIndex, oppositeArmJointIndex, poleVector); + //glm::vec3 poleVector = calculateKneePoleVector(handJointIndex, elbowJointIndex, shoulderJointIndex, hipsIndex, rightHandPose); glm::vec3 sensorPoleVector = transformVectorFast(rigToSensorMatrix, poleVector); // smooth toward desired pole vector from previous pole vector... to reduce jitter, but in sensor space. @@ -1556,7 +1557,7 @@ void Rig::updateHands2(bool leftHandEnabled, bool rightHandEnabled, bool headEna _prevLeftHandPoleVector = smoothDeltaRot * _prevLeftHandPoleVector; _animVars.set("leftHandPoleVectorEnabled", true); - _animVars.set("leftHandPoleVector", transformVectorFast(sensorToRigMatrix, _prevLeftFootPoleVector)); + _animVars.set("leftHandPoleVector", transformVectorFast(sensorToRigMatrix, _prevLeftHandPoleVector)); } else { // We want to drive the IK from the underlying animation. // This gives us the ability to squat while in the HMD, without the feet from dipping under the floor. @@ -1595,7 +1596,7 @@ void Rig::updateHands2(bool leftHandEnabled, bool rightHandEnabled, bool headEna _prevRightHandPoleVector = smoothDeltaRot * _prevRightHandPoleVector; _animVars.set("rightHandPoleVectorEnabled", true); - _animVars.set("rightHandPoleVector", transformVectorFast(sensorToRigMatrix, _prevRightFootPoleVector)); + _animVars.set("rightHandPoleVector", transformVectorFast(sensorToRigMatrix, _prevRightHandPoleVector)); } else { // We want to drive the IK from the underlying animation. // This gives us the ability to squat while in the HMD, without the feet from dipping under the floor. @@ -1856,14 +1857,14 @@ void Rig::updateFromControllerParameters(const ControllerParameters& params, flo updateHead(_headEnabled, hipsEnabled, params.primaryControllerPoses[PrimaryControllerType_Head]); - //updateHands(leftHandEnabled, rightHandEnabled, hipsEnabled, hipsEstimated, leftArmEnabled, rightArmEnabled, _headEnabled, dt, - // params.primaryControllerPoses[PrimaryControllerType_LeftHand], params.primaryControllerPoses[PrimaryControllerType_RightHand], - // params.hipsShapeInfo, params.spineShapeInfo, params.spine1ShapeInfo, params.spine2ShapeInfo, - // params.rigToSensorMatrix, sensorToRigMatrix); + updateHands(leftHandEnabled, rightHandEnabled, hipsEnabled, hipsEstimated, leftArmEnabled, rightArmEnabled, _headEnabled, dt, + params.primaryControllerPoses[PrimaryControllerType_LeftHand], params.primaryControllerPoses[PrimaryControllerType_RightHand], + params.hipsShapeInfo, params.spineShapeInfo, params.spine1ShapeInfo, params.spine2ShapeInfo, + params.rigToSensorMatrix, sensorToRigMatrix); - updateHands2(leftHandEnabled, rightHandEnabled, _headEnabled, - params.primaryControllerPoses[PrimaryControllerType_LeftHand], params.primaryControllerPoses[PrimaryControllerType_RightHand], - params.rigToSensorMatrix, sensorToRigMatrix); + //updateHands2(leftHandEnabled, rightHandEnabled, _headEnabled, + // params.primaryControllerPoses[PrimaryControllerType_LeftHand], params.primaryControllerPoses[PrimaryControllerType_RightHand], + // params.rigToSensorMatrix, sensorToRigMatrix); updateFeet(leftFootEnabled, rightFootEnabled, _headEnabled, params.primaryControllerPoses[PrimaryControllerType_LeftFoot], params.primaryControllerPoses[PrimaryControllerType_RightFoot], From 754f55e091358cd715c3fc6bcf56a5542cfd253f Mon Sep 17 00:00:00 2001 From: howard-stearns Date: Wed, 23 Jan 2019 20:33:05 -0800 Subject: [PATCH 019/436] Include your own NFS items in marketplace listings, so you can stock up. --- scripts/system/html/js/marketplacesInject.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/scripts/system/html/js/marketplacesInject.js b/scripts/system/html/js/marketplacesInject.js index f1931192e4..aafdc65606 100644 --- a/scripts/system/html/js/marketplacesInject.js +++ b/scripts/system/html/js/marketplacesInject.js @@ -402,11 +402,15 @@ purchaseButton.attr('href', '#'); var cost = $('.item-cost').text(); var costInt = parseInt(cost, 10); + // One of 'invalidated', 'not for sale', 'sold out', or 'available' var availability = $.trim($('.item-availability').text()); if (limitedCommerce && (costInt > 0)) { availability = ''; } - if (availability === 'available') { + var isUpdating = window.location.href.indexOf('edition=') > -1; + // NFS only shows for artist stocking inventory + var isBuyEnabled = ('available' === availability) || isUpdating || ('not for sale' === availability); + if (isBuyEnabled) { purchaseButton.css({ "background": "linear-gradient(#00b4ef, #0093C5)", "color": "#FFF", @@ -422,11 +426,11 @@ }); } - var type = $('.item-type').text(); - var isUpdating = window.location.href.indexOf('edition=') > -1; var urlParams = new URLSearchParams(window.location.search); if (isUpdating) { purchaseButton.html('UPDATE FOR FREE'); + } else if (availability == 'not for sale') { + purchaseButton.html("Free artist's stock to inventory"); } else if (availability !== 'available') { purchaseButton.html('UNAVAILABLE ' + (availability ? ('(' + availability + ')') : '')); } else if (parseInt(cost) > 0 && $('#side-info').find('#buyItemButton').size() === 0) { @@ -435,7 +439,7 @@ } purchaseButton.on('click', function () { - if ('available' === availability || isUpdating) { + if (isBuyEnabled) { buyButtonClicked(window.location.pathname.split("/")[3], "itemPage", urlParams.get('edition')); From 37f92d2319b3a09148706ffb1987c3f4715a0c48 Mon Sep 17 00:00:00 2001 From: amantley Date: Thu, 24 Jan 2019 17:02:30 -0800 Subject: [PATCH 020/436] added code to read tip and base var info from the json --- .../avatar/avatar-animation_withIKNode.json | 7 + .../animation/src/AnimInverseKinematics.cpp | 15 +- libraries/animation/src/AnimNodeLoader.cpp | 12 +- libraries/animation/src/AnimSplineIK.cpp | 208 ++++++++++++------ libraries/animation/src/AnimSplineIK.h | 20 +- libraries/animation/src/Rig.cpp | 14 +- 6 files changed, 194 insertions(+), 82 deletions(-) diff --git a/interface/resources/avatar/avatar-animation_withIKNode.json b/interface/resources/avatar/avatar-animation_withIKNode.json index 44b2b9c25f..04ed593755 100644 --- a/interface/resources/avatar/avatar-animation_withIKNode.json +++ b/interface/resources/avatar/avatar-animation_withIKNode.json @@ -183,6 +183,13 @@ "interpDuration": 15, "baseJointName": "Hips", "tipJointName": "Head", + "secondaryTargetJointName": "Spine2", + "basePositionVar": "hipsPosition", + "baseRotationVar": "hipsRotation", + "tipPositionVar": "headPosition", + "tipRotationVar": "headRotation", + "secondaryTargetPositionVar": "spine2Position", + "secondaryTargetRotationVar": "spine2Rotation", "alphaVar": "splineIKAlpha", "enabledVar": "splineIKEnabled", "endEffectorRotationVarVar": "splineIKRotationVar", diff --git a/libraries/animation/src/AnimInverseKinematics.cpp b/libraries/animation/src/AnimInverseKinematics.cpp index 8c365d2561..f95fe3333f 100644 --- a/libraries/animation/src/AnimInverseKinematics.cpp +++ b/libraries/animation/src/AnimInverseKinematics.cpp @@ -243,13 +243,6 @@ void AnimInverseKinematics::solve(const AnimContext& context, const std::vector< break; case IKTarget::Type::Spline: solveTargetWithSpline(context, targets[i], absolutePoses, debug, jointChainInfoVec[i]); - //if (jointChainInfoVec[i].target.getIndex() == _skeleton->nameToJointIndex("Head")) { - // qCDebug(animation) << "AnimIK spline index is " << targets[i].getIndex() << " and chain info size is " << jointChainInfoVec[i].jointInfoVec.size(); - for (int w = 0; w < jointChainInfoVec[i].jointInfoVec.size(); w++) { - // qCDebug(animation) << "joint " << jointChainInfoVec[i].jointInfoVec[w].jointIndex << " rotation is " << jointChainInfoVec[i].jointInfoVec[w].rot; - // qCDebug(animation) << "joint " << jointChainInfoVec[i].jointInfoVec[w].jointIndex << " translation is " << jointChainInfoVec[i].jointInfoVec[w].trans; - } - //} break; default: solveTargetWithCCD(context, targets[i], absolutePoses, debug, jointChainInfoVec[i]); @@ -329,6 +322,10 @@ void AnimInverseKinematics::solve(const AnimContext& context, const std::vector< } } + //qCDebug(animation) << "joint chain pose for head animIK " << jointChainInfoVec[4].jointInfoVec[w].trans << " " << jointChainInfoVec[4].jointInfoVec[w].rot; + qCDebug(animation) << "absolute pose for head animIK " << absolutePoses[_skeleton->nameToJointIndex("Head")]; + qCDebug(animation) << "target pose for head animIK " << targets[4].getTranslation() << " " << targets[4].getRotation(); + // compute maxError maxError = 0.0f; for (size_t i = 0; i < targets.size(); i++) { @@ -833,7 +830,9 @@ void AnimInverseKinematics::solveTargetWithSpline(const AnimContext& context, co AnimPose relPose = parentAbsPose.inverse() * flexedAbsPose; + bool constrained = false; + /* if (splineJointInfo.jointIndex != _hipsIndex) { // constrain the amount the spine can stretch or compress float length = glm::length(relPose.trans()); @@ -854,7 +853,7 @@ void AnimInverseKinematics::solveTargetWithSpline(const AnimContext& context, co relPose.trans() = glm::vec3(0.0f); } } - + */ jointChainInfoOut.jointInfoVec[i] = { relPose.rot(), relPose.trans(), splineJointInfo.jointIndex, constrained }; parentAbsPose = flexedAbsPose; diff --git a/libraries/animation/src/AnimNodeLoader.cpp b/libraries/animation/src/AnimNodeLoader.cpp index ec9099df8b..ebe9dbe3ba 100644 --- a/libraries/animation/src/AnimNodeLoader.cpp +++ b/libraries/animation/src/AnimNodeLoader.cpp @@ -585,6 +585,13 @@ static AnimNode::Pointer loadSplineIKNode(const QJsonObject& jsonObj, const QStr READ_FLOAT(interpDuration, jsonObj, id, jsonUrl, nullptr); READ_STRING(baseJointName, jsonObj, id, jsonUrl, nullptr); READ_STRING(tipJointName, jsonObj, id, jsonUrl, nullptr); + READ_STRING(secondaryTargetJointName, jsonObj, id, jsonUrl, nullptr); + READ_STRING(basePositionVar, jsonObj, id, jsonUrl, nullptr); + READ_STRING(baseRotationVar, jsonObj, id, jsonUrl, nullptr); + READ_STRING(tipPositionVar, jsonObj, id, jsonUrl, nullptr); + READ_STRING(tipRotationVar, jsonObj, id, jsonUrl, nullptr); + READ_STRING(secondaryTargetPositionVar, jsonObj, id, jsonUrl, nullptr); + READ_STRING(secondaryTargetRotationVar, jsonObj, id, jsonUrl, nullptr); READ_STRING(alphaVar, jsonObj, id, jsonUrl, nullptr); READ_STRING(enabledVar, jsonObj, id, jsonUrl, nullptr); READ_STRING(endEffectorRotationVarVar, jsonObj, id, jsonUrl, nullptr); @@ -592,8 +599,9 @@ static AnimNode::Pointer loadSplineIKNode(const QJsonObject& jsonObj, const QStr auto node = std::make_shared(id, alpha, enabled, interpDuration, baseJointName, tipJointName, - alphaVar, enabledVar, - endEffectorRotationVarVar, endEffectorPositionVarVar); + alphaVar, enabledVar, endEffectorRotationVarVar, endEffectorPositionVarVar, + basePositionVar, baseRotationVar, + tipPositionVar, tipRotationVar, secondaryTargetJointName, secondaryTargetPositionVar, secondaryTargetRotationVar); return node; } diff --git a/libraries/animation/src/AnimSplineIK.cpp b/libraries/animation/src/AnimSplineIK.cpp index 39f8767465..afe9f6dfcb 100644 --- a/libraries/animation/src/AnimSplineIK.cpp +++ b/libraries/animation/src/AnimSplineIK.cpp @@ -20,7 +20,14 @@ AnimSplineIK::AnimSplineIK(const QString& id, float alpha, bool enabled, float i const QString& baseJointName, const QString& tipJointName, const QString& alphaVar, const QString& enabledVar, - const QString& endEffectorRotationVarVar, const QString& endEffectorPositionVarVar) : + const QString& endEffectorRotationVarVar, const QString& endEffectorPositionVarVar, + const QString& basePositionVar, + const QString& baseRotationVar, + const QString& tipPositionVar, + const QString& tipRotationVar, + const QString& secondaryTargetJointName, + const QString& secondaryTargetPositionVar, + const QString& secondaryTargetRotationVar) : AnimNode(AnimNode::Type::SplineIK, id), _alpha(alpha), _enabled(enabled), @@ -32,7 +39,15 @@ AnimSplineIK::AnimSplineIK(const QString& id, float alpha, bool enabled, float i _endEffectorRotationVarVar(endEffectorRotationVarVar), _endEffectorPositionVarVar(endEffectorPositionVarVar), _prevEndEffectorRotationVar(), - _prevEndEffectorPositionVar() { + _prevEndEffectorPositionVar(), + _basePositionVar(basePositionVar), + _baseRotationVar(baseRotationVar), + _tipPositionVar(tipPositionVar), + _tipRotationVar(tipRotationVar), + _secondaryTargetJointName(secondaryTargetJointName), + _secondaryTargetPositionVar(secondaryTargetPositionVar), + _secondaryTargetRotationVar(secondaryTargetRotationVar) +{ } @@ -51,16 +66,19 @@ const AnimPoseVec& AnimSplineIK::evaluate(const AnimVariantMap& animVars, const if (_children.size() != 1) { return _poses; } - // evalute underPoses + // evaluate underPoses AnimPoseVec underPoses = _children[0]->evaluate(animVars, context, dt, triggersOut); _poses = underPoses; - // now we override the hips relative pose based on the hips target that has been set. + glm::quat hipsTargetRotation; + glm::vec3 hipsTargetTranslation; + + // now we override the hips with the hips target pose. //////////////////////////////////////////////////// if (_poses.size() > 0) { AnimPose hipsUnderPose = _skeleton->getAbsolutePose(_hipsIndex, _poses); - glm::quat hipsTargetRotation = animVars.lookupRigToGeometry("hipsRotation", hipsUnderPose.rot()); - glm::vec3 hipsTargetTranslation = animVars.lookupRigToGeometry("hipsPosition", hipsUnderPose.trans()); + hipsTargetRotation = animVars.lookupRigToGeometry("hipsRotation", hipsUnderPose.rot()); + hipsTargetTranslation = animVars.lookupRigToGeometry("hipsPosition", hipsUnderPose.trans()); AnimPose absHipsTargetPose(hipsTargetRotation, hipsTargetTranslation); int hipsParentIndex = _skeleton->getParentIndex(_hipsIndex); @@ -76,23 +94,22 @@ const AnimPoseVec& AnimSplineIK::evaluate(const AnimVariantMap& animVars, const computeAbsolutePoses(absolutePoses); IKTarget target; - if (_headIndex != -1) { - target.setType(animVars.lookup("headType", (int)IKTarget::Type::RotationAndPosition)); - target.setIndex(_headIndex); - AnimPose absPose = _skeleton->getAbsolutePose(_headIndex, _poses); - glm::quat rotation = animVars.lookupRigToGeometry("headRotation", absPose.rot()); - glm::vec3 translation = animVars.lookupRigToGeometry("headPosition", absPose.trans()); - float weight = animVars.lookup("headWeight", "4.0"); + if (_tipJointIndex != -1) { + target.setType((int)IKTarget::Type::Spline); + target.setIndex(_tipJointIndex); + AnimPose absPose = _skeleton->getAbsolutePose(_tipJointIndex, _poses); + glm::quat rotation = animVars.lookupRigToGeometry(_tipRotationVar, absPose.rot()); + glm::vec3 translation = animVars.lookupRigToGeometry(_tipPositionVar, absPose.trans()); + float weight = 1.0f; target.setPose(rotation, translation); target.setWeight(weight); - const float* flexCoefficients = new float[5]{ 1.0f, 1.0f, 1.0f, 1.0f, 1.0f }; - //const float* flexCoefficients = new float[2]{ 0.0f, 1.0f }; + const float* flexCoefficients = new float[5]{ 1.0f, 0.5f, 0.25f, 0.2f, 0.1f }; target.setFlexCoefficients(5, flexCoefficients); } AnimChain jointChain; - AnimPose targetSpine2; + AnimPose updatedSecondaryTarget; AnimPoseVec absolutePoses2; absolutePoses2.resize(_poses.size()); if (_poses.size() > 0) { @@ -100,43 +117,47 @@ const AnimPoseVec& AnimSplineIK::evaluate(const AnimVariantMap& animVars, const //_snapshotChain.buildFromRelativePoses(_skeleton, _poses, target.getIndex()); jointChain.buildFromRelativePoses(_skeleton, _poses, target.getIndex()); solveTargetWithSpline(context, target, absolutePoses, false, jointChain); + jointChain.buildDirtyAbsolutePoses(); + qCDebug(animation) << "the jointChain Result for head " << jointChain.getAbsolutePoseFromJointIndex(_tipJointIndex); + qCDebug(animation) << "the orig target pose for head " << target.getPose(); jointChain.outputRelativePoses(_poses); - AnimPose afterSolveSpine2 = _skeleton->getAbsolutePose(_spine2Index, _poses); - glm::quat spine2RotationTarget = animVars.lookupRigToGeometry("spine2Rotation", afterSolveSpine2.rot()); + AnimPose afterSolveSecondaryTarget = _skeleton->getAbsolutePose(_secondaryTargetIndex, _poses); + glm::quat secondaryTargetRotation = animVars.lookupRigToGeometry(_secondaryTargetRotationVar, afterSolveSecondaryTarget.rot()); - targetSpine2 = AnimPose(spine2RotationTarget, afterSolveSpine2.trans()); + // updatedSecondaryTarget = AnimPose(secondaryTargetRotation, afterSolveSpine2.trans()); + updatedSecondaryTarget = AnimPose(afterSolveSecondaryTarget.rot(), afterSolveSecondaryTarget.trans()); } - /* - IKTarget target2; + + IKTarget secondaryTarget; computeAbsolutePoses(absolutePoses2); - if (_spine2Index != -1) { - target2.setType(animVars.lookup("spine2Type", (int)IKTarget::Type::RotationAndPosition)); - target2.setIndex(_spine2Index); + if (_secondaryTargetIndex != -1) { + secondaryTarget.setType((int)IKTarget::Type::Spline); + secondaryTarget.setIndex(_secondaryTargetIndex); - float weight2 = animVars.lookup("spine2Weight", "2.0"); + float weight2 = 1.0f; - target2.setPose(targetSpine2.rot(), targetSpine2.trans()); - target2.setWeight(weight2); + secondaryTarget.setPose(updatedSecondaryTarget.rot(), updatedSecondaryTarget.trans()); + secondaryTarget.setWeight(weight2); const float* flexCoefficients2 = new float[3]{ 1.0f, 1.0f, 1.0f }; - target2.setFlexCoefficients(3, flexCoefficients2); + secondaryTarget.setFlexCoefficients(3, flexCoefficients2); } - - AnimChain jointChain2; + /* + AnimChain secondaryJointChain; AnimPose beforeSolveChestNeck; if (_poses.size() > 0) { beforeSolveChestNeck = _skeleton->getAbsolutePose(_skeleton->nameToJointIndex("Neck"), _poses); - jointChain2.buildFromRelativePoses(_skeleton, _poses, target2.getIndex()); - solveTargetWithSpline(context, target2, absolutePoses2, false, jointChain2); - jointChain2.outputRelativePoses(_poses); + secondaryJointChain.buildFromRelativePoses(_skeleton, _poses, secondaryTarget.getIndex()); + solveTargetWithSpline(context, secondaryTarget, absolutePoses2, false, secondaryJointChain); + secondaryJointChain.outputRelativePoses(_poses); } - */ + */ const float FRAMES_PER_SECOND = 30.0f; _interpAlphaVel = FRAMES_PER_SECOND / _interpDuration; @@ -149,23 +170,59 @@ const AnimPoseVec& AnimSplineIK::evaluate(const AnimVariantMap& animVars, const // update the relative poses and then we are done // set the tip/head rotation to match the absolute rotation of the target. - int headParent = _skeleton->getParentIndex(_headIndex); - int spine2Parent = _skeleton->getParentIndex(_spine2Index); - if ((spine2Parent != -1) && (headParent != -1) && (_poses.size() > 0)) { + int tipParent = _skeleton->getParentIndex(_tipJointIndex); + int secondaryTargetParent = _skeleton->getParentIndex(_secondaryTargetIndex); + if ((secondaryTargetParent != -1) && (tipParent != -1) && (_poses.size() > 0)) { /* - AnimPose spine2Target(target2.getRotation(), target2.getTranslation()); - AnimPose finalSpine2RelativePose = _skeleton->getAbsolutePose(spine2Parent, _poses).inverse() * spine2Target; - _poses[_spine2Index] = finalSpine2RelativePose; + AnimPose secondaryTargetPose(target2.getRotation(), target2.getTranslation()); + AnimPose secondaryTargetRelativePose = _skeleton->getAbsolutePose(secondaryTargetParent, _poses).inverse() * secondaryTargetPose; + _poses[_secondaryTargetIndex] = secondaryTargetRelativePose; - AnimPose neckAbsolute = _skeleton->getAbsolutePose(headParent, _poses); + AnimPose neckAbsolute = _skeleton->getAbsolutePose(tipParent, _poses); AnimPose finalNeckAbsolute = AnimPose(safeLerp(target2.getRotation(), target.getRotation(), 1.0f),neckAbsolute.trans()); _poses[headParent] = spine2Target.inverse() * beforeSolveChestNeck; */ - AnimPose headTarget(target.getRotation(),target.getTranslation()); - AnimPose finalHeadRelativePose = _skeleton->getAbsolutePose(headParent,_poses).inverse() * headTarget; - _poses[_headIndex] = finalHeadRelativePose; + //AnimPose tipTarget(target.getRotation(),target.getTranslation()); + //AnimPose tipRelativePose = _skeleton->getAbsolutePose(tipParent,_poses).inverse() * headTarget; + //_poses[_tipJointIndex] = tipHeadRelativePose; } + + // debug render ik targets + if (context.getEnableDebugDrawIKTargets()) { + const vec4 WHITE(1.0f); + const vec4 GREEN(0.0f, 1.0f, 0.0f, 1.0f); + glm::mat4 rigToAvatarMat = createMatFromQuatAndPos(Quaternions::Y_180, glm::vec3()); + + glm::mat4 geomTargetMat = createMatFromQuatAndPos(target.getRotation(), target.getTranslation()); + glm::mat4 avatarTargetMat = rigToAvatarMat * context.getGeometryToRigMatrix() * geomTargetMat; + QString name = QString("ikTargetHead"); + DebugDraw::getInstance().addMyAvatarMarker(name, glmExtractRotation(avatarTargetMat), extractTranslation(avatarTargetMat), WHITE); + + glm::mat4 geomTargetMat2 = createMatFromQuatAndPos(secondaryTarget.getRotation(), secondaryTarget.getTranslation()); + glm::mat4 avatarTargetMat2 = rigToAvatarMat * context.getGeometryToRigMatrix() * geomTargetMat2; + QString name2 = QString("ikTargetSpine2"); + DebugDraw::getInstance().addMyAvatarMarker(name2, glmExtractRotation(avatarTargetMat2), extractTranslation(avatarTargetMat2), WHITE); + + + glm::mat4 geomTargetMat3 = createMatFromQuatAndPos(hipsTargetRotation, hipsTargetTranslation); + glm::mat4 avatarTargetMat3 = rigToAvatarMat * context.getGeometryToRigMatrix() * geomTargetMat3; + QString name3 = QString("ikTargetHips"); + DebugDraw::getInstance().addMyAvatarMarker(name3, glmExtractRotation(avatarTargetMat3), extractTranslation(avatarTargetMat3), WHITE); + + + } else if (context.getEnableDebugDrawIKTargets() != _previousEnableDebugIKTargets) { + // remove markers if they were added last frame. + + QString name = QString("ikTargetHead"); + DebugDraw::getInstance().removeMyAvatarMarker(name); + QString name2 = QString("ikTargetSpine2"); + DebugDraw::getInstance().removeMyAvatarMarker(name2); + QString name3 = QString("ikTargetHips"); + DebugDraw::getInstance().removeMyAvatarMarker(name3); + + } + _previousEnableDebugIKTargets = context.getEnableDebugDrawIKTargets(); return _poses; } @@ -174,11 +231,12 @@ void AnimSplineIK::lookUpIndices() { assert(_skeleton); // look up bone indices by name - std::vector indices = _skeleton->lookUpJointIndices({ _baseJointName, _tipJointName }); + std::vector indices = _skeleton->lookUpJointIndices({ _baseJointName, _tipJointName, _secondaryTargetJointName }); // cache the results _baseJointIndex = indices[0]; _tipJointIndex = indices[1]; + _secondaryTargetIndex = indices[2]; if (_baseJointIndex != -1) { _baseParentJointIndex = _skeleton->getParentIndex(_baseJointIndex); @@ -206,9 +264,8 @@ const AnimPoseVec& AnimSplineIK::getPosesInternal() const { void AnimSplineIK::setSkeletonInternal(AnimSkeleton::ConstPointer skeleton) { AnimNode::setSkeletonInternal(skeleton); - _headIndex = _skeleton->nameToJointIndex("Head"); + //_headIndex = _skeleton->nameToJointIndex("Head"); _hipsIndex = _skeleton->nameToJointIndex("Hips"); - _spine2Index = _skeleton->nameToJointIndex("Spine2"); lookUpIndices(); } @@ -224,20 +281,20 @@ static CubicHermiteSplineFunctorWithArcLength computeSplineFromTipAndBase(const void AnimSplineIK::solveTargetWithSpline(const AnimContext& context, const IKTarget& target, const AnimPoseVec& absolutePoses, bool debug, AnimChain& chainInfoOut) const { - const int baseIndex = _hipsIndex; - const int headBaseIndex = _spine2Index; + const int baseIndex = _baseJointIndex; + const int tipBaseIndex = _secondaryTargetIndex; // build spline from tip to base AnimPose tipPose = AnimPose(glm::vec3(1.0f), target.getRotation(), target.getTranslation()); AnimPose basePose; - //if (target.getIndex() == _headIndex) { - // basePose = absolutePoses[headBaseIndex]; + //if (target.getIndex() == _tipJointIndex) { + // basePose = absolutePoses[tipBaseIndex]; //} else { basePose = absolutePoses[baseIndex]; //} CubicHermiteSplineFunctorWithArcLength spline; - if (target.getIndex() == _headIndex) { + if (target.getIndex() == _tipJointIndex) { // set gain factors so that more curvature occurs near the tip of the spline. const float HIPS_GAIN = 0.5f; const float HEAD_GAIN = 1.0f; @@ -268,7 +325,7 @@ void AnimSplineIK::solveTargetWithSpline(const AnimContext& context, const IKTar // for head splines, preform most twist toward the tip by using ease in function. t^2 float rotT = t; - if (target.getIndex() == _headIndex) { + if (target.getIndex() == _tipJointIndex) { rotT = t * t; } glm::quat twistRot = safeLerp(basePose.rot(), tipPose.rot(), rotT); @@ -290,7 +347,7 @@ void AnimSplineIK::solveTargetWithSpline(const AnimContext& context, const IKTar AnimPose relPose = parentAbsPose.inverse() * flexedAbsPose; bool constrained = false; - if (splineJointInfo.jointIndex != _hipsIndex) { + if (splineJointInfo.jointIndex != _baseJointIndex) { // constrain the amount the spine can stretch or compress float length = glm::length(relPose.trans()); const float EPSILON = 0.0001f; @@ -350,15 +407,15 @@ void AnimSplineIK::computeAndCacheSplineJointInfosForIKTarget(const AnimContext& // build spline between the default poses. AnimPose tipPose = _skeleton->getAbsoluteDefaultPose(target.getIndex()); AnimPose basePose; - if (target.getIndex() == _headIndex) { - basePose = _skeleton->getAbsoluteDefaultPose(_hipsIndex); - //basePose = _skeleton->getAbsoluteDefaultPose(_spine2Index); + if (target.getIndex() == _tipJointIndex) { + basePose = _skeleton->getAbsoluteDefaultPose(_baseJointIndex); + //basePose = _skeleton->getAbsoluteDefaultPose(_secondaryTargetIndex); } else { - basePose = _skeleton->getAbsoluteDefaultPose(_hipsIndex); + basePose = _skeleton->getAbsoluteDefaultPose(_baseJointIndex); } CubicHermiteSplineFunctorWithArcLength spline; - if (target.getIndex() == _headIndex) { + if (target.getIndex() == _tipJointIndex) { // set gain factors so that more curvature occurs near the tip of the spline. const float HIPS_GAIN = 0.5f; const float HEAD_GAIN = 1.0f; @@ -377,11 +434,11 @@ void AnimSplineIK::computeAndCacheSplineJointInfosForIKTarget(const AnimContext& int index = target.getIndex(); int endIndex; - if (target.getIndex() == _headIndex) { - endIndex = _skeleton->getParentIndex(_spine2Index); - // endIndex = _skeleton->getParentIndex(_hipsIndex); + if (target.getIndex() == _tipJointIndex) { + //endIndex = _skeleton->getParentIndex(_secondaryTargetIndex); + endIndex = _skeleton->getParentIndex(_baseJointIndex); } else { - endIndex = _skeleton->getParentIndex(_hipsIndex); + endIndex = _skeleton->getParentIndex(_baseJointIndex); } while (index != endIndex) { AnimPose defaultPose = _skeleton->getAbsoluteDefaultPose(index); @@ -410,11 +467,34 @@ void AnimSplineIK::computeAndCacheSplineJointInfosForIKTarget(const AnimContext& _splineJointInfoMap[target.getIndex()] = splineJointInfoVec; } -void AnimSplineIK ::loadPoses(const AnimPoseVec& poses) { +void AnimSplineIK::loadPoses(const AnimPoseVec& poses) { assert(_skeleton && ((poses.size() == 0) || (_skeleton->getNumJoints() == (int)poses.size()))); if (_skeleton->getNumJoints() == (int)poses.size()) { _poses = poses; } else { _poses.clear(); } +} + + +void AnimSplineIK::setTargetVars(const QString& jointName, const QString& positionVar, const QString& rotationVar, + const QString& typeVar, const QString& weightVar, float weight, const std::vector& flexCoefficients, + const QString& poleVectorEnabledVar, const QString& poleReferenceVectorVar, const QString& poleVectorVar) { + /* + IKTargetVar targetVar(jointName, positionVar, rotationVar, typeVar, weightVar, weight, flexCoefficients, poleVectorEnabledVar, poleReferenceVectorVar, poleVectorVar); + + // if there are dups, last one wins. + bool found = false; + for (auto& targetVarIter : _targetVarVec) { + if (targetVarIter.jointName == jointName) { + targetVarIter = targetVar; + found = true; + break; + } + } + if (!found) { + // create a new entry + _targetVarVec.push_back(targetVar); + } + */ } \ No newline at end of file diff --git a/libraries/animation/src/AnimSplineIK.h b/libraries/animation/src/AnimSplineIK.h index 12f43fa680..4c51a0b9e1 100644 --- a/libraries/animation/src/AnimSplineIK.h +++ b/libraries/animation/src/AnimSplineIK.h @@ -21,7 +21,12 @@ public: AnimSplineIK(const QString& id, float alpha, bool enabled, float interpDuration, const QString& baseJointName, const QString& tipJointName, const QString& alphaVar, const QString& enabledVar, - const QString& endEffectorRotationVarVar, const QString& endEffectorPositionVarVar); + const QString& endEffectorRotationVarVar, const QString& endEffectorPositionVarVar, + const QString& basePositionVar, const QString& baseRotationVar, + const QString& tipPositionVar, const QString& tipRotationVar, + const QString& secondaryTargetJointName, + const QString& secondaryTargetPositionVar, + const QString& secondaryTargetRotationVar); virtual ~AnimSplineIK() override; virtual const AnimPoseVec& evaluate(const AnimVariantMap& animVars, const AnimContext& context, float dt, AnimVariantMap& triggersOut) override; @@ -52,9 +57,17 @@ protected: float _interpDuration; QString _baseJointName; QString _tipJointName; + QString _secondaryTargetJointName; + QString _basePositionVar; + QString _baseRotationVar; + QString _tipPositionVar; + QString _tipRotationVar; + QString _secondaryTargetPositionVar; + QString _secondaryTargetRotationVar; int _baseParentJointIndex { -1 }; int _baseJointIndex { -1 }; + int _secondaryTargetIndex { -1 }; int _tipJointIndex { -1 }; int _headIndex { -1 }; int _hipsIndex { -1 }; @@ -69,6 +82,8 @@ protected: QString _prevEndEffectorRotationVar; QString _prevEndEffectorPositionVar; + bool _previousEnableDebugIKTargets { false }; + InterpType _interpType{ InterpType::None }; float _interpAlphaVel{ 0.0f }; float _interpAlpha{ 0.0f }; @@ -84,6 +99,9 @@ protected: bool _lastEnableDebugDrawIKTargets{ false }; void AnimSplineIK::solveTargetWithSpline(const AnimContext& context, const IKTarget& target, const AnimPoseVec& absolutePoses, bool debug, AnimChain& chainInfoOut) const; + void AnimSplineIK::setTargetVars(const QString& jointName, const QString& positionVar, const QString& rotationVar, + const QString& typeVar, const QString& weightVar, float weight, const std::vector& flexCoefficients, + const QString& poleVectorEnabledVar, const QString& poleReferenceVectorVar, const QString& poleVectorVar); void computeAndCacheSplineJointInfosForIKTarget(const AnimContext& context, const IKTarget& target) const; const std::vector* findOrCreateSplineJointInfo(const AnimContext& context, const IKTarget& target) const; mutable std::map> _splineJointInfoMap; diff --git a/libraries/animation/src/Rig.cpp b/libraries/animation/src/Rig.cpp index 70f1f9a1f7..b92e095b4f 100644 --- a/libraries/animation/src/Rig.cpp +++ b/libraries/animation/src/Rig.cpp @@ -1857,14 +1857,14 @@ void Rig::updateFromControllerParameters(const ControllerParameters& params, flo updateHead(_headEnabled, hipsEnabled, params.primaryControllerPoses[PrimaryControllerType_Head]); - updateHands(leftHandEnabled, rightHandEnabled, hipsEnabled, hipsEstimated, leftArmEnabled, rightArmEnabled, _headEnabled, dt, - params.primaryControllerPoses[PrimaryControllerType_LeftHand], params.primaryControllerPoses[PrimaryControllerType_RightHand], - params.hipsShapeInfo, params.spineShapeInfo, params.spine1ShapeInfo, params.spine2ShapeInfo, - params.rigToSensorMatrix, sensorToRigMatrix); + //updateHands(leftHandEnabled, rightHandEnabled, hipsEnabled, hipsEstimated, leftArmEnabled, rightArmEnabled, _headEnabled, dt, + // params.primaryControllerPoses[PrimaryControllerType_LeftHand], params.primaryControllerPoses[PrimaryControllerType_RightHand], + // params.hipsShapeInfo, params.spineShapeInfo, params.spine1ShapeInfo, params.spine2ShapeInfo, + // params.rigToSensorMatrix, sensorToRigMatrix); - //updateHands2(leftHandEnabled, rightHandEnabled, _headEnabled, - // params.primaryControllerPoses[PrimaryControllerType_LeftHand], params.primaryControllerPoses[PrimaryControllerType_RightHand], - // params.rigToSensorMatrix, sensorToRigMatrix); + updateHands2(leftHandEnabled, rightHandEnabled, _headEnabled, + params.primaryControllerPoses[PrimaryControllerType_LeftHand], params.primaryControllerPoses[PrimaryControllerType_RightHand], + params.rigToSensorMatrix, sensorToRigMatrix); updateFeet(leftFootEnabled, rightFootEnabled, _headEnabled, params.primaryControllerPoses[PrimaryControllerType_LeftFoot], params.primaryControllerPoses[PrimaryControllerType_RightFoot], From e7941f78d67f99844697e8563957129e7e865c9a Mon Sep 17 00:00:00 2001 From: amantley Date: Thu, 24 Jan 2019 17:17:39 -0800 Subject: [PATCH 021/436] adding the shoulder rotation back in --- libraries/animation/src/AnimSplineIK.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/libraries/animation/src/AnimSplineIK.cpp b/libraries/animation/src/AnimSplineIK.cpp index afe9f6dfcb..1f135df120 100644 --- a/libraries/animation/src/AnimSplineIK.cpp +++ b/libraries/animation/src/AnimSplineIK.cpp @@ -125,8 +125,8 @@ const AnimPoseVec& AnimSplineIK::evaluate(const AnimVariantMap& animVars, const AnimPose afterSolveSecondaryTarget = _skeleton->getAbsolutePose(_secondaryTargetIndex, _poses); glm::quat secondaryTargetRotation = animVars.lookupRigToGeometry(_secondaryTargetRotationVar, afterSolveSecondaryTarget.rot()); - // updatedSecondaryTarget = AnimPose(secondaryTargetRotation, afterSolveSpine2.trans()); - updatedSecondaryTarget = AnimPose(afterSolveSecondaryTarget.rot(), afterSolveSecondaryTarget.trans()); + updatedSecondaryTarget = AnimPose(secondaryTargetRotation, afterSolveSecondaryTarget.trans()); + //updatedSecondaryTarget = AnimPose(afterSolveSecondaryTarget.rot(), afterSolveSecondaryTarget.trans()); } @@ -141,10 +141,10 @@ const AnimPoseVec& AnimSplineIK::evaluate(const AnimVariantMap& animVars, const secondaryTarget.setPose(updatedSecondaryTarget.rot(), updatedSecondaryTarget.trans()); secondaryTarget.setWeight(weight2); - const float* flexCoefficients2 = new float[3]{ 1.0f, 1.0f, 1.0f }; + const float* flexCoefficients2 = new float[3]{ 1.0f, 0.5f, 0.25f }; secondaryTarget.setFlexCoefficients(3, flexCoefficients2); } - /* + AnimChain secondaryJointChain; AnimPose beforeSolveChestNeck; if (_poses.size() > 0) { @@ -157,7 +157,7 @@ const AnimPoseVec& AnimSplineIK::evaluate(const AnimVariantMap& animVars, const secondaryJointChain.outputRelativePoses(_poses); } - */ + const float FRAMES_PER_SECOND = 30.0f; _interpAlphaVel = FRAMES_PER_SECOND / _interpDuration; @@ -183,9 +183,9 @@ const AnimPoseVec& AnimSplineIK::evaluate(const AnimVariantMap& animVars, const AnimPose finalNeckAbsolute = AnimPose(safeLerp(target2.getRotation(), target.getRotation(), 1.0f),neckAbsolute.trans()); _poses[headParent] = spine2Target.inverse() * beforeSolveChestNeck; */ - //AnimPose tipTarget(target.getRotation(),target.getTranslation()); - //AnimPose tipRelativePose = _skeleton->getAbsolutePose(tipParent,_poses).inverse() * headTarget; - //_poses[_tipJointIndex] = tipHeadRelativePose; + AnimPose tipTarget(target.getRotation(),target.getTranslation()); + AnimPose tipRelativePose = _skeleton->getAbsolutePose(tipParent,_poses).inverse() * tipTarget; + _poses[_tipJointIndex] = tipRelativePose; } // debug render ik targets From 2574e821840952b694c463ece9bfbb5fc27aa1b9 Mon Sep 17 00:00:00 2001 From: amantley Date: Thu, 24 Jan 2019 19:47:27 -0800 Subject: [PATCH 022/436] cleaned up print statements --- interface/src/avatar/MySkeletonModel.cpp | 5 +---- .../animation/src/AnimInverseKinematics.cpp | 21 +++++-------------- libraries/animation/src/AnimTwoBoneIK.cpp | 3 --- 3 files changed, 6 insertions(+), 23 deletions(-) diff --git a/interface/src/avatar/MySkeletonModel.cpp b/interface/src/avatar/MySkeletonModel.cpp index e0362ef548..356b365f93 100644 --- a/interface/src/avatar/MySkeletonModel.cpp +++ b/interface/src/avatar/MySkeletonModel.cpp @@ -199,7 +199,7 @@ void MySkeletonModel::updateRig(float deltaTime, glm::mat4 parentTransform) { // if hips are not under direct control, estimate the hips position. if (avatarHeadPose.isValid() && !(params.primaryControllerFlags[Rig::PrimaryControllerType_Hips] & (uint8_t)Rig::ControllerFlags::Enabled)) { bool isFlying = (myAvatar->getCharacterController()->getState() == CharacterController::State::Hover || myAvatar->getCharacterController()->computeCollisionGroup() == BULLET_COLLISION_GROUP_COLLISIONLESS); - + // timescale in seconds const float TRANS_HORIZ_TIMESCALE = 0.15f; const float TRANS_VERT_TIMESCALE = 0.01f; // We want the vertical component of the hips to follow quickly to prevent spine squash/stretch. @@ -255,9 +255,6 @@ void MySkeletonModel::updateRig(float deltaTime, glm::mat4 parentTransform) { AnimPose newSpinePose(glm::mat4(glm::vec4(w, 0.0f), glm::vec4(u, 0.0f), glm::vec4(v, 0.0f), glm::vec4(glm::vec3(0.0f, 0.0f, 0.0f), 1.0f))); currentSpine2Pose.rot() = safeLerp(currentSpine2Pose.rot(), newSpinePose.rot(), SPINE2_ROTATION_FILTER); params.primaryControllerPoses[Rig::PrimaryControllerType_Spine2] = currentSpine2Pose; - qCDebug(interfaceapp) << "finding the spine 2 azimuth"; - qCDebug(interfaceapp) << currentSpine2Pose; - params.primaryControllerFlags[Rig::PrimaryControllerType_Spine2] = (uint8_t)Rig::ControllerFlags::Enabled | (uint8_t)Rig::ControllerFlags::Estimated; } } diff --git a/libraries/animation/src/AnimInverseKinematics.cpp b/libraries/animation/src/AnimInverseKinematics.cpp index f95fe3333f..a1809f3438 100644 --- a/libraries/animation/src/AnimInverseKinematics.cpp +++ b/libraries/animation/src/AnimInverseKinematics.cpp @@ -237,7 +237,6 @@ void AnimInverseKinematics::solve(const AnimContext& context, const std::vector< // solve all targets for (size_t i = 0; i < targets.size(); i++) { - // qCDebug(animation) << "target id: " << targets[i].getIndex() << " and type " << (int)targets[i].getType(); switch (targets[i].getType()) { case IKTarget::Type::Unknown: break; @@ -259,7 +258,6 @@ void AnimInverseKinematics::solve(const AnimContext& context, const std::vector< // ease in expo alpha = 1.0f - powf(2.0f, -10.0f * alpha); - qCDebug(animation) << "the alpha for joint chains is " << alpha; size_t chainSize = std::min(_prevJointChainInfoVec[i].jointInfoVec.size(), jointChainInfoVec[i].jointInfoVec.size()); @@ -322,10 +320,6 @@ void AnimInverseKinematics::solve(const AnimContext& context, const std::vector< } } - //qCDebug(animation) << "joint chain pose for head animIK " << jointChainInfoVec[4].jointInfoVec[w].trans << " " << jointChainInfoVec[4].jointInfoVec[w].rot; - qCDebug(animation) << "absolute pose for head animIK " << absolutePoses[_skeleton->nameToJointIndex("Head")]; - qCDebug(animation) << "target pose for head animIK " << targets[4].getTranslation() << " " << targets[4].getRotation(); - // compute maxError maxError = 0.0f; for (size_t i = 0; i < targets.size(); i++) { @@ -366,7 +360,6 @@ void AnimInverseKinematics::solve(const AnimContext& context, const std::vector< // copy jointChainInfoVec into _prevJointChainInfoVec, and update timers for (size_t i = 0; i < jointChainInfoVec.size(); i++) { _prevJointChainInfoVec[i].timer = _prevJointChainInfoVec[i].timer - dt; - //qCDebug(animation) << "the alpha for joint chains is " << _prevJointChainInfoVec[i].timer; if (_prevJointChainInfoVec[i].timer <= 0.0f) { _prevJointChainInfoVec[i] = jointChainInfoVec[i]; _prevJointChainInfoVec[i].target = targets[i]; @@ -830,9 +823,7 @@ void AnimInverseKinematics::solveTargetWithSpline(const AnimContext& context, co AnimPose relPose = parentAbsPose.inverse() * flexedAbsPose; - bool constrained = false; - /* if (splineJointInfo.jointIndex != _hipsIndex) { // constrain the amount the spine can stretch or compress float length = glm::length(relPose.trans()); @@ -853,7 +844,7 @@ void AnimInverseKinematics::solveTargetWithSpline(const AnimContext& context, co relPose.trans() = glm::vec3(0.0f); } } - */ + jointChainInfoOut.jointInfoVec[i] = { relPose.rot(), relPose.trans(), splineJointInfo.jointIndex, constrained }; parentAbsPose = flexedAbsPose; @@ -878,6 +869,7 @@ const AnimPoseVec& AnimInverseKinematics::overlay(const AnimVariantMap& animVars // disable IK on android return underPoses; #endif + // allows solutionSource to be overridden by an animVar auto solutionSource = animVars.lookup(_solutionSourceVar, (int)_solutionSource); @@ -885,7 +877,7 @@ const AnimPoseVec& AnimInverseKinematics::overlay(const AnimVariantMap& animVars if (dt > MAX_OVERLAY_DT) { dt = MAX_OVERLAY_DT; } - + if (_relativePoses.size() != underPoses.size()) { loadPoses(underPoses); } else { @@ -1040,20 +1032,17 @@ const AnimPoseVec& AnimInverseKinematics::overlay(const AnimVariantMap& animVars preconditionRelativePosesToAvoidLimbLock(context, targets); - //qCDebug(animation) << "hips before ccd" << _relativePoses[_hipsIndex]; solve(context, targets, dt, jointChainInfoVec); - //qCDebug(animation) << "hips after ccd" << _relativePoses[_hipsIndex]; - } } - + if (context.getEnableDebugDrawIKConstraints()) { debugDrawConstraints(context); } } processOutputJoints(triggersOut); - + return _relativePoses; } diff --git a/libraries/animation/src/AnimTwoBoneIK.cpp b/libraries/animation/src/AnimTwoBoneIK.cpp index 31397157ac..3f8de488ff 100644 --- a/libraries/animation/src/AnimTwoBoneIK.cpp +++ b/libraries/animation/src/AnimTwoBoneIK.cpp @@ -50,7 +50,6 @@ const AnimPoseVec& AnimTwoBoneIK::evaluate(const AnimVariantMap& animVars, const if (_children.size() != 1) { return _poses; } - // evalute underPoses AnimPoseVec underPoses = _children[0]->evaluate(animVars, context, dt, triggersOut); @@ -79,7 +78,6 @@ const AnimPoseVec& AnimTwoBoneIK::evaluate(const AnimVariantMap& animVars, const // determine if we should interpolate bool enabled = animVars.lookup(_enabledVar, _enabled); - // qCDebug(animation) << "two bone var " << _enabledVar; if (enabled != _enabled) { AnimChain poseChain; poseChain.buildFromRelativePoses(_skeleton, _poses, _tipJointIndex); @@ -123,7 +121,6 @@ const AnimPoseVec& AnimTwoBoneIK::evaluate(const AnimVariantMap& animVars, const // First look in the triggers then look in the animVars, so we can follow output joints underneath us in the anim graph AnimPose targetPose(tipPose); if (triggersOut.hasKey(endEffectorRotationVar)) { - qCDebug(animation) << " end effector variable " << endEffectorRotationVar << " is " << triggersOut.lookupRigToGeometry(endEffectorRotationVar, tipPose.rot()); targetPose.rot() = triggersOut.lookupRigToGeometry(endEffectorRotationVar, tipPose.rot()); } else if (animVars.hasKey(endEffectorRotationVar)) { targetPose.rot() = animVars.lookupRigToGeometry(endEffectorRotationVar, tipPose.rot()); From bc635306ead7c5c6640aa652f936ae0a3fcab98f Mon Sep 17 00:00:00 2001 From: amantley Date: Thu, 24 Jan 2019 22:28:40 -0800 Subject: [PATCH 023/436] added interp from enabled to disabled and vice versa --- libraries/animation/src/AnimSplineIK.cpp | 107 +++++++++++++++++++---- libraries/animation/src/AnimSplineIK.h | 1 + 2 files changed, 93 insertions(+), 15 deletions(-) diff --git a/libraries/animation/src/AnimSplineIK.cpp b/libraries/animation/src/AnimSplineIK.cpp index 1f135df120..a036bb47a5 100644 --- a/libraries/animation/src/AnimSplineIK.cpp +++ b/libraries/animation/src/AnimSplineIK.cpp @@ -15,6 +15,7 @@ #include "AnimUtil.h" static const float JOINT_CHAIN_INTERP_TIME = 0.5f; +static const float FRAMES_PER_SECOND = 30.0f; AnimSplineIK::AnimSplineIK(const QString& id, float alpha, bool enabled, float interpDuration, const QString& baseJointName, @@ -66,10 +67,50 @@ const AnimPoseVec& AnimSplineIK::evaluate(const AnimVariantMap& animVars, const if (_children.size() != 1) { return _poses; } + + const float MIN_ALPHA = 0.0f; + const float MAX_ALPHA = 1.0f; + float alpha = glm::clamp(animVars.lookup(_alphaVar, _alpha), MIN_ALPHA, MAX_ALPHA); + // evaluate underPoses AnimPoseVec underPoses = _children[0]->evaluate(animVars, context, dt, triggersOut); + + // if we don't have a skeleton, or jointName lookup failed. + if (!_skeleton || _baseJointIndex == -1 || _tipJointIndex == -1 || alpha == 0.0f || underPoses.size() == 0) { + // pass underPoses through unmodified. + _poses = underPoses; + return _poses; + } + + // guard against size changes + if (underPoses.size() != _poses.size()) { + _poses = underPoses; + } + + // determine if we should interpolate + bool enabled = animVars.lookup(_enabledVar, _enabled); + if (enabled != _enabled) { + AnimChain poseChain; + poseChain.buildFromRelativePoses(_skeleton, _poses, _tipJointIndex); + if (enabled) { + beginInterp(InterpType::SnapshotToSolve, poseChain); + } else { + beginInterp(InterpType::SnapshotToUnderPoses, poseChain); + } + } + _enabled = enabled; + _poses = underPoses; + // don't build chains or do IK if we are disabled & not interping. + if (_interpType == InterpType::None && !enabled) { + return _poses; + } + + // compute under chain for possible interpolation + AnimChain underChain; + underChain.buildFromRelativePoses(_skeleton, underPoses, _tipJointIndex); + glm::quat hipsTargetRotation; glm::vec3 hipsTargetTranslation; @@ -113,8 +154,7 @@ const AnimPoseVec& AnimSplineIK::evaluate(const AnimVariantMap& animVars, const AnimPoseVec absolutePoses2; absolutePoses2.resize(_poses.size()); if (_poses.size() > 0) { - - //_snapshotChain.buildFromRelativePoses(_skeleton, _poses, target.getIndex()); + jointChain.buildFromRelativePoses(_skeleton, _poses, target.getIndex()); solveTargetWithSpline(context, target, absolutePoses, false, jointChain); jointChain.buildDirtyAbsolutePoses(); @@ -149,25 +189,13 @@ const AnimPoseVec& AnimSplineIK::evaluate(const AnimVariantMap& animVars, const AnimPose beforeSolveChestNeck; if (_poses.size() > 0) { - + beforeSolveChestNeck = _skeleton->getAbsolutePose(_skeleton->nameToJointIndex("Neck"), _poses); secondaryJointChain.buildFromRelativePoses(_skeleton, _poses, secondaryTarget.getIndex()); solveTargetWithSpline(context, secondaryTarget, absolutePoses2, false, secondaryJointChain); secondaryJointChain.outputRelativePoses(_poses); } - - - - const float FRAMES_PER_SECOND = 30.0f; - _interpAlphaVel = FRAMES_PER_SECOND / _interpDuration; - _alpha = _interpAlphaVel * dt; - // we need to blend the old joint chain with the current joint chain, otherwise known as: _snapShotChain - // we blend the chain info then we accumulate it then we assign to relative poses then we return the value. - // make the alpha - // make the prevchain - // interp from the previous chain to the new chain/or underposes if the ik is disabled. - // update the relative poses and then we are done // set the tip/head rotation to match the absolute rotation of the target. int tipParent = _skeleton->getParentIndex(_tipJointIndex); @@ -188,6 +216,46 @@ const AnimPoseVec& AnimSplineIK::evaluate(const AnimVariantMap& animVars, const _poses[_tipJointIndex] = tipRelativePose; } + // compute chain + AnimChain ikChain; + ikChain.buildFromRelativePoses(_skeleton, _poses, _tipJointIndex); + // blend with the underChain + ikChain.blend(underChain, alpha); + + // apply smooth interpolation when turning ik on and off + if (_interpType != InterpType::None) { + _interpAlpha += _interpAlphaVel * dt; + + // ease in expo + float easeInAlpha = 1.0f - powf(2.0f, -10.0f * _interpAlpha); + + if (_interpAlpha < 1.0f) { + AnimChain interpChain; + if (_interpType == InterpType::SnapshotToUnderPoses) { + interpChain = underChain; + interpChain.blend(_snapshotChain, easeInAlpha); + } else if (_interpType == InterpType::SnapshotToSolve) { + interpChain = ikChain; + interpChain.blend(_snapshotChain, easeInAlpha); + } + // copy interpChain into _poses + interpChain.outputRelativePoses(_poses); + } else { + // interpolation complete + _interpType = InterpType::None; + } + } + + if (_interpType == InterpType::None) { + if (enabled) { + // copy chain into _poses + ikChain.outputRelativePoses(_poses); + } else { + // copy under chain into _poses + underChain.outputRelativePoses(_poses); + } + } + // debug render ik targets if (context.getEnableDebugDrawIKTargets()) { const vec4 WHITE(1.0f); @@ -497,4 +565,13 @@ void AnimSplineIK::setTargetVars(const QString& jointName, const QString& positi _targetVarVec.push_back(targetVar); } */ +} + +void AnimSplineIK::beginInterp(InterpType interpType, const AnimChain& chain) { + // capture the current poses in a snapshot. + _snapshotChain = chain; + + _interpType = interpType; + _interpAlphaVel = FRAMES_PER_SECOND / _interpDuration; + _interpAlpha = 0.0f; } \ No newline at end of file diff --git a/libraries/animation/src/AnimSplineIK.h b/libraries/animation/src/AnimSplineIK.h index 4c51a0b9e1..d4dbb85a9e 100644 --- a/libraries/animation/src/AnimSplineIK.h +++ b/libraries/animation/src/AnimSplineIK.h @@ -49,6 +49,7 @@ protected: virtual void setSkeletonInternal(AnimSkeleton::ConstPointer skeleton) override; void lookUpIndices(); + void beginInterp(InterpType interpType, const AnimChain& chain); AnimPoseVec _poses; From 71df61498997afb1d0e64a9b0d690630ed92ab47 Mon Sep 17 00:00:00 2001 From: amantley Date: Fri, 25 Jan 2019 11:28:37 -0800 Subject: [PATCH 024/436] put all the hand update code in one function that works for two bone IK and legacy animInverseKinematics Ik --- libraries/animation/src/AnimSplineIK.cpp | 13 +++---- libraries/animation/src/Rig.cpp | 45 +++++++++++++++++++----- 2 files changed, 43 insertions(+), 15 deletions(-) diff --git a/libraries/animation/src/AnimSplineIK.cpp b/libraries/animation/src/AnimSplineIK.cpp index a036bb47a5..bb3ec654f5 100644 --- a/libraries/animation/src/AnimSplineIK.cpp +++ b/libraries/animation/src/AnimSplineIK.cpp @@ -189,7 +189,7 @@ const AnimPoseVec& AnimSplineIK::evaluate(const AnimVariantMap& animVars, const AnimPose beforeSolveChestNeck; if (_poses.size() > 0) { - + // fix this to deal with no neck AA beforeSolveChestNeck = _skeleton->getAbsolutePose(_skeleton->nameToJointIndex("Neck"), _poses); secondaryJointChain.buildFromRelativePoses(_skeleton, _poses, secondaryTarget.getIndex()); @@ -205,12 +205,13 @@ const AnimPoseVec& AnimSplineIK::evaluate(const AnimVariantMap& animVars, const AnimPose secondaryTargetPose(target2.getRotation(), target2.getTranslation()); AnimPose secondaryTargetRelativePose = _skeleton->getAbsolutePose(secondaryTargetParent, _poses).inverse() * secondaryTargetPose; _poses[_secondaryTargetIndex] = secondaryTargetRelativePose; - - - AnimPose neckAbsolute = _skeleton->getAbsolutePose(tipParent, _poses); - AnimPose finalNeckAbsolute = AnimPose(safeLerp(target2.getRotation(), target.getRotation(), 1.0f),neckAbsolute.trans()); - _poses[headParent] = spine2Target.inverse() * beforeSolveChestNeck; */ + + AnimPose secondaryTargetPose(secondaryTarget.getRotation(), secondaryTarget.getTranslation()); + AnimPose neckAbsolute = _skeleton->getAbsolutePose(tipParent, _poses); + //AnimPose finalNeckAbsolute = AnimPose(safeLerp(target2.getRotation(), target.getRotation(), 1.0f),neckAbsolute.trans()); + _poses[tipParent] = secondaryTargetPose.inverse() * beforeSolveChestNeck; + AnimPose tipTarget(target.getRotation(),target.getTranslation()); AnimPose tipRelativePose = _skeleton->getAbsolutePose(tipParent,_poses).inverse() * tipTarget; _poses[_tipJointIndex] = tipRelativePose; diff --git a/libraries/animation/src/Rig.cpp b/libraries/animation/src/Rig.cpp index b92e095b4f..9e2e099cfe 100644 --- a/libraries/animation/src/Rig.cpp +++ b/libraries/animation/src/Rig.cpp @@ -1271,6 +1271,7 @@ void Rig::computeHeadFromHMD(const AnimPose& hmdPose, glm::vec3& headPositionOut void Rig::updateHead(bool headEnabled, bool hipsEnabled, const AnimPose& headPose) { if (_animSkeleton) { if (headEnabled) { + _animVars.set("splineIKEnabled", true); _animVars.set("headPosition", headPose.trans()); _animVars.set("headRotation", headPose.rot()); if (hipsEnabled) { @@ -1285,6 +1286,7 @@ void Rig::updateHead(bool headEnabled, bool hipsEnabled, const AnimPose& headPos _animVars.set("headWeight", 8.0f); } } else { + _animVars.set("splineIKEnabled", false); _animVars.unset("headPosition"); _animVars.set("headRotation", headPose.rot()); _animVars.set("headType", (int)IKTarget::Type::RotationOnly); @@ -1416,8 +1418,22 @@ void Rig::updateHands(bool leftHandEnabled, bool rightHandEnabled, bool hipsEnab const bool ENABLE_POLE_VECTORS = true; + if (headEnabled) { + // always do IK if head is enabled + _animVars.set("leftHandIKEnabled", true); + _animVars.set("rightHandIKEnabled", true); + } else { + // only do IK if we have a valid foot. + _animVars.set("leftHandIKEnabled", leftHandEnabled); + _animVars.set("rightHandIKEnabled", rightHandEnabled); + } + if (leftHandEnabled) { + // we need this for twoBoneIK version of hands. + _animVars.set(LEFT_HAND_IK_POSITION_VAR, LEFT_HAND_POSITION); + _animVars.set(LEFT_HAND_IK_ROTATION_VAR, LEFT_HAND_ROTATION); + glm::vec3 handPosition = leftHandPose.trans(); glm::quat handRotation = leftHandPose.rot(); @@ -1450,8 +1466,11 @@ void Rig::updateHands(bool leftHandEnabled, bool rightHandEnabled, bool hipsEnab _animVars.set("leftHandPoleVectorEnabled", false); } } else { + // need this for two bone ik + _animVars.set(LEFT_HAND_IK_POSITION_VAR, MAIN_STATE_MACHINE_LEFT_HAND_POSITION); + _animVars.set(LEFT_HAND_IK_ROTATION_VAR, MAIN_STATE_MACHINE_LEFT_HAND_ROTATION); + _animVars.set("leftHandPoleVectorEnabled", false); - _animVars.unset("leftHandPosition"); _animVars.unset("leftHandRotation"); @@ -1465,6 +1484,10 @@ void Rig::updateHands(bool leftHandEnabled, bool rightHandEnabled, bool hipsEnab if (rightHandEnabled) { + // need this for two bone IK + _animVars.set(RIGHT_HAND_IK_POSITION_VAR, RIGHT_HAND_POSITION); + _animVars.set(RIGHT_HAND_IK_ROTATION_VAR, RIGHT_HAND_ROTATION); + glm::vec3 handPosition = rightHandPose.trans(); glm::quat handRotation = rightHandPose.rot(); @@ -1498,8 +1521,12 @@ void Rig::updateHands(bool leftHandEnabled, bool rightHandEnabled, bool hipsEnab _animVars.set("rightHandPoleVectorEnabled", false); } } else { - _animVars.set("rightHandPoleVectorEnabled", false); + // need this for two bone IK + _animVars.set(RIGHT_HAND_IK_POSITION_VAR, MAIN_STATE_MACHINE_RIGHT_HAND_POSITION); + _animVars.set(RIGHT_HAND_IK_ROTATION_VAR, MAIN_STATE_MACHINE_RIGHT_HAND_ROTATION); + + _animVars.set("rightHandPoleVectorEnabled", false); _animVars.unset("rightHandPosition"); _animVars.unset("rightHandRotation"); @@ -1857,14 +1884,14 @@ void Rig::updateFromControllerParameters(const ControllerParameters& params, flo updateHead(_headEnabled, hipsEnabled, params.primaryControllerPoses[PrimaryControllerType_Head]); - //updateHands(leftHandEnabled, rightHandEnabled, hipsEnabled, hipsEstimated, leftArmEnabled, rightArmEnabled, _headEnabled, dt, - // params.primaryControllerPoses[PrimaryControllerType_LeftHand], params.primaryControllerPoses[PrimaryControllerType_RightHand], - // params.hipsShapeInfo, params.spineShapeInfo, params.spine1ShapeInfo, params.spine2ShapeInfo, - // params.rigToSensorMatrix, sensorToRigMatrix); + updateHands(leftHandEnabled, rightHandEnabled, hipsEnabled, hipsEstimated, leftArmEnabled, rightArmEnabled, _headEnabled, dt, + params.primaryControllerPoses[PrimaryControllerType_LeftHand], params.primaryControllerPoses[PrimaryControllerType_RightHand], + params.hipsShapeInfo, params.spineShapeInfo, params.spine1ShapeInfo, params.spine2ShapeInfo, + params.rigToSensorMatrix, sensorToRigMatrix); - updateHands2(leftHandEnabled, rightHandEnabled, _headEnabled, - params.primaryControllerPoses[PrimaryControllerType_LeftHand], params.primaryControllerPoses[PrimaryControllerType_RightHand], - params.rigToSensorMatrix, sensorToRigMatrix); + //updateHands2(leftHandEnabled, rightHandEnabled, _headEnabled, + // params.primaryControllerPoses[PrimaryControllerType_LeftHand], params.primaryControllerPoses[PrimaryControllerType_RightHand], + // params.rigToSensorMatrix, sensorToRigMatrix); updateFeet(leftFootEnabled, rightFootEnabled, _headEnabled, params.primaryControllerPoses[PrimaryControllerType_LeftFoot], params.primaryControllerPoses[PrimaryControllerType_RightFoot], From 992820cd674dfc37fc31c8517b81bf1ecc4e5e3e Mon Sep 17 00:00:00 2001 From: amantley Date: Fri, 25 Jan 2019 11:34:18 -0800 Subject: [PATCH 025/436] removed unnecessary hand update function for two bone IK --- libraries/animation/src/Rig.cpp | 102 -------------------------------- libraries/animation/src/Rig.h | 3 - 2 files changed, 105 deletions(-) diff --git a/libraries/animation/src/Rig.cpp b/libraries/animation/src/Rig.cpp index 9e2e099cfe..7a6a1530d7 100644 --- a/libraries/animation/src/Rig.cpp +++ b/libraries/animation/src/Rig.cpp @@ -1539,104 +1539,6 @@ void Rig::updateHands(bool leftHandEnabled, bool rightHandEnabled, bool hipsEnab } } -void Rig::updateHands2(bool leftHandEnabled, bool rightHandEnabled, bool headEnabled, - const AnimPose& leftHandPose, const AnimPose& rightHandPose, - const glm::mat4& rigToSensorMatrix, const glm::mat4& sensorToRigMatrix) { - - int hipsIndex = indexOfJoint("Hips"); - const float ELBOW_POLE_VECTOR_BLEND_FACTOR = 0.85f; - - if (headEnabled) { - // always do IK if head is enabled - _animVars.set("leftHandIKEnabled", true); - _animVars.set("rightHandIKEnabled", true); - } else { - // only do IK if we have a valid foot. - _animVars.set("leftHandIKEnabled", leftHandEnabled); - _animVars.set("rightHandIKEnabled", rightHandEnabled); - } - - if (leftHandEnabled) { - - _animVars.set(LEFT_HAND_POSITION, leftHandPose.trans()); - _animVars.set(LEFT_HAND_ROTATION, leftHandPose.rot()); - - // We want to drive the IK directly from the trackers. - _animVars.set(LEFT_HAND_IK_POSITION_VAR, LEFT_HAND_POSITION); - _animVars.set(LEFT_HAND_IK_ROTATION_VAR, LEFT_HAND_ROTATION); - - int handJointIndex = _animSkeleton->nameToJointIndex("LeftHand"); - int elbowJointIndex = _animSkeleton->nameToJointIndex("LeftForeArm"); - int shoulderJointIndex = _animSkeleton->nameToJointIndex("LeftArm"); - int oppositeArmJointIndex = _animSkeleton->nameToJointIndex("RightArm"); - glm::vec3 poleVector; - bool usePoleVector = calculateElbowPoleVector(handJointIndex, elbowJointIndex, shoulderJointIndex, oppositeArmJointIndex, poleVector); - //glm::vec3 poleVector = calculateKneePoleVector(handJointIndex, elbowJointIndex, shoulderJointIndex, hipsIndex, rightHandPose); - glm::vec3 sensorPoleVector = transformVectorFast(rigToSensorMatrix, poleVector); - - // smooth toward desired pole vector from previous pole vector... to reduce jitter, but in sensor space. - if (!_prevLeftHandPoleVectorValid) { - _prevLeftHandPoleVectorValid = true; - _prevLeftHandPoleVector = sensorPoleVector; - } - glm::quat deltaRot = rotationBetween(_prevLeftHandPoleVector, sensorPoleVector); - glm::quat smoothDeltaRot = safeMix(deltaRot, Quaternions::IDENTITY, ELBOW_POLE_VECTOR_BLEND_FACTOR); - _prevLeftHandPoleVector = smoothDeltaRot * _prevLeftHandPoleVector; - - _animVars.set("leftHandPoleVectorEnabled", true); - _animVars.set("leftHandPoleVector", transformVectorFast(sensorToRigMatrix, _prevLeftHandPoleVector)); - } else { - // We want to drive the IK from the underlying animation. - // This gives us the ability to squat while in the HMD, without the feet from dipping under the floor. - _animVars.set(LEFT_HAND_IK_POSITION_VAR, MAIN_STATE_MACHINE_LEFT_HAND_POSITION); - _animVars.set(LEFT_HAND_IK_ROTATION_VAR, MAIN_STATE_MACHINE_LEFT_HAND_ROTATION); - - // We want to match the animated knee pose as close as possible, so don't use poleVectors - _animVars.set("leftHandPoleVectorEnabled", false); - _prevLeftHandPoleVectorValid = false; - } - - if (rightHandEnabled) { - - _animVars.set(RIGHT_HAND_POSITION, rightHandPose.trans()); - _animVars.set(RIGHT_HAND_ROTATION, rightHandPose.rot()); - - // We want to drive the IK directly from the trackers. - _animVars.set(RIGHT_HAND_IK_POSITION_VAR, RIGHT_HAND_POSITION); - _animVars.set(RIGHT_HAND_IK_ROTATION_VAR, RIGHT_HAND_ROTATION); - - int handJointIndex = _animSkeleton->nameToJointIndex("RightHand"); - int elbowJointIndex = _animSkeleton->nameToJointIndex("RightForeArm"); - int shoulderJointIndex = _animSkeleton->nameToJointIndex("RightArm"); - int oppositeArmJointIndex = _animSkeleton->nameToJointIndex("LeftArm"); - glm::vec3 poleVector; - bool usePoleVector = calculateElbowPoleVector(handJointIndex, elbowJointIndex, shoulderJointIndex, oppositeArmJointIndex, poleVector); - glm::vec3 sensorPoleVector = transformVectorFast(rigToSensorMatrix, poleVector); - - // smooth toward desired pole vector from previous pole vector... to reduce jitter, but in sensor space. - if (!_prevRightHandPoleVectorValid) { - _prevRightHandPoleVectorValid = true; - _prevRightHandPoleVector = sensorPoleVector; - } - glm::quat deltaRot = rotationBetween(_prevRightHandPoleVector, sensorPoleVector); - glm::quat smoothDeltaRot = safeMix(deltaRot, Quaternions::IDENTITY, ELBOW_POLE_VECTOR_BLEND_FACTOR); - _prevRightHandPoleVector = smoothDeltaRot * _prevRightHandPoleVector; - - _animVars.set("rightHandPoleVectorEnabled", true); - _animVars.set("rightHandPoleVector", transformVectorFast(sensorToRigMatrix, _prevRightHandPoleVector)); - } else { - // We want to drive the IK from the underlying animation. - // This gives us the ability to squat while in the HMD, without the feet from dipping under the floor. - _animVars.set(RIGHT_HAND_IK_POSITION_VAR, MAIN_STATE_MACHINE_RIGHT_HAND_POSITION); - _animVars.set(RIGHT_HAND_IK_ROTATION_VAR, MAIN_STATE_MACHINE_RIGHT_HAND_ROTATION); - - // We want to match the animated knee pose as close as possible, so don't use poleVectors - _animVars.set("rightHandPoleVectorEnabled", false); - _prevRightHandPoleVectorValid = false; - } - -} - void Rig::updateFeet(bool leftFootEnabled, bool rightFootEnabled, bool headEnabled, const AnimPose& leftFootPose, const AnimPose& rightFootPose, const glm::mat4& rigToSensorMatrix, const glm::mat4& sensorToRigMatrix) { @@ -1889,10 +1791,6 @@ void Rig::updateFromControllerParameters(const ControllerParameters& params, flo params.hipsShapeInfo, params.spineShapeInfo, params.spine1ShapeInfo, params.spine2ShapeInfo, params.rigToSensorMatrix, sensorToRigMatrix); - //updateHands2(leftHandEnabled, rightHandEnabled, _headEnabled, - // params.primaryControllerPoses[PrimaryControllerType_LeftHand], params.primaryControllerPoses[PrimaryControllerType_RightHand], - // params.rigToSensorMatrix, sensorToRigMatrix); - updateFeet(leftFootEnabled, rightFootEnabled, _headEnabled, params.primaryControllerPoses[PrimaryControllerType_LeftFoot], params.primaryControllerPoses[PrimaryControllerType_RightFoot], params.rigToSensorMatrix, sensorToRigMatrix); diff --git a/libraries/animation/src/Rig.h b/libraries/animation/src/Rig.h index e6effe9e53..7468e9f6f9 100644 --- a/libraries/animation/src/Rig.h +++ b/libraries/animation/src/Rig.h @@ -250,9 +250,6 @@ protected: const HFMJointShapeInfo& hipsShapeInfo, const HFMJointShapeInfo& spineShapeInfo, const HFMJointShapeInfo& spine1ShapeInfo, const HFMJointShapeInfo& spine2ShapeInfo, const glm::mat4& rigToSensorMatrix, const glm::mat4& sensorToRigMatrix); - void updateHands2(bool leftHandEnabled, bool rightHandEnabled, bool headEnabled, - const AnimPose& leftHandPose, const AnimPose& rightHandPose, - const glm::mat4& rigToSensorMatrix, const glm::mat4& sensorToRigMatrix); void updateFeet(bool leftFootEnabled, bool rightFootEnabled, bool headEnabled, const AnimPose& leftFootPose, const AnimPose& rightFootPose, const glm::mat4& rigToSensorMatrix, const glm::mat4& sensorToRigMatrix); From bede1d9b00b214f890c8cd1c389a31a32c33dbd4 Mon Sep 17 00:00:00 2001 From: Howard Stearns Date: Fri, 25 Jan 2019 11:50:46 -0800 Subject: [PATCH 026/436] make nfs label fit in button --- scripts/system/html/js/marketplacesInject.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/scripts/system/html/js/marketplacesInject.js b/scripts/system/html/js/marketplacesInject.js index aafdc65606..d27387c6e8 100644 --- a/scripts/system/html/js/marketplacesInject.js +++ b/scripts/system/html/js/marketplacesInject.js @@ -258,12 +258,13 @@ priceElement.text() === 'not for sale') { available = false; priceElement.css({ - "padding": "3px 5px 10px 5px", + "padding": "3px 5px", "height": "40px", + "width": "100px", "background": "linear-gradient(#a2a2a2, #fefefe)", "color": "#000", "font-weight": "600", - "line-height": "34px" + "line-height": "20px" }); } else { priceElement.css({ From 52a43ca4cdfbb4dcbfca484beff662413edae5ce Mon Sep 17 00:00:00 2001 From: Howard Stearns Date: Fri, 25 Jan 2019 14:09:00 -0800 Subject: [PATCH 027/436] support artist's stocking to inventory --- .../qml/hifi/commerce/checkout/Checkout.qml | 55 ++++++++++++------- 1 file changed, 34 insertions(+), 21 deletions(-) diff --git a/interface/resources/qml/hifi/commerce/checkout/Checkout.qml b/interface/resources/qml/hifi/commerce/checkout/Checkout.qml index c76f5a428a..2c2d23964b 100644 --- a/interface/resources/qml/hifi/commerce/checkout/Checkout.qml +++ b/interface/resources/qml/hifi/commerce/checkout/Checkout.qml @@ -33,15 +33,19 @@ Rectangle { property bool balanceReceived: false; property bool availableUpdatesReceived: false; property bool itemInfoReceived: false; + property bool dataReady: itemInfoReceived && ownershipStatusReceived && balanceReceived && availableUpdatesReceived; property string baseItemName: ""; property string itemName; property string itemId; property string itemHref; property string itemAuthor; property int itemEdition: -1; + property bool hasSomethingToTradeIn: alreadyOwned && (itemEdition > 0); // i.e., don't trade in your artist's proof + property bool isTradingIn: isUpdating && hasSomethingToTradeIn; + property bool isStocking: availability === 'not for sale' && creator === Account.username; property string certificateId; property double balanceAfterPurchase; - property bool alreadyOwned: false; + property bool alreadyOwned: false; // Including proofs property int itemPrice: -1; property bool isCertified; property string itemType: "unknown"; @@ -56,6 +60,8 @@ Rectangle { property string referrer; property bool isInstalled; property bool isUpdating; + property string availability: "available"; + property string creator: ""; property string baseAppURL; property int currentUpdatesPage: 1; // Style @@ -454,10 +460,10 @@ Rectangle { height: 30; width: itemPriceTextLabel.width + itemPriceText.width + 20; - // "HFC" balance label + // "HFC" label HiFiGlyphs { id: itemPriceTextLabel; - visible: !(root.isUpdating && root.itemEdition > 0) && (root.itemPrice > 0); + visible: !isTradingIn && (root.itemPrice > 0); text: hifi.glyphs.hfc; // Size size: 30; @@ -473,9 +479,11 @@ Rectangle { } FiraSansSemiBold { id: itemPriceText; - text: (root.isUpdating && root.itemEdition > 0) ? "FREE\nUPDATE" : ((root.itemPrice === -1) ? "--" : ((root.itemPrice > 0) ? root.itemPrice : "FREE")); + text: isTradingIn ? "FREE\nUPDATE" : + (isStocking ? "Free for creator" : + ((root.itemPrice === -1) ? "--" : ((root.itemPrice > 0) ? root.itemPrice : "FREE"))); // Text size - size: (root.isUpdating && root.itemEdition > 0) ? 20 : 26; + size: isTradingIn ? 20 : 26; // Anchors anchors.top: parent.top; anchors.right: parent.right; @@ -571,7 +579,7 @@ Rectangle { // "View in Inventory" button HifiControlsUit.Button { id: viewInMyPurchasesButton; - visible: false; + visible: isCertified && dataReady && (isUpdating ? !hasSomethingToTradeIn : alreadyOwned); color: hifi.buttons.blue; colorScheme: hifi.colorSchemes.light; anchors.top: buyTextContainer.visible ? buyTextContainer.bottom : checkoutActionButtonsContainer.top; @@ -592,8 +600,8 @@ Rectangle { // "Buy" button HifiControlsUit.Button { id: buyButton; - visible: !((root.itemType === "avatar" || root.itemType === "app") && viewInMyPurchasesButton.visible) - enabled: (root.balanceAfterPurchase >= 0 && ownershipStatusReceived && balanceReceived && availableUpdatesReceived) || (!root.isCertified) || root.isUpdating; + visible: isTradingIn || !alreadyOwned || isStocking || !(root.itemType === "avatar" || root.itemType === "app"); + enabled: (root.balanceAfterPurchase >= 0 && dataReady) || (!root.isCertified) || root.isUpdating; color: viewInMyPurchasesButton.visible ? hifi.buttons.white : hifi.buttons.blue; colorScheme: hifi.colorSchemes.light; anchors.top: viewInMyPurchasesButton.visible ? viewInMyPurchasesButton.bottom : @@ -602,10 +610,15 @@ Rectangle { height: 50; anchors.left: parent.left; anchors.right: parent.right; - text: (root.isUpdating && root.itemEdition > 0) ? "CONFIRM UPDATE" : (((root.isCertified) ? ((ownershipStatusReceived && balanceReceived && availableUpdatesReceived) ? - ((viewInMyPurchasesButton.visible && !root.isUpdating) ? "Get It Again" : "Confirm") : "--") : "Get Item")); + text: isTradingIn ? + "CONFIRM UPDATE" : + (((root.isCertified) ? + (dataReady ? + ((viewInMyPurchasesButton.visible && !root.isUpdating) ? "Get It Again" : "Confirm") : + "--") : + "Get Item")); onClicked: { - if (root.isUpdating && root.itemEdition > 0) { + if (isTradingIn) { // If we're updating an app, the existing app needs to be uninstalled. // This call will fail/return `false` if the app isn't installed, but that's OK. if (root.itemType === "app") { @@ -1063,7 +1076,11 @@ Rectangle { buyButton.color = hifi.buttons.red; root.shouldBuyWithControlledFailure = true; } else { - buyButton.text = (root.isCertified ? ((ownershipStatusReceived && balanceReceived && availableUpdatesReceived) ? (root.alreadyOwned ? "Buy Another" : "Buy"): "--") : "Get Item"); + buyButton.text = (root.isCertified ? + (dataReady ? + (root.alreadyOwned ? "Buy Another" : "Buy") : + "--") : + "Get Item"); buyButton.color = hifi.buttons.blue; root.shouldBuyWithControlledFailure = false; } @@ -1091,6 +1108,8 @@ Rectangle { root.itemPrice = result.data.cost; root.itemAuthor = result.data.creator; root.itemType = result.data.item_type || "unknown"; + root.availability = result.data.availability; + root.creator = result.data.creator; if (root.itemType === "unknown") { root.itemHref = result.data.review_url; } else { @@ -1139,7 +1158,7 @@ Rectangle { signal sendToScript(var message); function canBuyAgain() { - return (root.itemType === "entity" || root.itemType === "wearable" || root.itemType === "contentSet" || root.itemType === "unknown"); + return root.itemType === "entity" || root.itemType === "wearable" || root.itemType === "contentSet" || root.itemType === "unknown" || isStocking; } function handleContentSets() { @@ -1185,29 +1204,23 @@ Rectangle { function refreshBuyUI() { if (root.isCertified) { - if (root.ownershipStatusReceived && root.balanceReceived && root.availableUpdatesReceived) { + if (dataReady) { buyText.text = ""; // If the user IS on the checkout page for the updated version of an owned item... if (root.isUpdating) { // If the user HAS already selected a specific edition to update... - if (root.itemEdition > 0) { + if (hasSomethingToTradeIn) { buyText.text = "By pressing \"Confirm Update\", you agree to trade in your old item for the updated item that replaces it."; buyTextContainer.color = "#FFFFFF"; buyTextContainer.border.color = "#FFFFFF"; // Else if the user HAS NOT selected a specific edition to update... } else { - viewInMyPurchasesButton.visible = true; - handleBuyAgainLogic(); } // If the user IS NOT on the checkout page for the updated verison of an owned item... // (i.e. they are checking out an item "normally") } else { - if (root.alreadyOwned) { - viewInMyPurchasesButton.visible = true; - } - handleBuyAgainLogic(); } } else { From 49a3a13d5721f38777f1685ccc828fe42d76fa80 Mon Sep 17 00:00:00 2001 From: Howard Stearns Date: Fri, 25 Jan 2019 14:13:58 -0800 Subject: [PATCH 028/436] use space a bit better --- .../resources/qml/hifi/commerce/checkout/Checkout.qml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/interface/resources/qml/hifi/commerce/checkout/Checkout.qml b/interface/resources/qml/hifi/commerce/checkout/Checkout.qml index 2c2d23964b..700459032f 100644 --- a/interface/resources/qml/hifi/commerce/checkout/Checkout.qml +++ b/interface/resources/qml/hifi/commerce/checkout/Checkout.qml @@ -440,7 +440,7 @@ Rectangle { anchors.top: parent.top; anchors.left: itemPreviewImage.right; anchors.leftMargin: 12; - anchors.right: itemPriceContainer.left; + anchors.right: parent.right; anchors.rightMargin: 8; height: 30; // Style @@ -455,10 +455,11 @@ Rectangle { Item { id: itemPriceContainer; // Anchors - anchors.top: parent.top; - anchors.right: parent.right; + anchors.top: itemNameText.bottom; + anchors.topMargin: 8; + anchors.left: itemNameText.left; height: 30; - width: itemPriceTextLabel.width + itemPriceText.width + 20; + width: itemPriceText.width + 20; // "HFC" label HiFiGlyphs { From 446d7b9514e6b1b87384b78b99e984d6f48134ee Mon Sep 17 00:00:00 2001 From: amantley Date: Fri, 25 Jan 2019 14:41:18 -0800 Subject: [PATCH 029/436] added the flex coeff for the primary and secondary spline targets to the json --- .../avatar/avatar-animation_withIKNode.json | 4 ++- libraries/animation/src/AnimNodeLoader.cpp | 5 +++- libraries/animation/src/AnimSplineIK.cpp | 30 ++++++++++++++++--- libraries/animation/src/AnimSplineIK.h | 12 +++++++- 4 files changed, 44 insertions(+), 7 deletions(-) diff --git a/interface/resources/avatar/avatar-animation_withIKNode.json b/interface/resources/avatar/avatar-animation_withIKNode.json index 04ed593755..13c102a5f1 100644 --- a/interface/resources/avatar/avatar-animation_withIKNode.json +++ b/interface/resources/avatar/avatar-animation_withIKNode.json @@ -193,7 +193,9 @@ "alphaVar": "splineIKAlpha", "enabledVar": "splineIKEnabled", "endEffectorRotationVarVar": "splineIKRotationVar", - "endEffectorPositionVarVar": "splineIKPositionVar" + "endEffectorPositionVarVar": "splineIKPositionVar", + "primaryFlexCoefficients": "1, 0.5, 0.25, 0.2, 0.1", + "secondaryFlexCoefficients": "1.0, 0.5, 0.25" }, "children": [ { diff --git a/libraries/animation/src/AnimNodeLoader.cpp b/libraries/animation/src/AnimNodeLoader.cpp index ebe9dbe3ba..c5d17e8884 100644 --- a/libraries/animation/src/AnimNodeLoader.cpp +++ b/libraries/animation/src/AnimNodeLoader.cpp @@ -596,12 +596,15 @@ static AnimNode::Pointer loadSplineIKNode(const QJsonObject& jsonObj, const QStr READ_STRING(enabledVar, jsonObj, id, jsonUrl, nullptr); READ_STRING(endEffectorRotationVarVar, jsonObj, id, jsonUrl, nullptr); READ_STRING(endEffectorPositionVarVar, jsonObj, id, jsonUrl, nullptr); + READ_STRING(primaryFlexCoefficients, jsonObj, id, jsonUrl, nullptr); + READ_STRING(secondaryFlexCoefficients, jsonObj, id, jsonUrl, nullptr); auto node = std::make_shared(id, alpha, enabled, interpDuration, baseJointName, tipJointName, alphaVar, enabledVar, endEffectorRotationVarVar, endEffectorPositionVarVar, basePositionVar, baseRotationVar, - tipPositionVar, tipRotationVar, secondaryTargetJointName, secondaryTargetPositionVar, secondaryTargetRotationVar); + tipPositionVar, tipRotationVar, secondaryTargetJointName, secondaryTargetPositionVar, + secondaryTargetRotationVar, primaryFlexCoefficients, secondaryFlexCoefficients); return node; } diff --git a/libraries/animation/src/AnimSplineIK.cpp b/libraries/animation/src/AnimSplineIK.cpp index bb3ec654f5..658fa2cf6a 100644 --- a/libraries/animation/src/AnimSplineIK.cpp +++ b/libraries/animation/src/AnimSplineIK.cpp @@ -28,7 +28,9 @@ AnimSplineIK::AnimSplineIK(const QString& id, float alpha, bool enabled, float i const QString& tipRotationVar, const QString& secondaryTargetJointName, const QString& secondaryTargetPositionVar, - const QString& secondaryTargetRotationVar) : + const QString& secondaryTargetRotationVar, + const QString& primaryFlexCoefficients, + const QString& secondaryFlexCoefficients) : AnimNode(AnimNode::Type::SplineIK, id), _alpha(alpha), _enabled(enabled), @@ -47,8 +49,25 @@ AnimSplineIK::AnimSplineIK(const QString& id, float alpha, bool enabled, float i _tipRotationVar(tipRotationVar), _secondaryTargetJointName(secondaryTargetJointName), _secondaryTargetPositionVar(secondaryTargetPositionVar), - _secondaryTargetRotationVar(secondaryTargetRotationVar) + _secondaryTargetRotationVar(secondaryTargetRotationVar) { + + QStringList flexCoefficientsValues = primaryFlexCoefficients.split(',', QString::SkipEmptyParts); + for (int i = 0; i < flexCoefficientsValues.size(); i++) { + if (i < MAX_NUMBER_FLEX_VARIABLES) { + qCDebug(animation) << "flex value " << flexCoefficientsValues[i].toDouble(); + _primaryFlexCoefficients[i] = (float)flexCoefficientsValues[i].toDouble(); + } + } + _numPrimaryFlexCoefficients = std::min(flexCoefficientsValues.size(), MAX_NUMBER_FLEX_VARIABLES); + QStringList secondaryFlexCoefficientsValues = secondaryFlexCoefficients.split(',', QString::SkipEmptyParts); + for (int i = 0; i < secondaryFlexCoefficientsValues.size(); i++) { + if (i < MAX_NUMBER_FLEX_VARIABLES) { + qCDebug(animation) << "secondaryflex value " << secondaryFlexCoefficientsValues[i].toDouble(); + _secondaryFlexCoefficients[i] = (float)secondaryFlexCoefficientsValues[i].toDouble(); + } + } + _numSecondaryFlexCoefficients = std::min(secondaryFlexCoefficientsValues.size(), MAX_NUMBER_FLEX_VARIABLES); } @@ -145,8 +164,11 @@ const AnimPoseVec& AnimSplineIK::evaluate(const AnimVariantMap& animVars, const target.setPose(rotation, translation); target.setWeight(weight); + + + const float* flexCoefficients = new float[5]{ 1.0f, 0.5f, 0.25f, 0.2f, 0.1f }; - target.setFlexCoefficients(5, flexCoefficients); + target.setFlexCoefficients(_numPrimaryFlexCoefficients, _primaryFlexCoefficients); } AnimChain jointChain; @@ -182,7 +204,7 @@ const AnimPoseVec& AnimSplineIK::evaluate(const AnimVariantMap& animVars, const secondaryTarget.setWeight(weight2); const float* flexCoefficients2 = new float[3]{ 1.0f, 0.5f, 0.25f }; - secondaryTarget.setFlexCoefficients(3, flexCoefficients2); + secondaryTarget.setFlexCoefficients(_numSecondaryFlexCoefficients, _secondaryFlexCoefficients); } AnimChain secondaryJointChain; diff --git a/libraries/animation/src/AnimSplineIK.h b/libraries/animation/src/AnimSplineIK.h index d4dbb85a9e..e00b5a5b04 100644 --- a/libraries/animation/src/AnimSplineIK.h +++ b/libraries/animation/src/AnimSplineIK.h @@ -26,7 +26,9 @@ public: const QString& tipPositionVar, const QString& tipRotationVar, const QString& secondaryTargetJointName, const QString& secondaryTargetPositionVar, - const QString& secondaryTargetRotationVar); + const QString& secondaryTargetRotationVar, + const QString& primaryFlexCoefficients, + const QString& secondaryFlexCoefficients); virtual ~AnimSplineIK() override; virtual const AnimPoseVec& evaluate(const AnimVariantMap& animVars, const AnimContext& context, float dt, AnimVariantMap& triggersOut) override; @@ -65,6 +67,14 @@ protected: QString _tipRotationVar; QString _secondaryTargetPositionVar; QString _secondaryTargetRotationVar; + //QString _primaryFlexCoefficients; + //QString _secondaryFlexCoefficients; + + static const int MAX_NUMBER_FLEX_VARIABLES = 10; + float _primaryFlexCoefficients[MAX_NUMBER_FLEX_VARIABLES]; + float _secondaryFlexCoefficients[MAX_NUMBER_FLEX_VARIABLES]; + int _numPrimaryFlexCoefficients { 0 }; + int _numSecondaryFlexCoefficients { 0 }; int _baseParentJointIndex { -1 }; int _baseJointIndex { -1 }; From f2a7f3795084b460a39ae1070cdecc3d89ad2309 Mon Sep 17 00:00:00 2001 From: amantley Date: Fri, 25 Jan 2019 17:11:07 -0800 Subject: [PATCH 030/436] got rid of the lag in the spline code by setting the flex coeffs to 1.0 --- .../avatar/avatar-animation_withIKNode.json | 4 +-- interface/src/Application.cpp | 1 + libraries/animation/src/AnimChain.h | 10 ------ libraries/animation/src/AnimNodeLoader.cpp | 6 ++-- libraries/animation/src/AnimSplineIK.cpp | 31 ++++++------------- libraries/animation/src/AnimSplineIK.h | 4 +-- libraries/animation/src/AnimTwoBoneIK.cpp | 2 +- libraries/animation/src/Rig.cpp | 2 +- libraries/fbx/src/FBXSerializer.cpp | 1 - 9 files changed, 20 insertions(+), 41 deletions(-) diff --git a/interface/resources/avatar/avatar-animation_withIKNode.json b/interface/resources/avatar/avatar-animation_withIKNode.json index 13c102a5f1..bd0baf473e 100644 --- a/interface/resources/avatar/avatar-animation_withIKNode.json +++ b/interface/resources/avatar/avatar-animation_withIKNode.json @@ -194,8 +194,8 @@ "enabledVar": "splineIKEnabled", "endEffectorRotationVarVar": "splineIKRotationVar", "endEffectorPositionVarVar": "splineIKPositionVar", - "primaryFlexCoefficients": "1, 0.5, 0.25, 0.2, 0.1", - "secondaryFlexCoefficients": "1.0, 0.5, 0.25" + "primaryFlexCoefficients": "1.0, 1.0, 1.0, 1.0, 1.0", + "secondaryFlexCoefficients": "1.0, 1.0, 1.0" }, "children": [ { diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index ed1d1a4c99..68ac05ef18 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -4814,6 +4814,7 @@ void setupCpuMonitorThread() { void Application::idle() { PerformanceTimer perfTimer("idle"); + // Update the deadlock watchdog updateHeartbeat(); diff --git a/libraries/animation/src/AnimChain.h b/libraries/animation/src/AnimChain.h index 37d175a334..2385e0c16a 100644 --- a/libraries/animation/src/AnimChain.h +++ b/libraries/animation/src/AnimChain.h @@ -82,16 +82,6 @@ public: return foundIndex; } - const AnimPose& getRelativePoseAtJointIndex(int jointIndex) const { - for (int i = 0; i < _top; i++) { - if (_chain[i].jointIndex == jointIndex) { - return _chain[i].relativePose; - } - } - return AnimPose::identity; - } - - void buildDirtyAbsolutePoses() { // the relative and absolute pose is the same for the base of the chain. _chain[_top - 1].absolutePose = _chain[_top - 1].relativePose; diff --git a/libraries/animation/src/AnimNodeLoader.cpp b/libraries/animation/src/AnimNodeLoader.cpp index c5d17e8884..bce242b50d 100644 --- a/libraries/animation/src/AnimNodeLoader.cpp +++ b/libraries/animation/src/AnimNodeLoader.cpp @@ -601,9 +601,9 @@ static AnimNode::Pointer loadSplineIKNode(const QJsonObject& jsonObj, const QStr auto node = std::make_shared(id, alpha, enabled, interpDuration, baseJointName, tipJointName, - alphaVar, enabledVar, endEffectorRotationVarVar, endEffectorPositionVarVar, - basePositionVar, baseRotationVar, - tipPositionVar, tipRotationVar, secondaryTargetJointName, secondaryTargetPositionVar, + alphaVar, enabledVar, endEffectorRotationVarVar, endEffectorPositionVarVar, + basePositionVar, baseRotationVar, + tipPositionVar, tipRotationVar, secondaryTargetJointName, secondaryTargetPositionVar, secondaryTargetRotationVar, primaryFlexCoefficients, secondaryFlexCoefficients); return node; } diff --git a/libraries/animation/src/AnimSplineIK.cpp b/libraries/animation/src/AnimSplineIK.cpp index 658fa2cf6a..b38850773d 100644 --- a/libraries/animation/src/AnimSplineIK.cpp +++ b/libraries/animation/src/AnimSplineIK.cpp @@ -51,7 +51,7 @@ AnimSplineIK::AnimSplineIK(const QString& id, float alpha, bool enabled, float i _secondaryTargetPositionVar(secondaryTargetPositionVar), _secondaryTargetRotationVar(secondaryTargetRotationVar) { - + QStringList flexCoefficientsValues = primaryFlexCoefficients.split(',', QString::SkipEmptyParts); for (int i = 0; i < flexCoefficientsValues.size(); i++) { if (i < MAX_NUMBER_FLEX_VARIABLES) { @@ -134,7 +134,6 @@ const AnimPoseVec& AnimSplineIK::evaluate(const AnimVariantMap& animVars, const glm::vec3 hipsTargetTranslation; // now we override the hips with the hips target pose. - //////////////////////////////////////////////////// if (_poses.size() > 0) { AnimPose hipsUnderPose = _skeleton->getAbsolutePose(_hipsIndex, _poses); hipsTargetRotation = animVars.lookupRigToGeometry("hipsRotation", hipsUnderPose.rot()); @@ -147,12 +146,11 @@ const AnimPoseVec& AnimSplineIK::evaluate(const AnimVariantMap& animVars, const _poses[_hipsIndex] = hipsParentAbsPose.inverse() * absHipsTargetPose; _poses[_hipsIndex].scale() = glm::vec3(1.0f); } - ////////////////////////////////////////////////////////////////////////////////// - + AnimPoseVec absolutePoses; absolutePoses.resize(_poses.size()); computeAbsolutePoses(absolutePoses); - + IKTarget target; if (_tipJointIndex != -1) { target.setType((int)IKTarget::Type::Spline); @@ -165,7 +163,7 @@ const AnimPoseVec& AnimSplineIK::evaluate(const AnimVariantMap& animVars, const target.setPose(rotation, translation); target.setWeight(weight); - + const float* flexCoefficients = new float[5]{ 1.0f, 0.5f, 0.25f, 0.2f, 0.1f }; target.setFlexCoefficients(_numPrimaryFlexCoefficients, _primaryFlexCoefficients); @@ -186,12 +184,10 @@ const AnimPoseVec& AnimSplineIK::evaluate(const AnimVariantMap& animVars, const AnimPose afterSolveSecondaryTarget = _skeleton->getAbsolutePose(_secondaryTargetIndex, _poses); glm::quat secondaryTargetRotation = animVars.lookupRigToGeometry(_secondaryTargetRotationVar, afterSolveSecondaryTarget.rot()); - - updatedSecondaryTarget = AnimPose(secondaryTargetRotation, afterSolveSecondaryTarget.trans()); + updatedSecondaryTarget = AnimPose(secondaryTargetRotation, afterSolveSecondaryTarget.trans()); //updatedSecondaryTarget = AnimPose(afterSolveSecondaryTarget.rot(), afterSolveSecondaryTarget.trans()); } - IKTarget secondaryTarget; computeAbsolutePoses(absolutePoses2); if (_secondaryTargetIndex != -1) { @@ -199,14 +195,13 @@ const AnimPoseVec& AnimSplineIK::evaluate(const AnimVariantMap& animVars, const secondaryTarget.setIndex(_secondaryTargetIndex); float weight2 = 1.0f; - secondaryTarget.setPose(updatedSecondaryTarget.rot(), updatedSecondaryTarget.trans()); secondaryTarget.setWeight(weight2); - + const float* flexCoefficients2 = new float[3]{ 1.0f, 0.5f, 0.25f }; secondaryTarget.setFlexCoefficients(_numSecondaryFlexCoefficients, _secondaryFlexCoefficients); } - + AnimChain secondaryJointChain; AnimPose beforeSolveChestNeck; if (_poses.size() > 0) { @@ -223,17 +218,11 @@ const AnimPoseVec& AnimSplineIK::evaluate(const AnimVariantMap& animVars, const int tipParent = _skeleton->getParentIndex(_tipJointIndex); int secondaryTargetParent = _skeleton->getParentIndex(_secondaryTargetIndex); if ((secondaryTargetParent != -1) && (tipParent != -1) && (_poses.size() > 0)) { - /* - AnimPose secondaryTargetPose(target2.getRotation(), target2.getTranslation()); - AnimPose secondaryTargetRelativePose = _skeleton->getAbsolutePose(secondaryTargetParent, _poses).inverse() * secondaryTargetPose; - _poses[_secondaryTargetIndex] = secondaryTargetRelativePose; - */ AnimPose secondaryTargetPose(secondaryTarget.getRotation(), secondaryTarget.getTranslation()); AnimPose neckAbsolute = _skeleton->getAbsolutePose(tipParent, _poses); - //AnimPose finalNeckAbsolute = AnimPose(safeLerp(target2.getRotation(), target.getRotation(), 1.0f),neckAbsolute.trans()); _poses[tipParent] = secondaryTargetPose.inverse() * beforeSolveChestNeck; - + AnimPose tipTarget(target.getRotation(),target.getTranslation()); AnimPose tipRelativePose = _skeleton->getAbsolutePose(tipParent,_poses).inverse() * tipTarget; _poses[_tipJointIndex] = tipRelativePose; @@ -314,7 +303,7 @@ const AnimPoseVec& AnimSplineIK::evaluate(const AnimVariantMap& animVars, const } _previousEnableDebugIKTargets = context.getEnableDebugDrawIKTargets(); - + return _poses; } @@ -458,7 +447,7 @@ void AnimSplineIK::solveTargetWithSpline(const AnimContext& context, const IKTar relPose.trans() = glm::vec3(0.0f); } } - // note we are ignoring the constrained info for now. + // note we are ignoring the constrained info for now. if (!chainInfoOut.setRelativePoseAtJointIndex(splineJointInfo.jointIndex, relPose)) { qCDebug(animation) << "we didn't find the joint index for the spline!!!!"; } diff --git a/libraries/animation/src/AnimSplineIK.h b/libraries/animation/src/AnimSplineIK.h index e00b5a5b04..c6d435fd6b 100644 --- a/libraries/animation/src/AnimSplineIK.h +++ b/libraries/animation/src/AnimSplineIK.h @@ -21,8 +21,8 @@ public: AnimSplineIK(const QString& id, float alpha, bool enabled, float interpDuration, const QString& baseJointName, const QString& tipJointName, const QString& alphaVar, const QString& enabledVar, - const QString& endEffectorRotationVarVar, const QString& endEffectorPositionVarVar, - const QString& basePositionVar, const QString& baseRotationVar, + const QString& endEffectorRotationVarVar, const QString& endEffectorPositionVarVar, + const QString& basePositionVar, const QString& baseRotationVar, const QString& tipPositionVar, const QString& tipRotationVar, const QString& secondaryTargetJointName, const QString& secondaryTargetPositionVar, diff --git a/libraries/animation/src/AnimTwoBoneIK.cpp b/libraries/animation/src/AnimTwoBoneIK.cpp index 3f8de488ff..8960b15940 100644 --- a/libraries/animation/src/AnimTwoBoneIK.cpp +++ b/libraries/animation/src/AnimTwoBoneIK.cpp @@ -89,7 +89,7 @@ const AnimPoseVec& AnimTwoBoneIK::evaluate(const AnimVariantMap& animVars, const } _enabled = enabled; - // don't build chains or do IK if we are disabled & not interping. + // don't build chains or do IK if we are disbled & not interping. if (_interpType == InterpType::None && !enabled) { _poses = underPoses; return _poses; diff --git a/libraries/animation/src/Rig.cpp b/libraries/animation/src/Rig.cpp index 93daeda4d9..713f9bc385 100644 --- a/libraries/animation/src/Rig.cpp +++ b/libraries/animation/src/Rig.cpp @@ -1468,7 +1468,7 @@ void Rig::updateHands(bool leftHandEnabled, bool rightHandEnabled, bool hipsEnab // need this for two bone ik _animVars.set(LEFT_HAND_IK_POSITION_VAR, MAIN_STATE_MACHINE_LEFT_HAND_POSITION); _animVars.set(LEFT_HAND_IK_ROTATION_VAR, MAIN_STATE_MACHINE_LEFT_HAND_ROTATION); - + _animVars.set("leftHandPoleVectorEnabled", false); _animVars.unset("leftHandPosition"); _animVars.unset("leftHandRotation"); diff --git a/libraries/fbx/src/FBXSerializer.cpp b/libraries/fbx/src/FBXSerializer.cpp index 2c13be534a..4c82b4f5d7 100644 --- a/libraries/fbx/src/FBXSerializer.cpp +++ b/libraries/fbx/src/FBXSerializer.cpp @@ -1314,7 +1314,6 @@ HFMModel* FBXSerializer::extractHFMModel(const QVariantHash& mapping, const QStr joint.inverseBindRotation = joint.inverseDefaultRotation; joint.name = fbxModel.name; if (hfmModel.hfmToHifiJointNameMapping.contains(hfmModel.hfmToHifiJointNameMapping.key(joint.name))) { - // qCDebug(modelformat) << "joint name " << joint.name << " hifi name " << hfmModel.hfmToHifiJointNameMapping.key(fbxModel.name); joint.name = hfmModel.hfmToHifiJointNameMapping.key(fbxModel.name); } From 0b6d0b4bafaab5ea6e61f5bbefba7440efb03c3f Mon Sep 17 00:00:00 2001 From: amantley Date: Fri, 25 Jan 2019 18:17:15 -0800 Subject: [PATCH 031/436] renamed json to reflect spline node --- .../avatar/avatar-animation_twoboneIK.json | 2204 ----------------- ...=> avatar-animation_withSplineIKNode.json} | 0 2 files changed, 2204 deletions(-) delete mode 100644 interface/resources/avatar/avatar-animation_twoboneIK.json rename interface/resources/avatar/{avatar-animation_withIKNode.json => avatar-animation_withSplineIKNode.json} (100%) diff --git a/interface/resources/avatar/avatar-animation_twoboneIK.json b/interface/resources/avatar/avatar-animation_twoboneIK.json deleted file mode 100644 index 45cb7b570e..0000000000 --- a/interface/resources/avatar/avatar-animation_twoboneIK.json +++ /dev/null @@ -1,2204 +0,0 @@ -{ - "version": "1.1", - "root": { - "id": "userAnimStateMachine", - "type": "stateMachine", - "data": { - "currentState": "userAnimNone", - "states": [ - { - "id": "userAnimNone", - "interpTarget": 6, - "interpDuration": 6, - "transitions": [ - { "var": "userAnimA", "state": "userAnimA" }, - { "var": "userAnimB", "state": "userAnimB" } - ] - }, - { - "id": "userAnimA", - "interpTarget": 6, - "interpDuration": 6, - "transitions": [ - { "var": "userAnimNone", "state": "userAnimNone" }, - { "var": "userAnimB", "state": "userAnimB" } - ] - }, - { - "id": "userAnimB", - "interpTarget": 6, - "interpDuration": 6, - "transitions": [ - { "var": "userAnimNone", "state": "userAnimNone" }, - { "var": "userAnimA", "state": "userAnimA" } - ] - } - ] - }, - "children": [ - { - "id": "userAnimNone", - "type": "splineIK", - "data": { - "alpha": 1.0, - "enabled": false, - "interpDuration": 15, - "baseJointName": "Hips", - "tipJointName": "Head", - "alphaVar": "splineIKAlpha", - "enabledVar": "splineIKEnabled", - "endEffectorRotationVarVar": "splineIKRotationVar", - "endEffectorPositionVarVar": "splineIKPositionVar" - }, - "children": [ - { - "id": "rightFootPoleVector", - "type": "poleVectorConstraint", - "data": { - "enabled": false, - "referenceVector": [ 0, 0, 1 ], - "baseJointName": "RightUpLeg", - "midJointName": "RightLeg", - "tipJointName": "RightFoot", - "enabledVar": "rightFootPoleVectorEnabled", - "poleVectorVar": "rightFootPoleVector" - }, - "children": [ - { - "id": "rightFootIK", - "type": "twoBoneIK", - "data": { - "alpha": 1.0, - "enabled": false, - "interpDuration": 15, - "baseJointName": "RightUpLeg", - "midJointName": "RightLeg", - "tipJointName": "RightFoot", - "midHingeAxis": [ -1, 0, 0 ], - "alphaVar": "rightFootIKAlpha", - "enabledVar": "rightFootIKEnabled", - "endEffectorRotationVarVar": "rightFootIKRotationVar", - "endEffectorPositionVarVar": "rightFootIKPositionVar" - }, - "children": [ - { - "id": "leftFootPoleVector", - "type": "poleVectorConstraint", - "data": { - "enabled": false, - "referenceVector": [ 0, 0, 1 ], - "baseJointName": "LeftUpLeg", - "midJointName": "LeftLeg", - "tipJointName": "LeftFoot", - "enabledVar": "leftFootPoleVectorEnabled", - "poleVectorVar": "leftFootPoleVector" - }, - "children": [ - { - "id": "leftFootIK", - "type": "twoBoneIK", - "data": { - "alpha": 1.0, - "enabled": false, - "interpDuration": 15, - "baseJointName": "LeftUpLeg", - "midJointName": "LeftLeg", - "tipJointName": "LeftFoot", - "midHingeAxis": [ -1, 0, 0 ], - "alphaVar": "leftFootIKAlpha", - "enabledVar": "leftFootIKEnabled", - "endEffectorRotationVarVar": "leftFootIKRotationVar", - "endEffectorPositionVarVar": "leftFootIKPositionVar" - }, - "children": [ - { - "id": "rightHandPoleVector", - "type": "poleVectorConstraint", - "data": { - "enabled": false, - "referenceVector": [ 0, 0, 1 ], - "baseJointName": "RightArm", - "midJointName": "RightForeArm", - "tipJointName": "RightHand", - "enabledVar": "rightHandPoleVectorEnabled", - "poleVectorVar": "rightHandPoleVector" - }, - "children": [ - { - "id": "rightHandIK", - "type": "twoBoneIK", - "data": { - "alpha": 1.0, - "enabled": false, - "interpDuration": 15, - "baseJointName": "RightArm", - "midJointName": "RightForeArm", - "tipJointName": "RightHand", - "midHingeAxis": [ 0, 0, -1 ], - "alphaVar": "rightHandIKAlpha", - "enabledVar": "rightHandIKEnabled", - "endEffectorRotationVarVar": "rightHandIKRotationVar", - "endEffectorPositionVarVar": "rightHandIKPositionVar" - }, - "children": [ - { - "id": "leftHandPoleVector", - "type": "poleVectorConstraint", - "data": { - "enabled": false, - "referenceVector": [ 0, 0, 1 ], - "baseJointName": "LeftArm", - "midJointName": "LeftForeArm", - "tipJointName": "LeftHand", - "enabledVar": "leftHandPoleVectorEnabled", - "poleVectorVar": "leftHandPoleVector" - }, - "children": [ - { - "id": "leftHandIK", - "type": "twoBoneIK", - "data": { - "alpha": 1.0, - "enabled": false, - "interpDuration": 15, - "baseJointName": "LeftArm", - "midJointName": "LeftForeArm", - "tipJointName": "LeftHand", - "midHingeAxis": [ 0, 0, 1 ], - "alphaVar": "leftHandIKAlpha", - "enabledVar": "leftHandIKEnabled", - "endEffectorRotationVarVar": "leftHandIKRotationVar", - "endEffectorPositionVarVar": "leftHandIKPositionVar" - }, - "children": [ - { - "id": "defaultPoseOverlay", - "type": "overlay", - "data": { - "alpha": 0.0, - "alphaVar": "defaultPoseOverlayAlpha", - "boneSet": "fullBody", - "boneSetVar": "defaultPoseOverlayBoneSet" - }, - "children": [ - { - "id": "defaultPose", - "type": "defaultPose", - "data": { - }, - "children": [] - }, - { - "id": "rightHandOverlay", - "type": "overlay", - "data": { - "alpha": 0.0, - "boneSet": "rightHand", - "alphaVar": "rightHandOverlayAlpha" - }, - "children": [ - { - "id": "rightHandStateMachine", - "type": "stateMachine", - "data": { - "currentState": "rightHandGrasp", - "states": [ - { - "id": "rightHandGrasp", - "interpTarget": 3, - "interpDuration": 3, - "transitions": [ - { - "var": "isRightIndexPoint", - "state": "rightIndexPoint" - }, - { - "var": "isRightThumbRaise", - "state": "rightThumbRaise" - }, - { - "var": "isRightIndexPointAndThumbRaise", - "state": "rightIndexPointAndThumbRaise" - } - ] - }, - { - "id": "rightIndexPoint", - "interpTarget": 15, - "interpDuration": 3, - "transitions": [ - { - "var": "isRightHandGrasp", - "state": "rightHandGrasp" - }, - { - "var": "isRightThumbRaise", - "state": "rightThumbRaise" - }, - { - "var": "isRightIndexPointAndThumbRaise", - "state": "rightIndexPointAndThumbRaise" - } - ] - }, - { - "id": "rightThumbRaise", - "interpTarget": 15, - "interpDuration": 3, - "transitions": [ - { - "var": "isRightHandGrasp", - "state": "rightHandGrasp" - }, - { - "var": "isRightIndexPoint", - "state": "rightIndexPoint" - }, - { - "var": "isRightIndexPointAndThumbRaise", - "state": "rightIndexPointAndThumbRaise" - } - ] - }, - { - "id": "rightIndexPointAndThumbRaise", - "interpTarget": 15, - "interpDuration": 3, - "transitions": [ - { - "var": "isRightHandGrasp", - "state": "rightHandGrasp" - }, - { - "var": "isRightIndexPoint", - "state": "rightIndexPoint" - }, - { - "var": "isRightThumbRaise", - "state": "rightThumbRaise" - } - ] - } - ] - }, - "children": [ - { - "id": "rightHandGrasp", - "type": "blendLinear", - "data": { - "alpha": 0.0, - "alphaVar": "rightHandGraspAlpha" - }, - "children": [ - { - "id": "rightHandGraspOpen", - "type": "clip", - "data": { - "url": "qrc:///avatar/animations/hydra_pose_open_right.fbx", - "startFrame": 0.0, - "endFrame": 0.0, - "timeScale": 1.0, - "loopFlag": true - }, - "children": [] - }, - { - "id": "rightHandGraspClosed", - "type": "clip", - "data": { - "url": "qrc:///avatar/animations/hydra_pose_closed_right.fbx", - "startFrame": 0.0, - "endFrame": 0.0, - "timeScale": 1.0, - "loopFlag": true - }, - "children": [] - } - ] - }, - { - "id": "rightIndexPoint", - "type": "blendLinear", - "data": { - "alpha": 0.0, - "alphaVar": "rightHandGraspAlpha" - }, - "children": [ - { - "id": "rightIndexPointOpen", - "type": "clip", - "data": { - "url": "qrc:///avatar/animations/touch_point_open_right.fbx", - "startFrame": 15.0, - "endFrame": 15.0, - "timeScale": 1.0, - "loopFlag": true - }, - "children": [] - }, - { - "id": "rightIndexPointClosed", - "type": "clip", - "data": { - "url": "qrc:///avatar/animations/touch_point_closed_right.fbx", - "startFrame": 15.0, - "endFrame": 15.0, - "timeScale": 1.0, - "loopFlag": true - }, - "children": [] - } - ] - }, - { - "id": "rightThumbRaise", - "type": "blendLinear", - "data": { - "alpha": 0.0, - "alphaVar": "rightHandGraspAlpha" - }, - "children": [ - { - "id": "rightThumbRaiseOpen", - "type": "clip", - "data": { - "url": "qrc:///avatar/animations/touch_thumb_open_right.fbx", - "startFrame": 15.0, - "endFrame": 15.0, - "timeScale": 1.0, - "loopFlag": true - }, - "children": [] - }, - { - "id": "rightThumbRaiseClosed", - "type": "clip", - "data": { - "url": "qrc:///avatar/animations/touch_thumb_closed_right.fbx", - "startFrame": 15.0, - "endFrame": 15.0, - "timeScale": 1.0, - "loopFlag": true - }, - "children": [] - } - ] - }, - { - "id": "rightIndexPointAndThumbRaise", - "type": "blendLinear", - "data": { - "alpha": 0.0, - "alphaVar": "rightHandGraspAlpha" - }, - "children": [ - { - "id": "rightIndexPointAndThumbRaiseOpen", - "type": "clip", - "data": { - "url": "qrc:///avatar/animations/touch_thumb_point_open_right.fbx", - "startFrame": 15.0, - "endFrame": 15.0, - "timeScale": 1.0, - "loopFlag": true - }, - "children": [] - }, - { - "id": "rightIndexPointAndThumbRaiseClosed", - "type": "clip", - "data": { - "url": "qrc:///avatar/animations/touch_thumb_point_closed_right.fbx", - "startFrame": 15.0, - "endFrame": 15.0, - "timeScale": 1.0, - "loopFlag": true - }, - "children": [] - } - ] - } - ] - }, - { - "id": "leftHandOverlay", - "type": "overlay", - "data": { - "alpha": 0.0, - "boneSet": "leftHand", - "alphaVar": "leftHandOverlayAlpha" - }, - "children": [ - { - "id": "leftHandStateMachine", - "type": "stateMachine", - "data": { - "currentState": "leftHandGrasp", - "states": [ - { - "id": "leftHandGrasp", - "interpTarget": 3, - "interpDuration": 3, - "transitions": [ - { - "var": "isLeftIndexPoint", - "state": "leftIndexPoint" - }, - { - "var": "isLeftThumbRaise", - "state": "leftThumbRaise" - }, - { - "var": "isLeftIndexPointAndThumbRaise", - "state": "leftIndexPointAndThumbRaise" - } - ] - }, - { - "id": "leftIndexPoint", - "interpTarget": 15, - "interpDuration": 3, - "transitions": [ - { - "var": "isLeftHandGrasp", - "state": "leftHandGrasp" - }, - { - "var": "isLeftThumbRaise", - "state": "leftThumbRaise" - }, - { - "var": "isLeftIndexPointAndThumbRaise", - "state": "leftIndexPointAndThumbRaise" - } - ] - }, - { - "id": "leftThumbRaise", - "interpTarget": 15, - "interpDuration": 3, - "transitions": [ - { - "var": "isLeftHandGrasp", - "state": "leftHandGrasp" - }, - { - "var": "isLeftIndexPoint", - "state": "leftIndexPoint" - }, - { - "var": "isLeftIndexPointAndThumbRaise", - "state": "leftIndexPointAndThumbRaise" - } - ] - }, - { - "id": "leftIndexPointAndThumbRaise", - "interpTarget": 15, - "interpDuration": 3, - "transitions": [ - { - "var": "isLeftHandGrasp", - "state": "leftHandGrasp" - }, - { - "var": "isLeftIndexPoint", - "state": "leftIndexPoint" - }, - { - "var": "isLeftThumbRaise", - "state": "leftThumbRaise" - } - ] - } - ] - }, - "children": [ - { - "id": "leftHandGrasp", - "type": "blendLinear", - "data": { - "alpha": 0.0, - "alphaVar": "leftHandGraspAlpha" - }, - "children": [ - { - "id": "leftHandGraspOpen", - "type": "clip", - "data": { - "url": "qrc:///avatar/animations/hydra_pose_open_left.fbx", - "startFrame": 0.0, - "endFrame": 0.0, - "timeScale": 1.0, - "loopFlag": true - }, - "children": [] - }, - { - "id": "leftHandGraspClosed", - "type": "clip", - "data": { - "url": "qrc:///avatar/animations/hydra_pose_closed_left.fbx", - "startFrame": 10.0, - "endFrame": 10.0, - "timeScale": 1.0, - "loopFlag": true - }, - "children": [] - } - ] - }, - { - "id": "leftIndexPoint", - "type": "blendLinear", - "data": { - "alpha": 0.0, - "alphaVar": "leftHandGraspAlpha" - }, - "children": [ - { - "id": "leftIndexPointOpen", - "type": "clip", - "data": { - "url": "qrc:///avatar/animations/touch_point_open_left.fbx", - "startFrame": 15.0, - "endFrame": 15.0, - "timeScale": 1.0, - "loopFlag": true - }, - "children": [] - }, - { - "id": "leftIndexPointClosed", - "type": "clip", - "data": { - "url": "qrc:///avatar/animations/touch_point_closed_left.fbx", - "startFrame": 15.0, - "endFrame": 15.0, - "timeScale": 1.0, - "loopFlag": true - }, - "children": [] - } - ] - }, - { - "id": "leftThumbRaise", - "type": "blendLinear", - "data": { - "alpha": 0.0, - "alphaVar": "leftHandGraspAlpha" - }, - "children": [ - { - "id": "leftThumbRaiseOpen", - "type": "clip", - "data": { - "url": "qrc:///avatar/animations/touch_thumb_open_left.fbx", - "startFrame": 15.0, - "endFrame": 15.0, - "timeScale": 1.0, - "loopFlag": true - }, - "children": [] - }, - { - "id": "leftThumbRaiseClosed", - "type": "clip", - "data": { - "url": "qrc:///avatar/animations/touch_thumb_closed_left.fbx", - "startFrame": 15.0, - "endFrame": 15.0, - "timeScale": 1.0, - "loopFlag": true - }, - "children": [] - } - ] - }, - { - "id": "leftIndexPointAndThumbRaise", - "type": "blendLinear", - "data": { - "alpha": 0.0, - "alphaVar": "leftHandGraspAlpha" - }, - "children": [ - { - "id": "leftIndexPointAndThumbRaiseOpen", - "type": "clip", - "data": { - "url": "qrc:///avatar/animations/touch_thumb_point_open_left.fbx", - "startFrame": 15.0, - "endFrame": 15.0, - "timeScale": 1.0, - "loopFlag": true - }, - "children": [] - }, - { - "id": "leftIndexPointAndThumbRaiseClosed", - "type": "clip", - "data": { - "url": "qrc:///avatar/animations/touch_thumb_point_closed_left.fbx", - "startFrame": 15.0, - "endFrame": 15.0, - "timeScale": 1.0, - "loopFlag": true - }, - "children": [] - } - ] - } - ] - }, - { - "id": "mainStateMachine", - "type": "stateMachine", - "data": { - "outputJoints": [ "LeftFoot", "RightFoot" ], - "currentState": "idle", - "states": [ - { - "id": "idle", - "interpTarget": 20, - "interpDuration": 8, - "interpType": "snapshotPrev", - "transitions": [ - { - "var": "isMovingForward", - "state": "WALKFWD" - }, - { - "var": "isMovingBackward", - "state": "WALKBWD" - }, - { - "var": "isMovingRight", - "state": "STRAFERIGHT" - }, - { - "var": "isMovingLeft", - "state": "STRAFELEFT" - }, - { - "var": "isTurningRight", - "state": "turnRight" - }, - { - "var": "isTurningLeft", - "state": "turnLeft" - }, - { - "var": "isFlying", - "state": "fly" - }, - { - "var": "isTakeoffStand", - "state": "takeoffStand" - }, - { - "var": "isTakeoffRun", - "state": "TAKEOFFRUN" - }, - { - "var": "isInAirStand", - "state": "inAirStand" - }, - { - "var": "isInAirRun", - "state": "INAIRRUN" - }, - { - "var": "isMovingRightHmd", - "state": "strafeRightHmd" - }, - { - "var": "isMovingLeftHmd", - "state": "strafeLeftHmd" - } - ] - }, - { - "id": "idleToWalkFwd", - "interpTarget": 12, - "interpDuration": 8, - "transitions": [ - { - "var": "idleToWalkFwdOnDone", - "state": "WALKFWD" - }, - { - "var": "isNotMoving", - "state": "idle" - }, - { - "var": "isMovingBackward", - "state": "WALKBWD" - }, - { - "var": "isMovingRight", - "state": "STRAFERIGHT" - }, - { - "var": "isMovingLeft", - "state": "STRAFELEFT" - }, - { - "var": "isTurningRight", - "state": "turnRight" - }, - { - "var": "isTurningLeft", - "state": "turnLeft" - }, - { - "var": "isFlying", - "state": "fly" - }, - { - "var": "isTakeoffStand", - "state": "takeoffStand" - }, - { - "var": "isTakeoffRun", - "state": "TAKEOFFRUN" - }, - { - "var": "isInAirStand", - "state": "inAirStand" - }, - { - "var": "isInAirRun", - "state": "INAIRRUN" - }, - { - "var": "isMovingRightHmd", - "state": "strafeRightHmd" - }, - { - "var": "isMovingLeftHmd", - "state": "strafeLeftHmd" - } - ] - }, - { - "id": "idleSettle", - "interpTarget": 15, - "interpDuration": 8, - "interpType": "snapshotPrev", - "transitions": [ - { - "var": "idleSettleOnDone", - "state": "idle" - }, - { - "var": "isMovingForward", - "state": "WALKFWD" - }, - { - "var": "isMovingBackward", - "state": "WALKBWD" - }, - { - "var": "isMovingRight", - "state": "STRAFERIGHT" - }, - { - "var": "isMovingLeft", - "state": "STRAFELEFT" - }, - { - "var": "isMovingRightHmd", - "state": "strafeRightHmd" - }, - { - "var": "isMovingLeftHmd", - "state": "strafeLeftHmd" - }, - { - "var": "isTurningRight", - "state": "turnRight" - }, - { - "var": "isTurningLeft", - "state": "turnLeft" - }, - { - "var": "isFlying", - "state": "fly" - }, - { - "var": "isTakeoffStand", - "state": "takeoffStand" - }, - { - "var": "isTakeoffRun", - "state": "TAKEOFFRUN" - }, - { - "var": "isInAirStand", - "state": "inAirStand" - }, - { - "var": "isInAirRun", - "state": "INAIRRUN" - } - ] - }, - { - "id": "WALKFWD", - "interpTarget": 35, - "interpDuration": 10, - "interpType": "snapshotPrev", - "transitions": [ - { - "var": "isNotMoving", - "state": "idleSettle" - }, - { - "var": "isMovingBackward", - "state": "WALKBWD" - }, - { - "var": "isMovingRight", - "state": "STRAFERIGHT" - }, - { - "var": "isMovingLeft", - "state": "STRAFELEFT" - }, - { - "var": "isTurningRight", - "state": "turnRight" - }, - { - "var": "isTurningLeft", - "state": "turnLeft" - }, - { - "var": "isFlying", - "state": "fly" - }, - { - "var": "isTakeoffStand", - "state": "takeoffStand" - }, - { - "var": "isTakeoffRun", - "state": "TAKEOFFRUN" - }, - { - "var": "isInAirStand", - "state": "inAirStand" - }, - { - "var": "isInAirRun", - "state": "INAIRRUN" - }, - { - "var": "isMovingRightHmd", - "state": "strafeRightHmd" - }, - { - "var": "isMovingLeftHmd", - "state": "strafeLeftHmd" - } - ] - }, - { - "id": "WALKBWD", - "interpTarget": 35, - "interpDuration": 10, - "interpType": "snapshotPrev", - "transitions": [ - { - "var": "isNotMoving", - "state": "idleSettle" - }, - { - "var": "isMovingForward", - "state": "WALKFWD" - }, - { - "var": "isMovingRight", - "state": "STRAFERIGHT" - }, - { - "var": "isMovingLeft", - "state": "STRAFELEFT" - }, - { - "var": "isTurningRight", - "state": "turnRight" - }, - { - "var": "isTurningLeft", - "state": "turnLeft" - }, - { - "var": "isFlying", - "state": "fly" - }, - { - "var": "isTakeoffStand", - "state": "takeoffStand" - }, - { - "var": "isTakeoffRun", - "state": "TAKEOFFRUN" - }, - { - "var": "isInAirStand", - "state": "inAirStand" - }, - { - "var": "isInAirRun", - "state": "INAIRRUN" - }, - { - "var": "isMovingRightHmd", - "state": "strafeRightHmd" - }, - { - "var": "isMovingLeftHmd", - "state": "strafeLeftHmd" - } - ] - }, - { - "id": "STRAFERIGHT", - "interpTarget": 25, - "interpDuration": 8, - "interpType": "snapshotPrev", - "transitions": [ - { - "var": "isNotMoving", - "state": "idleSettle" - }, - { - "var": "isMovingForward", - "state": "WALKFWD" - }, - { - "var": "isMovingBackward", - "state": "WALKBWD" - }, - { - "var": "isMovingLeft", - "state": "STRAFELEFT" - }, - { - "var": "isTurningRight", - "state": "turnRight" - }, - { - "var": "isTurningLeft", - "state": "turnLeft" - }, - { - "var": "isFlying", - "state": "fly" - }, - { - "var": "isTakeoffStand", - "state": "takeoffStand" - }, - { - "var": "isTakeoffRun", - "state": "TAKEOFFRUN" - }, - { - "var": "isInAirStand", - "state": "inAirStand" - }, - { - "var": "isInAirRun", - "state": "INAIRRUN" - }, - { - "var": "isMovingRightHmd", - "state": "strafeRightHmd" - }, - { - "var": "isMovingLeftHmd", - "state": "strafeLeftHmd" - } - ] - }, - { - "id": "STRAFELEFT", - "interpTarget": 25, - "interpDuration": 8, - "interpType": "snapshotPrev", - "transitions": [ - { - "var": "isNotMoving", - "state": "idleSettle" - }, - { - "var": "isMovingForward", - "state": "WALKFWD" - }, - { - "var": "isMovingBackward", - "state": "WALKBWD" - }, - { - "var": "isMovingRight", - "state": "STRAFERIGHT" - }, - { - "var": "isTurningRight", - "state": "turnRight" - }, - { - "var": "isTurningLeft", - "state": "turnLeft" - }, - { - "var": "isFlying", - "state": "fly" - }, - { - "var": "isTakeoffStand", - "state": "takeoffStand" - }, - { - "var": "isTakeoffRun", - "state": "TAKEOFFRUN" - }, - { - "var": "isInAirStand", - "state": "inAirStand" - }, - { - "var": "isInAirRun", - "state": "INAIRRUN" - }, - { - "var": "isMovingRightHmd", - "state": "strafeRightHmd" - }, - { - "var": "isMovingLeftHmd", - "state": "strafeLeftHmd" - } - ] - }, - { - "id": "turnRight", - "interpTarget": 6, - "interpDuration": 8, - "transitions": [ - { - "var": "isNotTurning", - "state": "idle" - }, - { - "var": "isMovingForward", - "state": "WALKFWD" - }, - { - "var": "isMovingBackward", - "state": "WALKBWD" - }, - { - "var": "isMovingRight", - "state": "STRAFERIGHT" - }, - { - "var": "isMovingLeft", - "state": "STRAFELEFT" - }, - { - "var": "isTurningLeft", - "state": "turnLeft" - }, - { - "var": "isFlying", - "state": "fly" - }, - { - "var": "isTakeoffStand", - "state": "takeoffStand" - }, - { - "var": "isTakeoffRun", - "state": "TAKEOFFRUN" - }, - { - "var": "isInAirStand", - "state": "inAirStand" - }, - { - "var": "isInAirRun", - "state": "INAIRRUN" - }, - { - "var": "isMovingRightHmd", - "state": "strafeRightHmd" - }, - { - "var": "isMovingLeftHmd", - "state": "strafeLeftHmd" - } - ] - }, - { - "id": "turnLeft", - "interpTarget": 6, - "interpDuration": 8, - "transitions": [ - { - "var": "isNotTurning", - "state": "idle" - }, - { - "var": "isMovingForward", - "state": "WALKFWD" - }, - { - "var": "isMovingBackward", - "state": "WALKBWD" - }, - { - "var": "isMovingRight", - "state": "STRAFERIGHT" - }, - { - "var": "isMovingLeft", - "state": "STRAFELEFT" - }, - { - "var": "isTurningRight", - "state": "turnRight" - }, - { - "var": "isFlying", - "state": "fly" - }, - { - "var": "isTakeoffStand", - "state": "takeoffStand" - }, - { - "var": "isTakeoffRun", - "state": "TAKEOFFRUN" - }, - { - "var": "isInAirStand", - "state": "inAirStand" - }, - { - "var": "isInAirRun", - "state": "INAIRRUN" - }, - { - "var": "isMovingRightHmd", - "state": "strafeRightHmd" - }, - { - "var": "isMovingLeftHmd", - "state": "strafeLeftHmd" - } - ] - }, - { - "id": "strafeRightHmd", - "interpTarget": 5, - "interpDuration": 8, - "interpType": "snapshotPrev", - "transitions": [ - { - "var": "isNotMoving", - "state": "idleSettle" - }, - { - "var": "isMovingForward", - "state": "WALKFWD" - }, - { - "var": "isMovingBackward", - "state": "WALKBWD" - }, - { - "var": "isMovingLeftHmd", - "state": "strafeLeftHmd" - }, - { - "var": "isMovingRight", - "state": "STRAFERIGHT" - }, - { - "var": "isMovingLeft", - "state": "STRAFELEFT" - }, - { - "var": "isTurningRight", - "state": "turnRight" - }, - { - "var": "isTurningLeft", - "state": "turnLeft" - }, - { - "var": "isFlying", - "state": "fly" - }, - { - "var": "isTakeoffStand", - "state": "takeoffStand" - }, - { - "var": "isTakeoffRun", - "state": "TAKEOFFRUN" - }, - { - "var": "isInAirStand", - "state": "inAirStand" - }, - { - "var": "isInAirRun", - "state": "INAIRRUN" - } - ] - }, - { - "id": "strafeLeftHmd", - "interpTarget": 5, - "interpDuration": 8, - "interpType": "snapshotPrev", - "transitions": [ - { - "var": "isNotMoving", - "state": "idleSettle" - }, - { - "var": "isMovingForward", - "state": "WALKFWD" - }, - { - "var": "isMovingBackward", - "state": "WALKBWD" - }, - { - "var": "isMovingRightHmd", - "state": "strafeRightHmd" - }, - { - "var": "isMovingRight", - "state": "STRAFERIGHT" - }, - { - "var": "isMovingLeft", - "state": "STRAFELEFT" - }, - { - "var": "isTurningRight", - "state": "turnRight" - }, - { - "var": "isTurningLeft", - "state": "turnLeft" - }, - { - "var": "isFlying", - "state": "fly" - }, - { - "var": "isTakeoffStand", - "state": "takeoffStand" - }, - { - "var": "isTakeoffRun", - "state": "TAKEOFFRUN" - }, - { - "var": "isInAirStand", - "state": "inAirStand" - }, - { - "var": "isInAirRun", - "state": "INAIRRUN" - } - ] - }, - { - "id": "fly", - "interpTarget": 6, - "interpDuration": 6, - "transitions": [ - { - "var": "isNotFlying", - "state": "idleSettle" - } - ] - }, - { - "id": "takeoffStand", - "interpTarget": 2, - "interpDuration": 2, - "transitions": [ - { - "var": "isNotTakeoff", - "state": "inAirStand" - } - ] - }, - { - "id": "TAKEOFFRUN", - "interpTarget": 2, - "interpDuration": 2, - "transitions": [ - { - "var": "isNotTakeoff", - "state": "INAIRRUN" - } - ] - }, - { - "id": "inAirStand", - "interpTarget": 3, - "interpDuration": 3, - "interpType": "snapshotPrev", - "transitions": [ - { - "var": "isNotInAir", - "state": "landStandImpact" - } - ] - }, - { - "id": "INAIRRUN", - "interpTarget": 3, - "interpDuration": 3, - "interpType": "snapshotPrev", - "transitions": [ - { - "var": "isNotInAir", - "state": "WALKFWD" - } - ] - }, - { - "id": "landStandImpact", - "interpTarget": 1, - "interpDuration": 1, - "transitions": [ - { - "var": "isFlying", - "state": "fly" - }, - { - "var": "isTakeoffStand", - "state": "takeoffStand" - }, - { - "var": "isTakeoffRun", - "state": "TAKEOFFRUN" - }, - { - "var": "landStandImpactOnDone", - "state": "landStand" - } - ] - }, - { - "id": "landStand", - "interpTarget": 1, - "interpDuration": 1, - "transitions": [ - { - "var": "isMovingForward", - "state": "WALKFWD" - }, - { - "var": "isMovingBackward", - "state": "WALKBWD" - }, - { - "var": "isMovingRight", - "state": "STRAFERIGHT" - }, - { - "var": "isMovingLeft", - "state": "STRAFELEFT" - }, - { - "var": "isTurningRight", - "state": "turnRight" - }, - { - "var": "isTurningLeft", - "state": "turnLeft" - }, - { - "var": "isFlying", - "state": "fly" - }, - { - "var": "isTakeoffStand", - "state": "takeoffStand" - }, - { - "var": "isTakeoffRun", - "state": "TAKEOFFRUN" - }, - { - "var": "isInAirStand", - "state": "inAirStand" - }, - { - "var": "isInAirRun", - "state": "INAIRRUN" - }, - { - "var": "landStandOnDone", - "state": "idle" - }, - { - "var": "isMovingRightHmd", - "state": "strafeRightHmd" - }, - { - "var": "isMovingLeftHmd", - "state": "strafeLeftHmd" - } - ] - }, - { - "id": "LANDRUN", - "interpTarget": 2, - "interpDuration": 2, - "transitions": [ - { - "var": "isFlying", - "state": "fly" - }, - { - "var": "isTakeoffStand", - "state": "takeoffStand" - }, - { - "var": "isTakeoffRun", - "state": "TAKEOFFRUN" - }, - { - "var": "landRunOnDone", - "state": "WALKFWD" - } - ] - } - ] - }, - "children": [ - { - "id": "idle", - "type": "stateMachine", - "data": { - "currentState": "idleStand", - "states": [ - { - "id": "idleStand", - "interpTarget": 6, - "interpDuration": 10, - "transitions": [ - { - "var": "isTalking", - "state": "idleTalk" - } - ] - }, - { - "id": "idleTalk", - "interpTarget": 6, - "interpDuration": 10, - "transitions": [ - { - "var": "notIsTalking", - "state": "idleStand" - } - ] - } - ] - }, - "children": [ - { - "id": "idleStand", - "type": "clip", - "data": { - "url": "qrc:///avatar/animations/idle.fbx", - "startFrame": 0.0, - "endFrame": 300.0, - "timeScale": 1.0, - "loopFlag": true - }, - "children": [] - }, - { - "id": "idleTalk", - "type": "clip", - "data": { - "url": "qrc:///avatar/animations/talk.fbx", - "startFrame": 0.0, - "endFrame": 800.0, - "timeScale": 1.0, - "loopFlag": true - }, - "children": [] - } - ] - }, - { - "id": "WALKFWD", - "type": "blendLinearMove", - "data": { - "alpha": 0.0, - "desiredSpeed": 1.4, - "characteristicSpeeds": [ 0.5, 1.8, 2.3, 3.2, 4.5 ], - "alphaVar": "moveForwardAlpha", - "desiredSpeedVar": "moveForwardSpeed" - }, - "children": [ - { - "id": "walkFwdShort_c", - "type": "clip", - "data": { - "url": "qrc:///avatar/animations/walk_short_fwd.fbx", - "startFrame": 0.0, - "endFrame": 39.0, - "timeScale": 1.0, - "loopFlag": true - }, - "children": [] - }, - { - "id": "walkFwdNormal_c", - "type": "clip", - "data": { - "url": "qrc:///avatar/animations/walk_fwd.fbx", - "startFrame": 0.0, - "endFrame": 30.0, - "timeScale": 1.0, - "loopFlag": true - }, - "children": [] - }, - { - "id": "walkFwdFast_c", - "type": "clip", - "data": { - "url": "qrc:///avatar/animations/walk_fwd_fast.fbx", - "startFrame": 0.0, - "endFrame": 25.0, - "timeScale": 1.0, - "loopFlag": true - }, - "children": [] - }, - { - "id": "walkFwdJog_c", - "type": "clip", - "data": { - "url": "qrc:///avatar/animations/jog_fwd.fbx", - "startFrame": 0.0, - "endFrame": 25.0, - "timeScale": 1.0, - "loopFlag": true - }, - "children": [] - }, - { - "id": "walkFwdRun_c", - "type": "clip", - "data": { - "url": "qrc:///avatar/animations/run_fwd.fbx", - "startFrame": 0.0, - "endFrame": 21.0, - "timeScale": 1.0, - "loopFlag": true - }, - "children": [] - } - ] - }, - { - "id": "idleToWalkFwd", - "type": "clip", - "data": { - "url": "qrc:///avatar/animations/idle_to_walk.fbx", - "startFrame": 1.0, - "endFrame": 13.0, - "timeScale": 1.0, - "loopFlag": false - }, - "children": [] - }, - { - "id": "idleSettle", - "type": "clip", - "data": { - "url": "qrc:///avatar/animations/settle_to_idle.fbx", - "startFrame": 1.0, - "endFrame": 59.0, - "timeScale": 1.0, - "loopFlag": false - }, - "children": [] - }, - { - "id": "WALKBWD", - "type": "blendLinearMove", - "data": { - "alpha": 0.0, - "desiredSpeed": 1.4, - "characteristicSpeeds": [ 0.6, 1.6, 2.3, 3.1 ], - "alphaVar": "moveBackwardAlpha", - "desiredSpeedVar": "moveBackwardSpeed" - }, - "children": [ - { - "id": "walkBwdShort_c", - "type": "clip", - "data": { - "url": "qrc:///avatar/animations/walk_short_bwd.fbx", - "startFrame": 0.0, - "endFrame": 38.0, - "timeScale": 1.0, - "loopFlag": true - }, - "children": [] - }, - { - "id": "walkBwdFast_c", - "type": "clip", - "data": { - "url": "qrc:///avatar/animations/walk_bwd_fast.fbx", - "startFrame": 0.0, - "endFrame": 27.0, - "timeScale": 1.0, - "loopFlag": true - }, - "children": [] - }, - { - "id": "jogBwd_c", - "type": "clip", - "data": { - "url": "qrc:///avatar/animations/jog_bwd.fbx", - "startFrame": 0.0, - "endFrame": 24.0, - "timeScale": 1.0, - "loopFlag": true - }, - "children": [] - }, - { - "id": "runBwd_c", - "type": "clip", - "data": { - "url": "qrc:///avatar/animations/run_bwd.fbx", - "startFrame": 0.0, - "endFrame": 16.0, - "timeScale": 1.0, - "loopFlag": true - }, - "children": [] - } - ] - }, - { - "id": "turnLeft", - "type": "clip", - "data": { - "url": "qrc:///avatar/animations/turn_left.fbx", - "startFrame": 0.0, - "endFrame": 32.0, - "timeScale": 1.0, - "loopFlag": true - }, - "children": [] - }, - { - "id": "turnRight", - "type": "clip", - "data": { - "url": "qrc:///avatar/animations/turn_left.fbx", - "startFrame": 0.0, - "endFrame": 32.0, - "timeScale": 1.0, - "loopFlag": true, - "mirrorFlag": true - }, - "children": [] - }, - { - "id": "STRAFELEFT", - "type": "blendLinearMove", - "data": { - "alpha": 0.0, - "desiredSpeed": 1.4, - "characteristicSpeeds": [ 0.1, 0.5, 1.0, 2.6, 3.0 ], - "alphaVar": "moveLateralAlpha", - "desiredSpeedVar": "moveLateralSpeed" - }, - "children": [ - { - "id": "strafeLeftShortStep_c", - "type": "clip", - "data": { - "url": "qrc:///avatar/animations/side_step_short_left.fbx", - "startFrame": 0.0, - "endFrame": 29.0, - "timeScale": 1.0, - "loopFlag": true - }, - "children": [] - }, - { - "id": "strafeLeftStep_c", - "type": "clip", - "data": { - "url": "qrc:///avatar/animations/side_step_left.fbx", - "startFrame": 0.0, - "endFrame": 20.0, - "timeScale": 1.0, - "loopFlag": true - }, - "children": [] - }, - { - "id": "strafeLeftWalk_c", - "type": "clip", - "data": { - "url": "qrc:///avatar/animations/walk_left.fbx", - "startFrame": 0.0, - "endFrame": 35.0, - "timeScale": 1.0, - "loopFlag": true - }, - "children": [] - }, - { - "id": "strafeLeftWalkFast_c", - "type": "clip", - "data": { - "url": "qrc:///avatar/animations/walk_left_fast.fbx", - "startFrame": 0.0, - "endFrame": 21.0, - "timeScale": 1.0, - "loopFlag": true - }, - "children": [] - }, - { - "id": "strafeLeftJog_c", - "type": "clip", - "data": { - "url": "qrc:///avatar/animations/jog_left.fbx", - "startFrame": 0.0, - "endFrame": 24.0, - "timeScale": 1.0, - "loopFlag": true - }, - "children": [] - } - ] - }, - { - "id": "STRAFERIGHT", - "type": "blendLinearMove", - "data": { - "alpha": 0.0, - "desiredSpeed": 1.4, - "characteristicSpeeds": [ 0.1, 0.5, 1.0, 2.6, 3.0 ], - "alphaVar": "moveLateralAlpha", - "desiredSpeedVar": "moveLateralSpeed" - }, - "children": [ - { - "id": "strafeRightShortStep_c", - "type": "clip", - "data": { - "url": "qrc:///avatar/animations/side_step_short_left.fbx", - "startFrame": 0.0, - "endFrame": 29.0, - "timeScale": 1.0, - "loopFlag": true, - "mirrorFlag": true - }, - "children": [] - }, - { - "id": "strafeRightStep_c", - "type": "clip", - "data": { - "url": "qrc:///avatar/animations/side_step_left.fbx", - "startFrame": 0.0, - "endFrame": 20.0, - "timeScale": 1.0, - "loopFlag": true, - "mirrorFlag": true - }, - "children": [] - }, - { - "id": "strafeRightWalk_c", - "type": "clip", - "data": { - "url": "qrc:///avatar/animations/walk_left.fbx", - "startFrame": 0.0, - "endFrame": 35.0, - "timeScale": 1.0, - "loopFlag": true, - "mirrorFlag": true - }, - "children": [] - }, - { - "id": "strafeRightFast_c", - "type": "clip", - "data": { - "url": "qrc:///avatar/animations/walk_left_fast.fbx", - "startFrame": 0.0, - "endFrame": 21.0, - "timeScale": 1.0, - "loopFlag": true, - "mirrorFlag": true - }, - "children": [] - }, - { - "id": "strafeRightJog_c", - "type": "clip", - "data": { - "url": "qrc:///avatar/animations/jog_left.fbx", - "startFrame": 0.0, - "endFrame": 24.0, - "timeScale": 1.0, - "loopFlag": true, - "mirrorFlag": true - }, - "children": [] - } - ] - }, - { - "id": "strafeLeftHmd", - "type": "blendLinearMove", - "data": { - "alpha": 0.0, - "desiredSpeed": 1.4, - "characteristicSpeeds": [ 0, 0.5, 2.5 ], - "alphaVar": "moveLateralAlpha", - "desiredSpeedVar": "moveLateralSpeed" - }, - "children": [ - { - "id": "stepLeftShort_c", - "type": "clip", - "data": { - "url": "qrc:///avatar/animations/side_step_short_left.fbx", - "startFrame": 0.0, - "endFrame": 29.0, - "timeScale": 1.0, - "loopFlag": true - }, - "children": [] - }, - { - "id": "stepLeft_c", - "type": "clip", - "data": { - "url": "qrc:///avatar/animations/side_step_left.fbx", - "startFrame": 0.0, - "endFrame": 20.0, - "timeScale": 1.0, - "loopFlag": true - }, - "children": [] - }, - { - "id": "strafeLeftAnim_c", - "type": "clip", - "data": { - "url": "qrc:///avatar/animations/side_step_left_fast.fbx", - "startFrame": 0.0, - "endFrame": 16.0, - "timeScale": 1.0, - "loopFlag": true - }, - "children": [] - } - ] - }, - { - "id": "strafeRightHmd", - "type": "blendLinearMove", - "data": { - "alpha": 0.0, - "desiredSpeed": 1.4, - "characteristicSpeeds": [ 0, 0.5, 2.5 ], - "alphaVar": "moveLateralAlpha", - "desiredSpeedVar": "moveLateralSpeed" - }, - "children": [ - { - "id": "stepRightShort_c", - "type": "clip", - "data": { - "url": "qrc:///avatar/animations/side_step_short_left.fbx", - "startFrame": 0.0, - "endFrame": 29.0, - "timeScale": 1.0, - "loopFlag": true, - "mirrorFlag": true - }, - "children": [] - }, - { - "id": "stepRight_c", - "type": "clip", - "data": { - "url": "qrc:///avatar/animations/side_step_left.fbx", - "startFrame": 0.0, - "endFrame": 20.0, - "timeScale": 1.0, - "loopFlag": true, - "mirrorFlag": true - }, - "children": [] - }, - { - "id": "strafeRightAnim_c", - "type": "clip", - "data": { - "url": "qrc:///avatar/animations/side_step_left_fast.fbx", - "startFrame": 0.0, - "endFrame": 16.0, - "timeScale": 1.0, - "loopFlag": true, - "mirrorFlag": true - }, - "children": [] - } - ] - }, - { - "id": "fly", - "type": "clip", - "data": { - "url": "qrc:///avatar/animations/fly.fbx", - "startFrame": 1.0, - "endFrame": 80.0, - "timeScale": 1.0, - "loopFlag": true - }, - "children": [] - }, - { - "id": "takeoffStand", - "type": "clip", - "data": { - "url": "qrc:///avatar/animations/jump_standing_launch.fbx", - "startFrame": 2.0, - "endFrame": 16.0, - "timeScale": 1.0, - "loopFlag": false - }, - "children": [] - }, - { - "id": "TAKEOFFRUN", - "type": "clip", - "data": { - "url": "qrc:///avatar/animations/jump_running_launch_land.fbx", - "startFrame": 4.0, - "endFrame": 15.0, - "timeScale": 1.0, - "loopFlag": false - }, - "children": [] - }, - { - "id": "inAirStand", - "type": "blendLinear", - "data": { - "alpha": 0.0, - "alphaVar": "inAirAlpha" - }, - "children": [ - { - "id": "inAirStandPreApex", - "type": "clip", - "data": { - "url": "qrc:///avatar/animations/jump_standing_apex.fbx", - "startFrame": 0.0, - "endFrame": 0.0, - "timeScale": 1.0, - "loopFlag": false - }, - "children": [] - }, - { - "id": "inAirStandApex", - "type": "clip", - "data": { - "url": "qrc:///avatar/animations/jump_standing_apex.fbx", - "startFrame": 1.0, - "endFrame": 1.0, - "timeScale": 1.0, - "loopFlag": false - }, - "children": [] - }, - { - "id": "inAirStandPostApex", - "type": "clip", - "data": { - "url": "qrc:///avatar/animations/jump_standing_apex.fbx", - "startFrame": 2.0, - "endFrame": 2.0, - "timeScale": 1.0, - "loopFlag": false - }, - "children": [] - } - ] - }, - { - "id": "INAIRRUN", - "type": "blendLinear", - "data": { - "alpha": 0.0, - "alphaVar": "inAirAlpha" - }, - "children": [ - { - "id": "inAirRunPreApex", - "type": "clip", - "data": { - "url": "qrc:///avatar/animations/jump_running_launch_land.fbx", - "startFrame": 16.0, - "endFrame": 16.0, - "timeScale": 1.0, - "loopFlag": false - }, - "children": [] - }, - { - "id": "inAirRunApex", - "type": "clip", - "data": { - "url": "qrc:///avatar/animations/jump_running_launch_land.fbx", - "startFrame": 22.0, - "endFrame": 22.0, - "timeScale": 1.0, - "loopFlag": false - }, - "children": [] - }, - { - "id": "inAirRunPostApex", - "type": "clip", - "data": { - "url": "qrc:///avatar/animations/jump_running_launch_land.fbx", - "startFrame": 33.0, - "endFrame": 33.0, - "timeScale": 1.0, - "loopFlag": false - }, - "children": [] - } - ] - }, - { - "id": "landStandImpact", - "type": "clip", - "data": { - "url": "qrc:///avatar/animations/jump_standing_land_settle.fbx", - "startFrame": 1.0, - "endFrame": 6.0, - "timeScale": 1.0, - "loopFlag": false - }, - "children": [] - }, - { - "id": "landStand", - "type": "clip", - "data": { - "url": "qrc:///avatar/animations/jump_standing_land_settle.fbx", - "startFrame": 6.0, - "endFrame": 68.0, - "timeScale": 1.0, - "loopFlag": false - }, - "children": [] - }, - { - "id": "LANDRUN", - "type": "clip", - "data": { - "url": "qrc:///avatar/animations/jump_running_launch_land.fbx", - "startFrame": 29.0, - "endFrame": 40.0, - "timeScale": 1.0, - "loopFlag": false - }, - "children": [] - } - ] - } - ] - } - ] - } - ] - } - ] - } - ] - } - ] - } - ] - } - ] - } - ] - } - ] - } - ] - } - ] - }, - { - "id": "userAnimA", - "type": "clip", - "data": { - "url": "qrc:///avatar/animations/idle.fbx", - "startFrame": 0.0, - "endFrame": 90.0, - "timeScale": 1.0, - "loopFlag": true - }, - "children": [] - }, - { - "id": "userAnimB", - "type": "clip", - "data": { - "url": "qrc:///avatar/animations/idle.fbx", - "startFrame": 0.0, - "endFrame": 90.0, - "timeScale": 1.0, - "loopFlag": true - }, - "children": [] - } - ] - } -} diff --git a/interface/resources/avatar/avatar-animation_withIKNode.json b/interface/resources/avatar/avatar-animation_withSplineIKNode.json similarity index 100% rename from interface/resources/avatar/avatar-animation_withIKNode.json rename to interface/resources/avatar/avatar-animation_withSplineIKNode.json From 2679a3a30d554805914ae974907a359d03d53748 Mon Sep 17 00:00:00 2001 From: Angus Antley Date: Sun, 27 Jan 2019 16:30:13 -0800 Subject: [PATCH 032/436] changed the naming of the middle joint from secondary target to midJoint, also generalized the handling of the neck head rotation after the middle spline is updated --- .../avatar-animation_withSplineIKNode.json | 6 +- libraries/animation/src/AnimNodeLoader.cpp | 13 ++-- libraries/animation/src/AnimSplineIK.cpp | 77 ++++++++----------- libraries/animation/src/AnimSplineIK.h | 13 +--- 4 files changed, 46 insertions(+), 63 deletions(-) diff --git a/interface/resources/avatar/avatar-animation_withSplineIKNode.json b/interface/resources/avatar/avatar-animation_withSplineIKNode.json index bd0baf473e..40572f698b 100644 --- a/interface/resources/avatar/avatar-animation_withSplineIKNode.json +++ b/interface/resources/avatar/avatar-animation_withSplineIKNode.json @@ -182,14 +182,14 @@ "enabled": false, "interpDuration": 15, "baseJointName": "Hips", + "midJointName": "Spine2", "tipJointName": "Head", - "secondaryTargetJointName": "Spine2", "basePositionVar": "hipsPosition", "baseRotationVar": "hipsRotation", + "midPositionVar": "spine2Position", + "midRotationVar": "spine2Rotation", "tipPositionVar": "headPosition", "tipRotationVar": "headRotation", - "secondaryTargetPositionVar": "spine2Position", - "secondaryTargetRotationVar": "spine2Rotation", "alphaVar": "splineIKAlpha", "enabledVar": "splineIKEnabled", "endEffectorRotationVarVar": "splineIKRotationVar", diff --git a/libraries/animation/src/AnimNodeLoader.cpp b/libraries/animation/src/AnimNodeLoader.cpp index bce242b50d..8a19b763bb 100644 --- a/libraries/animation/src/AnimNodeLoader.cpp +++ b/libraries/animation/src/AnimNodeLoader.cpp @@ -584,14 +584,14 @@ static AnimNode::Pointer loadSplineIKNode(const QJsonObject& jsonObj, const QStr READ_BOOL(enabled, jsonObj, id, jsonUrl, nullptr); READ_FLOAT(interpDuration, jsonObj, id, jsonUrl, nullptr); READ_STRING(baseJointName, jsonObj, id, jsonUrl, nullptr); + READ_STRING(midJointName, jsonObj, id, jsonUrl, nullptr); READ_STRING(tipJointName, jsonObj, id, jsonUrl, nullptr); - READ_STRING(secondaryTargetJointName, jsonObj, id, jsonUrl, nullptr); READ_STRING(basePositionVar, jsonObj, id, jsonUrl, nullptr); READ_STRING(baseRotationVar, jsonObj, id, jsonUrl, nullptr); + READ_STRING(midPositionVar, jsonObj, id, jsonUrl, nullptr); + READ_STRING(midRotationVar, jsonObj, id, jsonUrl, nullptr); READ_STRING(tipPositionVar, jsonObj, id, jsonUrl, nullptr); READ_STRING(tipRotationVar, jsonObj, id, jsonUrl, nullptr); - READ_STRING(secondaryTargetPositionVar, jsonObj, id, jsonUrl, nullptr); - READ_STRING(secondaryTargetRotationVar, jsonObj, id, jsonUrl, nullptr); READ_STRING(alphaVar, jsonObj, id, jsonUrl, nullptr); READ_STRING(enabledVar, jsonObj, id, jsonUrl, nullptr); READ_STRING(endEffectorRotationVarVar, jsonObj, id, jsonUrl, nullptr); @@ -600,11 +600,10 @@ static AnimNode::Pointer loadSplineIKNode(const QJsonObject& jsonObj, const QStr READ_STRING(secondaryFlexCoefficients, jsonObj, id, jsonUrl, nullptr); auto node = std::make_shared(id, alpha, enabled, interpDuration, - baseJointName, tipJointName, + baseJointName, midJointName, tipJointName, alphaVar, enabledVar, endEffectorRotationVarVar, endEffectorPositionVarVar, - basePositionVar, baseRotationVar, - tipPositionVar, tipRotationVar, secondaryTargetJointName, secondaryTargetPositionVar, - secondaryTargetRotationVar, primaryFlexCoefficients, secondaryFlexCoefficients); + basePositionVar, baseRotationVar, midPositionVar, midRotationVar, + tipPositionVar, tipRotationVar, primaryFlexCoefficients, secondaryFlexCoefficients); return node; } diff --git a/libraries/animation/src/AnimSplineIK.cpp b/libraries/animation/src/AnimSplineIK.cpp index b38850773d..27e295ffb0 100644 --- a/libraries/animation/src/AnimSplineIK.cpp +++ b/libraries/animation/src/AnimSplineIK.cpp @@ -19,16 +19,16 @@ static const float FRAMES_PER_SECOND = 30.0f; AnimSplineIK::AnimSplineIK(const QString& id, float alpha, bool enabled, float interpDuration, const QString& baseJointName, + const QString& midJointName, const QString& tipJointName, const QString& alphaVar, const QString& enabledVar, const QString& endEffectorRotationVarVar, const QString& endEffectorPositionVarVar, const QString& basePositionVar, const QString& baseRotationVar, + const QString& midPositionVar, + const QString& midRotationVar, const QString& tipPositionVar, const QString& tipRotationVar, - const QString& secondaryTargetJointName, - const QString& secondaryTargetPositionVar, - const QString& secondaryTargetRotationVar, const QString& primaryFlexCoefficients, const QString& secondaryFlexCoefficients) : AnimNode(AnimNode::Type::SplineIK, id), @@ -36,6 +36,7 @@ AnimSplineIK::AnimSplineIK(const QString& id, float alpha, bool enabled, float i _enabled(enabled), _interpDuration(interpDuration), _baseJointName(baseJointName), + _midJointName(midJointName), _tipJointName(tipJointName), _alphaVar(alphaVar), _enabledVar(enabledVar), @@ -45,11 +46,10 @@ AnimSplineIK::AnimSplineIK(const QString& id, float alpha, bool enabled, float i _prevEndEffectorPositionVar(), _basePositionVar(basePositionVar), _baseRotationVar(baseRotationVar), + _midPositionVar(midPositionVar), + _midRotationVar(midRotationVar), _tipPositionVar(tipPositionVar), - _tipRotationVar(tipRotationVar), - _secondaryTargetJointName(secondaryTargetJointName), - _secondaryTargetPositionVar(secondaryTargetPositionVar), - _secondaryTargetRotationVar(secondaryTargetRotationVar) + _tipRotationVar(tipRotationVar) { QStringList flexCoefficientsValues = primaryFlexCoefficients.split(',', QString::SkipEmptyParts); @@ -182,17 +182,17 @@ const AnimPoseVec& AnimSplineIK::evaluate(const AnimVariantMap& animVars, const qCDebug(animation) << "the orig target pose for head " << target.getPose(); jointChain.outputRelativePoses(_poses); - AnimPose afterSolveSecondaryTarget = _skeleton->getAbsolutePose(_secondaryTargetIndex, _poses); - glm::quat secondaryTargetRotation = animVars.lookupRigToGeometry(_secondaryTargetRotationVar, afterSolveSecondaryTarget.rot()); + AnimPose afterSolveSecondaryTarget = _skeleton->getAbsolutePose(_midJointIndex, _poses); + glm::quat secondaryTargetRotation = animVars.lookupRigToGeometry(_midRotationVar, afterSolveSecondaryTarget.rot()); updatedSecondaryTarget = AnimPose(secondaryTargetRotation, afterSolveSecondaryTarget.trans()); //updatedSecondaryTarget = AnimPose(afterSolveSecondaryTarget.rot(), afterSolveSecondaryTarget.trans()); } IKTarget secondaryTarget; computeAbsolutePoses(absolutePoses2); - if (_secondaryTargetIndex != -1) { + if (_midJointIndex != -1) { secondaryTarget.setType((int)IKTarget::Type::Spline); - secondaryTarget.setIndex(_secondaryTargetIndex); + secondaryTarget.setIndex(_midJointIndex); float weight2 = 1.0f; secondaryTarget.setPose(updatedSecondaryTarget.rot(), updatedSecondaryTarget.trans()); @@ -204,8 +204,17 @@ const AnimPoseVec& AnimSplineIK::evaluate(const AnimVariantMap& animVars, const AnimChain secondaryJointChain; AnimPose beforeSolveChestNeck; + int startJoint; + AnimPose correctJoint; if (_poses.size() > 0) { + // start at the tip + + for (startJoint = _tipJointIndex; _skeleton->getParentIndex(startJoint) != _midJointIndex; startJoint = _skeleton->getParentIndex(startJoint)) { + // find the child of the midJoint + } + correctJoint = _skeleton->getAbsolutePose(startJoint, _poses); + // fix this to deal with no neck AA beforeSolveChestNeck = _skeleton->getAbsolutePose(_skeleton->nameToJointIndex("Neck"), _poses); @@ -216,16 +225,19 @@ const AnimPoseVec& AnimSplineIK::evaluate(const AnimVariantMap& animVars, const // set the tip/head rotation to match the absolute rotation of the target. int tipParent = _skeleton->getParentIndex(_tipJointIndex); - int secondaryTargetParent = _skeleton->getParentIndex(_secondaryTargetIndex); + int secondaryTargetParent = _skeleton->getParentIndex(_midJointIndex); if ((secondaryTargetParent != -1) && (tipParent != -1) && (_poses.size() > 0)) { - AnimPose secondaryTargetPose(secondaryTarget.getRotation(), secondaryTarget.getTranslation()); - AnimPose neckAbsolute = _skeleton->getAbsolutePose(tipParent, _poses); - _poses[tipParent] = secondaryTargetPose.inverse() * beforeSolveChestNeck; + - AnimPose tipTarget(target.getRotation(),target.getTranslation()); - AnimPose tipRelativePose = _skeleton->getAbsolutePose(tipParent,_poses).inverse() * tipTarget; - _poses[_tipJointIndex] = tipRelativePose; + AnimPose secondaryTargetPose(secondaryTarget.getRotation(), secondaryTarget.getTranslation()); + //AnimPose neckAbsolute = _skeleton->getAbsolutePose(tipParent, _poses); + //_poses[tipParent] = secondaryTargetPose.inverse() * beforeSolveChestNeck; + _poses[startJoint] = secondaryTargetPose.inverse() * correctJoint; + + //AnimPose tipTarget(target.getRotation(),target.getTranslation()); + //AnimPose tipRelativePose = _skeleton->getAbsolutePose(tipParent,_poses).inverse() * tipTarget; + //_poses[_tipJointIndex] = tipRelativePose; } // compute chain @@ -311,12 +323,12 @@ void AnimSplineIK::lookUpIndices() { assert(_skeleton); // look up bone indices by name - std::vector indices = _skeleton->lookUpJointIndices({ _baseJointName, _tipJointName, _secondaryTargetJointName }); + std::vector indices = _skeleton->lookUpJointIndices({ _baseJointName, _tipJointName, _midJointName }); // cache the results _baseJointIndex = indices[0]; _tipJointIndex = indices[1]; - _secondaryTargetIndex = indices[2]; + _midJointIndex = indices[2]; if (_baseJointIndex != -1) { _baseParentJointIndex = _skeleton->getParentIndex(_baseJointIndex); @@ -362,7 +374,7 @@ static CubicHermiteSplineFunctorWithArcLength computeSplineFromTipAndBase(const void AnimSplineIK::solveTargetWithSpline(const AnimContext& context, const IKTarget& target, const AnimPoseVec& absolutePoses, bool debug, AnimChain& chainInfoOut) const { const int baseIndex = _baseJointIndex; - const int tipBaseIndex = _secondaryTargetIndex; + const int tipBaseIndex = _midJointIndex; // build spline from tip to base AnimPose tipPose = AnimPose(glm::vec3(1.0f), target.getRotation(), target.getTranslation()); @@ -556,29 +568,6 @@ void AnimSplineIK::loadPoses(const AnimPoseVec& poses) { } } - -void AnimSplineIK::setTargetVars(const QString& jointName, const QString& positionVar, const QString& rotationVar, - const QString& typeVar, const QString& weightVar, float weight, const std::vector& flexCoefficients, - const QString& poleVectorEnabledVar, const QString& poleReferenceVectorVar, const QString& poleVectorVar) { - /* - IKTargetVar targetVar(jointName, positionVar, rotationVar, typeVar, weightVar, weight, flexCoefficients, poleVectorEnabledVar, poleReferenceVectorVar, poleVectorVar); - - // if there are dups, last one wins. - bool found = false; - for (auto& targetVarIter : _targetVarVec) { - if (targetVarIter.jointName == jointName) { - targetVarIter = targetVar; - found = true; - break; - } - } - if (!found) { - // create a new entry - _targetVarVec.push_back(targetVar); - } - */ -} - void AnimSplineIK::beginInterp(InterpType interpType, const AnimChain& chain) { // capture the current poses in a snapshot. _snapshotChain = chain; diff --git a/libraries/animation/src/AnimSplineIK.h b/libraries/animation/src/AnimSplineIK.h index c6d435fd6b..b05c5f4849 100644 --- a/libraries/animation/src/AnimSplineIK.h +++ b/libraries/animation/src/AnimSplineIK.h @@ -60,15 +60,13 @@ protected: float _interpDuration; QString _baseJointName; QString _tipJointName; - QString _secondaryTargetJointName; + QString _midJointName; QString _basePositionVar; QString _baseRotationVar; + QString _midPositionVar; + QString _midRotationVar; QString _tipPositionVar; QString _tipRotationVar; - QString _secondaryTargetPositionVar; - QString _secondaryTargetRotationVar; - //QString _primaryFlexCoefficients; - //QString _secondaryFlexCoefficients; static const int MAX_NUMBER_FLEX_VARIABLES = 10; float _primaryFlexCoefficients[MAX_NUMBER_FLEX_VARIABLES]; @@ -78,7 +76,7 @@ protected: int _baseParentJointIndex { -1 }; int _baseJointIndex { -1 }; - int _secondaryTargetIndex { -1 }; + int _midJointIndex { -1 }; int _tipJointIndex { -1 }; int _headIndex { -1 }; int _hipsIndex { -1 }; @@ -110,9 +108,6 @@ protected: bool _lastEnableDebugDrawIKTargets{ false }; void AnimSplineIK::solveTargetWithSpline(const AnimContext& context, const IKTarget& target, const AnimPoseVec& absolutePoses, bool debug, AnimChain& chainInfoOut) const; - void AnimSplineIK::setTargetVars(const QString& jointName, const QString& positionVar, const QString& rotationVar, - const QString& typeVar, const QString& weightVar, float weight, const std::vector& flexCoefficients, - const QString& poleVectorEnabledVar, const QString& poleReferenceVectorVar, const QString& poleVectorVar); void computeAndCacheSplineJointInfosForIKTarget(const AnimContext& context, const IKTarget& target) const; const std::vector* findOrCreateSplineJointInfo(const AnimContext& context, const IKTarget& target) const; mutable std::map> _splineJointInfoMap; From f8bfef6dbd6d96232bb97012fe50aff26038e1bb Mon Sep 17 00:00:00 2001 From: amantley Date: Mon, 28 Jan 2019 11:50:23 -0800 Subject: [PATCH 033/436] cleaning up the _hipsIndex references, cleaning in general --- .../avatar-animation_withSplineIKNode.json | 4 +- libraries/animation/src/AnimNodeLoader.cpp | 6 +- libraries/animation/src/AnimSplineIK.cpp | 157 +++++++++--------- libraries/animation/src/AnimSplineIK.h | 18 +- 4 files changed, 85 insertions(+), 100 deletions(-) diff --git a/interface/resources/avatar/avatar-animation_withSplineIKNode.json b/interface/resources/avatar/avatar-animation_withSplineIKNode.json index 40572f698b..aac1312e72 100644 --- a/interface/resources/avatar/avatar-animation_withSplineIKNode.json +++ b/interface/resources/avatar/avatar-animation_withSplineIKNode.json @@ -194,8 +194,8 @@ "enabledVar": "splineIKEnabled", "endEffectorRotationVarVar": "splineIKRotationVar", "endEffectorPositionVarVar": "splineIKPositionVar", - "primaryFlexCoefficients": "1.0, 1.0, 1.0, 1.0, 1.0", - "secondaryFlexCoefficients": "1.0, 1.0, 1.0" + "tipTargetFlexCoefficients": "1.0, 1.0, 1.0, 1.0, 1.0", + "midTargetFlexCoefficients": "1.0, 1.0, 1.0" }, "children": [ { diff --git a/libraries/animation/src/AnimNodeLoader.cpp b/libraries/animation/src/AnimNodeLoader.cpp index 8a19b763bb..47c8c7f0bb 100644 --- a/libraries/animation/src/AnimNodeLoader.cpp +++ b/libraries/animation/src/AnimNodeLoader.cpp @@ -596,14 +596,14 @@ static AnimNode::Pointer loadSplineIKNode(const QJsonObject& jsonObj, const QStr READ_STRING(enabledVar, jsonObj, id, jsonUrl, nullptr); READ_STRING(endEffectorRotationVarVar, jsonObj, id, jsonUrl, nullptr); READ_STRING(endEffectorPositionVarVar, jsonObj, id, jsonUrl, nullptr); - READ_STRING(primaryFlexCoefficients, jsonObj, id, jsonUrl, nullptr); - READ_STRING(secondaryFlexCoefficients, jsonObj, id, jsonUrl, nullptr); + READ_STRING(tipTargetFlexCoefficients, jsonObj, id, jsonUrl, nullptr); + READ_STRING(midTargetFlexCoefficients, jsonObj, id, jsonUrl, nullptr); auto node = std::make_shared(id, alpha, enabled, interpDuration, baseJointName, midJointName, tipJointName, alphaVar, enabledVar, endEffectorRotationVarVar, endEffectorPositionVarVar, basePositionVar, baseRotationVar, midPositionVar, midRotationVar, - tipPositionVar, tipRotationVar, primaryFlexCoefficients, secondaryFlexCoefficients); + tipPositionVar, tipRotationVar, tipTargetFlexCoefficients, midTargetFlexCoefficients); return node; } diff --git a/libraries/animation/src/AnimSplineIK.cpp b/libraries/animation/src/AnimSplineIK.cpp index 27e295ffb0..7c8f950537 100644 --- a/libraries/animation/src/AnimSplineIK.cpp +++ b/libraries/animation/src/AnimSplineIK.cpp @@ -29,8 +29,8 @@ AnimSplineIK::AnimSplineIK(const QString& id, float alpha, bool enabled, float i const QString& midRotationVar, const QString& tipPositionVar, const QString& tipRotationVar, - const QString& primaryFlexCoefficients, - const QString& secondaryFlexCoefficients) : + const QString& tipTargetFlexCoefficients, + const QString& midTargetFlexCoefficients) : AnimNode(AnimNode::Type::SplineIK, id), _alpha(alpha), _enabled(enabled), @@ -52,22 +52,22 @@ AnimSplineIK::AnimSplineIK(const QString& id, float alpha, bool enabled, float i _tipRotationVar(tipRotationVar) { - QStringList flexCoefficientsValues = primaryFlexCoefficients.split(',', QString::SkipEmptyParts); - for (int i = 0; i < flexCoefficientsValues.size(); i++) { + QStringList tipTargetFlexCoefficientsValues = tipTargetFlexCoefficients.split(',', QString::SkipEmptyParts); + for (int i = 0; i < tipTargetFlexCoefficientsValues.size(); i++) { if (i < MAX_NUMBER_FLEX_VARIABLES) { - qCDebug(animation) << "flex value " << flexCoefficientsValues[i].toDouble(); - _primaryFlexCoefficients[i] = (float)flexCoefficientsValues[i].toDouble(); + qCDebug(animation) << "tip target flex value " << tipTargetFlexCoefficientsValues[i].toDouble(); + _tipTargetFlexCoefficients[i] = (float)tipTargetFlexCoefficientsValues[i].toDouble(); } } - _numPrimaryFlexCoefficients = std::min(flexCoefficientsValues.size(), MAX_NUMBER_FLEX_VARIABLES); - QStringList secondaryFlexCoefficientsValues = secondaryFlexCoefficients.split(',', QString::SkipEmptyParts); - for (int i = 0; i < secondaryFlexCoefficientsValues.size(); i++) { + _numTipTargetFlexCoefficients = std::min(tipTargetFlexCoefficientsValues.size(), MAX_NUMBER_FLEX_VARIABLES); + QStringList midTargetFlexCoefficientsValues = midTargetFlexCoefficients.split(',', QString::SkipEmptyParts); + for (int i = 0; i < midTargetFlexCoefficientsValues.size(); i++) { if (i < MAX_NUMBER_FLEX_VARIABLES) { - qCDebug(animation) << "secondaryflex value " << secondaryFlexCoefficientsValues[i].toDouble(); - _secondaryFlexCoefficients[i] = (float)secondaryFlexCoefficientsValues[i].toDouble(); + qCDebug(animation) << "mid target flex value " << midTargetFlexCoefficientsValues[i].toDouble(); + _midTargetFlexCoefficients[i] = (float)midTargetFlexCoefficientsValues[i].toDouble(); } } - _numSecondaryFlexCoefficients = std::min(secondaryFlexCoefficientsValues.size(), MAX_NUMBER_FLEX_VARIABLES); + _numMidTargetFlexCoefficients = std::min(midTargetFlexCoefficientsValues.size(), MAX_NUMBER_FLEX_VARIABLES); } @@ -130,86 +130,79 @@ const AnimPoseVec& AnimSplineIK::evaluate(const AnimVariantMap& animVars, const AnimChain underChain; underChain.buildFromRelativePoses(_skeleton, underPoses, _tipJointIndex); - glm::quat hipsTargetRotation; - glm::vec3 hipsTargetTranslation; + glm::quat baseTargetRotation; + glm::vec3 baseTargetTranslation; // now we override the hips with the hips target pose. + // if there is a baseJoint ik target in animvars then use that + // otherwise use the underpose if (_poses.size() > 0) { - AnimPose hipsUnderPose = _skeleton->getAbsolutePose(_hipsIndex, _poses); - hipsTargetRotation = animVars.lookupRigToGeometry("hipsRotation", hipsUnderPose.rot()); - hipsTargetTranslation = animVars.lookupRigToGeometry("hipsPosition", hipsUnderPose.trans()); - AnimPose absHipsTargetPose(hipsTargetRotation, hipsTargetTranslation); + AnimPose baseJointUnderPose = _skeleton->getAbsolutePose(_baseJointIndex, _poses); + baseTargetRotation = animVars.lookupRigToGeometry(_baseRotationVar, baseJointUnderPose.rot()); + baseTargetTranslation = animVars.lookupRigToGeometry(_basePositionVar, baseJointUnderPose.trans()); + AnimPose absBaseTargetPose(baseTargetRotation, baseTargetTranslation); - int hipsParentIndex = _skeleton->getParentIndex(_hipsIndex); - AnimPose hipsParentAbsPose = _skeleton->getAbsolutePose(hipsParentIndex, _poses); + int baseParentIndex = _skeleton->getParentIndex(_baseJointIndex); + AnimPose baseParentAbsPose(Quaternions::IDENTITY,glm::vec3()); + if (baseParentIndex >= 0) { + baseParentAbsPose = _skeleton->getAbsolutePose(baseParentIndex, _poses); + } - _poses[_hipsIndex] = hipsParentAbsPose.inverse() * absHipsTargetPose; - _poses[_hipsIndex].scale() = glm::vec3(1.0f); + _poses[_baseJointIndex] = baseParentAbsPose.inverse() * absBaseTargetPose; + _poses[_baseJointIndex].scale() = glm::vec3(1.0f); } - AnimPoseVec absolutePoses; - absolutePoses.resize(_poses.size()); - computeAbsolutePoses(absolutePoses); - - IKTarget target; + IKTarget tipTarget; if (_tipJointIndex != -1) { - target.setType((int)IKTarget::Type::Spline); - target.setIndex(_tipJointIndex); + tipTarget.setType((int)IKTarget::Type::Spline); + tipTarget.setIndex(_tipJointIndex); + AnimPose absPose = _skeleton->getAbsolutePose(_tipJointIndex, _poses); glm::quat rotation = animVars.lookupRigToGeometry(_tipRotationVar, absPose.rot()); glm::vec3 translation = animVars.lookupRigToGeometry(_tipPositionVar, absPose.trans()); - float weight = 1.0f; - - target.setPose(rotation, translation); - target.setWeight(weight); - - - - const float* flexCoefficients = new float[5]{ 1.0f, 0.5f, 0.25f, 0.2f, 0.1f }; - target.setFlexCoefficients(_numPrimaryFlexCoefficients, _primaryFlexCoefficients); + tipTarget.setPose(rotation, translation); + tipTarget.setWeight(1.0f); + tipTarget.setFlexCoefficients(_numTipTargetFlexCoefficients, _tipTargetFlexCoefficients); } AnimChain jointChain; - AnimPose updatedSecondaryTarget; - AnimPoseVec absolutePoses2; - absolutePoses2.resize(_poses.size()); + if (_poses.size() > 0) { - jointChain.buildFromRelativePoses(_skeleton, _poses, target.getIndex()); - solveTargetWithSpline(context, target, absolutePoses, false, jointChain); + AnimPoseVec absolutePoses; + absolutePoses.resize(_poses.size()); + computeAbsolutePoses(absolutePoses); + jointChain.buildFromRelativePoses(_skeleton, _poses, tipTarget.getIndex()); + solveTargetWithSpline(context, tipTarget, absolutePoses, false, jointChain); jointChain.buildDirtyAbsolutePoses(); - qCDebug(animation) << "the jointChain Result for head " << jointChain.getAbsolutePoseFromJointIndex(_tipJointIndex); - qCDebug(animation) << "the orig target pose for head " << target.getPose(); jointChain.outputRelativePoses(_poses); - - AnimPose afterSolveSecondaryTarget = _skeleton->getAbsolutePose(_midJointIndex, _poses); - glm::quat secondaryTargetRotation = animVars.lookupRigToGeometry(_midRotationVar, afterSolveSecondaryTarget.rot()); - updatedSecondaryTarget = AnimPose(secondaryTargetRotation, afterSolveSecondaryTarget.trans()); - //updatedSecondaryTarget = AnimPose(afterSolveSecondaryTarget.rot(), afterSolveSecondaryTarget.trans()); } - IKTarget secondaryTarget; - computeAbsolutePoses(absolutePoses2); + IKTarget midTarget; if (_midJointIndex != -1) { - secondaryTarget.setType((int)IKTarget::Type::Spline); - secondaryTarget.setIndex(_midJointIndex); + midTarget.setType((int)IKTarget::Type::Spline); + midTarget.setIndex(_midJointIndex); - float weight2 = 1.0f; - secondaryTarget.setPose(updatedSecondaryTarget.rot(), updatedSecondaryTarget.trans()); - secondaryTarget.setWeight(weight2); - - const float* flexCoefficients2 = new float[3]{ 1.0f, 0.5f, 0.25f }; - secondaryTarget.setFlexCoefficients(_numSecondaryFlexCoefficients, _secondaryFlexCoefficients); + // set the middle joint to the position that is determined by the base-tip spline. + AnimPose afterSolveMidTarget = _skeleton->getAbsolutePose(_midJointIndex, _poses); + glm::quat midTargetRotation = animVars.lookupRigToGeometry(_midRotationVar, afterSolveMidTarget.rot()); + AnimPose updatedMidTarget = AnimPose(midTargetRotation, afterSolveMidTarget.trans()); + midTarget.setPose(updatedMidTarget.rot(), updatedMidTarget.trans()); + midTarget.setWeight(1.0f); + midTarget.setFlexCoefficients(_numMidTargetFlexCoefficients, _midTargetFlexCoefficients); } - AnimChain secondaryJointChain; + AnimChain midJointChain; AnimPose beforeSolveChestNeck; int startJoint; AnimPose correctJoint; if (_poses.size() > 0) { + AnimPoseVec absolutePoses2; + absolutePoses2.resize(_poses.size()); + computeAbsolutePoses(absolutePoses2); + // start at the tip - for (startJoint = _tipJointIndex; _skeleton->getParentIndex(startJoint) != _midJointIndex; startJoint = _skeleton->getParentIndex(startJoint)) { // find the child of the midJoint } @@ -218,25 +211,25 @@ const AnimPoseVec& AnimSplineIK::evaluate(const AnimVariantMap& animVars, const // fix this to deal with no neck AA beforeSolveChestNeck = _skeleton->getAbsolutePose(_skeleton->nameToJointIndex("Neck"), _poses); - secondaryJointChain.buildFromRelativePoses(_skeleton, _poses, secondaryTarget.getIndex()); - solveTargetWithSpline(context, secondaryTarget, absolutePoses2, false, secondaryJointChain); - secondaryJointChain.outputRelativePoses(_poses); + midJointChain.buildFromRelativePoses(_skeleton, _poses, midTarget.getIndex()); + solveTargetWithSpline(context, midTarget, absolutePoses2, false, midJointChain); + midJointChain.outputRelativePoses(_poses); } // set the tip/head rotation to match the absolute rotation of the target. int tipParent = _skeleton->getParentIndex(_tipJointIndex); - int secondaryTargetParent = _skeleton->getParentIndex(_midJointIndex); - if ((secondaryTargetParent != -1) && (tipParent != -1) && (_poses.size() > 0)) { + int midTargetParent = _skeleton->getParentIndex(_midJointIndex); + if ((midTargetParent != -1) && (tipParent != -1) && (_poses.size() > 0)) { - AnimPose secondaryTargetPose(secondaryTarget.getRotation(), secondaryTarget.getTranslation()); + AnimPose midTargetPose(midTarget.getRotation(), midTarget.getTranslation()); //AnimPose neckAbsolute = _skeleton->getAbsolutePose(tipParent, _poses); - //_poses[tipParent] = secondaryTargetPose.inverse() * beforeSolveChestNeck; - _poses[startJoint] = secondaryTargetPose.inverse() * correctJoint; + //_poses[tipParent] = midTargetPose.inverse() * beforeSolveChestNeck; + _poses[startJoint] = midTargetPose.inverse() * correctJoint; - //AnimPose tipTarget(target.getRotation(),target.getTranslation()); - //AnimPose tipRelativePose = _skeleton->getAbsolutePose(tipParent,_poses).inverse() * tipTarget; + //AnimPose tipTargetPose(tipTarget.getRotation(),tipTarget.getTranslation()); + //AnimPose tipRelativePose = _skeleton->getAbsolutePose(tipParent,_poses).inverse() * tipTargetPose; //_poses[_tipJointIndex] = tipRelativePose; } @@ -286,31 +279,31 @@ const AnimPoseVec& AnimSplineIK::evaluate(const AnimVariantMap& animVars, const const vec4 GREEN(0.0f, 1.0f, 0.0f, 1.0f); glm::mat4 rigToAvatarMat = createMatFromQuatAndPos(Quaternions::Y_180, glm::vec3()); - glm::mat4 geomTargetMat = createMatFromQuatAndPos(target.getRotation(), target.getTranslation()); + glm::mat4 geomTargetMat = createMatFromQuatAndPos(tipTarget.getRotation(), tipTarget.getTranslation()); glm::mat4 avatarTargetMat = rigToAvatarMat * context.getGeometryToRigMatrix() * geomTargetMat; - QString name = QString("ikTargetHead"); + QString name = QString("ikTargetSplineTip"); DebugDraw::getInstance().addMyAvatarMarker(name, glmExtractRotation(avatarTargetMat), extractTranslation(avatarTargetMat), WHITE); - glm::mat4 geomTargetMat2 = createMatFromQuatAndPos(secondaryTarget.getRotation(), secondaryTarget.getTranslation()); + glm::mat4 geomTargetMat2 = createMatFromQuatAndPos(midTarget.getRotation(), midTarget.getTranslation()); glm::mat4 avatarTargetMat2 = rigToAvatarMat * context.getGeometryToRigMatrix() * geomTargetMat2; - QString name2 = QString("ikTargetSpine2"); + QString name2 = QString("ikTargetSplineMid"); DebugDraw::getInstance().addMyAvatarMarker(name2, glmExtractRotation(avatarTargetMat2), extractTranslation(avatarTargetMat2), WHITE); - glm::mat4 geomTargetMat3 = createMatFromQuatAndPos(hipsTargetRotation, hipsTargetTranslation); + glm::mat4 geomTargetMat3 = createMatFromQuatAndPos(baseTargetRotation,baseTargetTranslation); glm::mat4 avatarTargetMat3 = rigToAvatarMat * context.getGeometryToRigMatrix() * geomTargetMat3; - QString name3 = QString("ikTargetHips"); + QString name3 = QString("ikTargetSplineBase"); DebugDraw::getInstance().addMyAvatarMarker(name3, glmExtractRotation(avatarTargetMat3), extractTranslation(avatarTargetMat3), WHITE); } else if (context.getEnableDebugDrawIKTargets() != _previousEnableDebugIKTargets) { // remove markers if they were added last frame. - QString name = QString("ikTargetHead"); + QString name = QString("ikTargetSplineTip"); DebugDraw::getInstance().removeMyAvatarMarker(name); - QString name2 = QString("ikTargetSpine2"); + QString name2 = QString("ikTargetSplineMid"); DebugDraw::getInstance().removeMyAvatarMarker(name2); - QString name3 = QString("ikTargetHips"); + QString name3 = QString("ikTargetSplineBase"); DebugDraw::getInstance().removeMyAvatarMarker(name3); } @@ -356,8 +349,6 @@ const AnimPoseVec& AnimSplineIK::getPosesInternal() const { void AnimSplineIK::setSkeletonInternal(AnimSkeleton::ConstPointer skeleton) { AnimNode::setSkeletonInternal(skeleton); - //_headIndex = _skeleton->nameToJointIndex("Head"); - _hipsIndex = _skeleton->nameToJointIndex("Hips"); lookUpIndices(); } diff --git a/libraries/animation/src/AnimSplineIK.h b/libraries/animation/src/AnimSplineIK.h index b05c5f4849..abc34618b3 100644 --- a/libraries/animation/src/AnimSplineIK.h +++ b/libraries/animation/src/AnimSplineIK.h @@ -19,14 +19,12 @@ class AnimSplineIK : public AnimNode { public: AnimSplineIK(const QString& id, float alpha, bool enabled, float interpDuration, - const QString& baseJointName, const QString& tipJointName, + const QString& baseJointName, const QString& midJointName, const QString& tipJointName, const QString& alphaVar, const QString& enabledVar, const QString& endEffectorRotationVarVar, const QString& endEffectorPositionVarVar, const QString& basePositionVar, const QString& baseRotationVar, + const QString& midPositionVar, const QString& midRotationVar, const QString& tipPositionVar, const QString& tipRotationVar, - const QString& secondaryTargetJointName, - const QString& secondaryTargetPositionVar, - const QString& secondaryTargetRotationVar, const QString& primaryFlexCoefficients, const QString& secondaryFlexCoefficients); @@ -69,19 +67,15 @@ protected: QString _tipRotationVar; static const int MAX_NUMBER_FLEX_VARIABLES = 10; - float _primaryFlexCoefficients[MAX_NUMBER_FLEX_VARIABLES]; - float _secondaryFlexCoefficients[MAX_NUMBER_FLEX_VARIABLES]; - int _numPrimaryFlexCoefficients { 0 }; - int _numSecondaryFlexCoefficients { 0 }; + float _tipTargetFlexCoefficients[MAX_NUMBER_FLEX_VARIABLES]; + float _midTargetFlexCoefficients[MAX_NUMBER_FLEX_VARIABLES]; + int _numTipTargetFlexCoefficients { 0 }; + int _numMidTargetFlexCoefficients { 0 }; int _baseParentJointIndex { -1 }; int _baseJointIndex { -1 }; int _midJointIndex { -1 }; int _tipJointIndex { -1 }; - int _headIndex { -1 }; - int _hipsIndex { -1 }; - int _spine2Index { -1 }; - int _hipsTargetIndex { -1 }; QString _alphaVar; // float - (0, 1) 0 means underPoses only, 1 means IK only. QString _enabledVar; // bool From ffd3a24bf22c7f4e6cd2f4604693e7d83da40422 Mon Sep 17 00:00:00 2001 From: amantley Date: Mon, 28 Jan 2019 13:53:30 -0800 Subject: [PATCH 034/436] further cleaning, broke the arms --- .../avatar-animation_withSplineIKNode.json | 2 - libraries/animation/src/AnimNodeLoader.cpp | 6 +- libraries/animation/src/AnimSplineIK.cpp | 78 ++++++------------- libraries/animation/src/AnimSplineIK.h | 12 +-- 4 files changed, 29 insertions(+), 69 deletions(-) diff --git a/interface/resources/avatar/avatar-animation_withSplineIKNode.json b/interface/resources/avatar/avatar-animation_withSplineIKNode.json index aac1312e72..a6283f0771 100644 --- a/interface/resources/avatar/avatar-animation_withSplineIKNode.json +++ b/interface/resources/avatar/avatar-animation_withSplineIKNode.json @@ -192,8 +192,6 @@ "tipRotationVar": "headRotation", "alphaVar": "splineIKAlpha", "enabledVar": "splineIKEnabled", - "endEffectorRotationVarVar": "splineIKRotationVar", - "endEffectorPositionVarVar": "splineIKPositionVar", "tipTargetFlexCoefficients": "1.0, 1.0, 1.0, 1.0, 1.0", "midTargetFlexCoefficients": "1.0, 1.0, 1.0" }, diff --git a/libraries/animation/src/AnimNodeLoader.cpp b/libraries/animation/src/AnimNodeLoader.cpp index 47c8c7f0bb..62e848872b 100644 --- a/libraries/animation/src/AnimNodeLoader.cpp +++ b/libraries/animation/src/AnimNodeLoader.cpp @@ -594,16 +594,14 @@ static AnimNode::Pointer loadSplineIKNode(const QJsonObject& jsonObj, const QStr READ_STRING(tipRotationVar, jsonObj, id, jsonUrl, nullptr); READ_STRING(alphaVar, jsonObj, id, jsonUrl, nullptr); READ_STRING(enabledVar, jsonObj, id, jsonUrl, nullptr); - READ_STRING(endEffectorRotationVarVar, jsonObj, id, jsonUrl, nullptr); - READ_STRING(endEffectorPositionVarVar, jsonObj, id, jsonUrl, nullptr); READ_STRING(tipTargetFlexCoefficients, jsonObj, id, jsonUrl, nullptr); READ_STRING(midTargetFlexCoefficients, jsonObj, id, jsonUrl, nullptr); auto node = std::make_shared(id, alpha, enabled, interpDuration, baseJointName, midJointName, tipJointName, - alphaVar, enabledVar, endEffectorRotationVarVar, endEffectorPositionVarVar, basePositionVar, baseRotationVar, midPositionVar, midRotationVar, - tipPositionVar, tipRotationVar, tipTargetFlexCoefficients, midTargetFlexCoefficients); + tipPositionVar, tipRotationVar, alphaVar, enabledVar, + tipTargetFlexCoefficients, midTargetFlexCoefficients); return node; } diff --git a/libraries/animation/src/AnimSplineIK.cpp b/libraries/animation/src/AnimSplineIK.cpp index 7c8f950537..5355a02b3e 100644 --- a/libraries/animation/src/AnimSplineIK.cpp +++ b/libraries/animation/src/AnimSplineIK.cpp @@ -21,14 +21,14 @@ AnimSplineIK::AnimSplineIK(const QString& id, float alpha, bool enabled, float i const QString& baseJointName, const QString& midJointName, const QString& tipJointName, - const QString& alphaVar, const QString& enabledVar, - const QString& endEffectorRotationVarVar, const QString& endEffectorPositionVarVar, const QString& basePositionVar, const QString& baseRotationVar, const QString& midPositionVar, const QString& midRotationVar, const QString& tipPositionVar, const QString& tipRotationVar, + const QString& alphaVar, + const QString& enabledVar, const QString& tipTargetFlexCoefficients, const QString& midTargetFlexCoefficients) : AnimNode(AnimNode::Type::SplineIK, id), @@ -38,18 +38,14 @@ AnimSplineIK::AnimSplineIK(const QString& id, float alpha, bool enabled, float i _baseJointName(baseJointName), _midJointName(midJointName), _tipJointName(tipJointName), - _alphaVar(alphaVar), - _enabledVar(enabledVar), - _endEffectorRotationVarVar(endEffectorRotationVarVar), - _endEffectorPositionVarVar(endEffectorPositionVarVar), - _prevEndEffectorRotationVar(), - _prevEndEffectorPositionVar(), _basePositionVar(basePositionVar), _baseRotationVar(baseRotationVar), _midPositionVar(midPositionVar), _midRotationVar(midRotationVar), _tipPositionVar(tipPositionVar), - _tipRotationVar(tipRotationVar) + _tipRotationVar(tipRotationVar), + _alphaVar(alphaVar), + _enabledVar(enabledVar) { QStringList tipTargetFlexCoefficientsValues = tipTargetFlexCoefficients.split(',', QString::SkipEmptyParts); @@ -101,7 +97,7 @@ const AnimPoseVec& AnimSplineIK::evaluate(const AnimVariantMap& animVars, const return _poses; } - // guard against size changes + // guard against size change if (underPoses.size() != _poses.size()) { _poses = underPoses; } @@ -130,17 +126,14 @@ const AnimPoseVec& AnimSplineIK::evaluate(const AnimVariantMap& animVars, const AnimChain underChain; underChain.buildFromRelativePoses(_skeleton, underPoses, _tipJointIndex); - glm::quat baseTargetRotation; - glm::vec3 baseTargetTranslation; - + AnimPose baseTargetAbsolutePose; // now we override the hips with the hips target pose. // if there is a baseJoint ik target in animvars then use that // otherwise use the underpose if (_poses.size() > 0) { AnimPose baseJointUnderPose = _skeleton->getAbsolutePose(_baseJointIndex, _poses); - baseTargetRotation = animVars.lookupRigToGeometry(_baseRotationVar, baseJointUnderPose.rot()); - baseTargetTranslation = animVars.lookupRigToGeometry(_basePositionVar, baseJointUnderPose.trans()); - AnimPose absBaseTargetPose(baseTargetRotation, baseTargetTranslation); + baseTargetAbsolutePose.rot() = animVars.lookupRigToGeometry(_baseRotationVar, baseJointUnderPose.rot()); + baseTargetAbsolutePose.trans() = animVars.lookupRigToGeometry(_basePositionVar, baseJointUnderPose.trans()); int baseParentIndex = _skeleton->getParentIndex(_baseJointIndex); AnimPose baseParentAbsPose(Quaternions::IDENTITY,glm::vec3()); @@ -148,7 +141,7 @@ const AnimPoseVec& AnimSplineIK::evaluate(const AnimVariantMap& animVars, const baseParentAbsPose = _skeleton->getAbsolutePose(baseParentIndex, _poses); } - _poses[_baseJointIndex] = baseParentAbsPose.inverse() * absBaseTargetPose; + _poses[_baseJointIndex] = baseParentAbsPose.inverse() * baseTargetAbsolutePose; _poses[_baseJointIndex].scale() = glm::vec3(1.0f); } @@ -193,26 +186,22 @@ const AnimPoseVec& AnimSplineIK::evaluate(const AnimVariantMap& animVars, const } AnimChain midJointChain; - AnimPose beforeSolveChestNeck; - int startJoint; - AnimPose correctJoint; + int childOfMiddleJointIndex = -1; + AnimPose childOfMiddleJointAbsolutePoseAfterBaseTipSpline; if (_poses.size() > 0) { - AnimPoseVec absolutePoses2; - absolutePoses2.resize(_poses.size()); - computeAbsolutePoses(absolutePoses2); - + childOfMiddleJointIndex = _tipJointIndex; // start at the tip - for (startJoint = _tipJointIndex; _skeleton->getParentIndex(startJoint) != _midJointIndex; startJoint = _skeleton->getParentIndex(startJoint)) { - // find the child of the midJoint + while (_skeleton->getParentIndex(childOfMiddleJointIndex) != _midJointIndex) { + childOfMiddleJointIndex = _skeleton->getParentIndex(childOfMiddleJointIndex); } - correctJoint = _skeleton->getAbsolutePose(startJoint, _poses); - - // fix this to deal with no neck AA - beforeSolveChestNeck = _skeleton->getAbsolutePose(_skeleton->nameToJointIndex("Neck"), _poses); + childOfMiddleJointAbsolutePoseAfterBaseTipSpline = _skeleton->getAbsolutePose(childOfMiddleJointIndex, _poses); + AnimPoseVec absolutePosesAfterBaseTipSpline; + absolutePosesAfterBaseTipSpline.resize(_poses.size()); + computeAbsolutePoses(absolutePosesAfterBaseTipSpline); midJointChain.buildFromRelativePoses(_skeleton, _poses, midTarget.getIndex()); - solveTargetWithSpline(context, midTarget, absolutePoses2, false, midJointChain); + solveTargetWithSpline(context, midTarget, absolutePosesAfterBaseTipSpline, false, midJointChain); midJointChain.outputRelativePoses(_poses); } @@ -220,17 +209,8 @@ const AnimPoseVec& AnimSplineIK::evaluate(const AnimVariantMap& animVars, const int tipParent = _skeleton->getParentIndex(_tipJointIndex); int midTargetParent = _skeleton->getParentIndex(_midJointIndex); if ((midTargetParent != -1) && (tipParent != -1) && (_poses.size() > 0)) { - - - AnimPose midTargetPose(midTarget.getRotation(), midTarget.getTranslation()); - //AnimPose neckAbsolute = _skeleton->getAbsolutePose(tipParent, _poses); - //_poses[tipParent] = midTargetPose.inverse() * beforeSolveChestNeck; - _poses[startJoint] = midTargetPose.inverse() * correctJoint; - - //AnimPose tipTargetPose(tipTarget.getRotation(),tipTarget.getTranslation()); - //AnimPose tipRelativePose = _skeleton->getAbsolutePose(tipParent,_poses).inverse() * tipTargetPose; - //_poses[_tipJointIndex] = tipRelativePose; + _poses[childOfMiddleJointIndex] = midTargetPose.inverse() * childOfMiddleJointAbsolutePoseAfterBaseTipSpline; } // compute chain @@ -290,7 +270,7 @@ const AnimPoseVec& AnimSplineIK::evaluate(const AnimVariantMap& animVars, const DebugDraw::getInstance().addMyAvatarMarker(name2, glmExtractRotation(avatarTargetMat2), extractTranslation(avatarTargetMat2), WHITE); - glm::mat4 geomTargetMat3 = createMatFromQuatAndPos(baseTargetRotation,baseTargetTranslation); + glm::mat4 geomTargetMat3 = createMatFromQuatAndPos(baseTargetAbsolutePose.rot(), baseTargetAbsolutePose.trans()); glm::mat4 avatarTargetMat3 = rigToAvatarMat * context.getGeometryToRigMatrix() * geomTargetMat3; QString name3 = QString("ikTargetSplineBase"); DebugDraw::getInstance().addMyAvatarMarker(name3, glmExtractRotation(avatarTargetMat3), extractTranslation(avatarTargetMat3), WHITE); @@ -369,12 +349,7 @@ void AnimSplineIK::solveTargetWithSpline(const AnimContext& context, const IKTar // build spline from tip to base AnimPose tipPose = AnimPose(glm::vec3(1.0f), target.getRotation(), target.getTranslation()); - AnimPose basePose; - //if (target.getIndex() == _tipJointIndex) { - // basePose = absolutePoses[tipBaseIndex]; - //} else { - basePose = absolutePoses[baseIndex]; - //} + AnimPose basePose = absolutePoses[baseIndex]; CubicHermiteSplineFunctorWithArcLength spline; if (target.getIndex() == _tipJointIndex) { @@ -382,7 +357,6 @@ void AnimSplineIK::solveTargetWithSpline(const AnimContext& context, const IKTar const float HIPS_GAIN = 0.5f; const float HEAD_GAIN = 1.0f; spline = computeSplineFromTipAndBase(tipPose, basePose, HIPS_GAIN, HEAD_GAIN); - // spline = computeSplineFromTipAndBase(tipPose, basePose); } else { spline = computeSplineFromTipAndBase(tipPose, basePose); } @@ -406,7 +380,7 @@ void AnimSplineIK::solveTargetWithSpline(const AnimContext& context, const IKTar float t = spline.arcLengthInverse(splineJointInfo.ratio * totalArcLength); glm::vec3 trans = spline(t); - // for head splines, preform most twist toward the tip by using ease in function. t^2 + // for base->tip splines, preform most twist toward the tip by using ease in function. t^2 float rotT = t; if (target.getIndex() == _tipJointIndex) { rotT = t * t; @@ -454,9 +428,6 @@ void AnimSplineIK::solveTargetWithSpline(const AnimContext& context, const IKTar if (!chainInfoOut.setRelativePoseAtJointIndex(splineJointInfo.jointIndex, relPose)) { qCDebug(animation) << "we didn't find the joint index for the spline!!!!"; } - if (splineJointInfo.jointIndex == _skeleton->nameToJointIndex("Neck")) { - qCDebug(animation) << "neck is " << relPose; - } parentAbsPose = flexedAbsPose; } @@ -518,7 +489,6 @@ void AnimSplineIK::computeAndCacheSplineJointInfosForIKTarget(const AnimContext& int index = target.getIndex(); int endIndex; if (target.getIndex() == _tipJointIndex) { - //endIndex = _skeleton->getParentIndex(_secondaryTargetIndex); endIndex = _skeleton->getParentIndex(_baseJointIndex); } else { endIndex = _skeleton->getParentIndex(_baseJointIndex); diff --git a/libraries/animation/src/AnimSplineIK.h b/libraries/animation/src/AnimSplineIK.h index abc34618b3..ea7a897362 100644 --- a/libraries/animation/src/AnimSplineIK.h +++ b/libraries/animation/src/AnimSplineIK.h @@ -20,13 +20,12 @@ class AnimSplineIK : public AnimNode { public: AnimSplineIK(const QString& id, float alpha, bool enabled, float interpDuration, const QString& baseJointName, const QString& midJointName, const QString& tipJointName, - const QString& alphaVar, const QString& enabledVar, - const QString& endEffectorRotationVarVar, const QString& endEffectorPositionVarVar, const QString& basePositionVar, const QString& baseRotationVar, const QString& midPositionVar, const QString& midRotationVar, const QString& tipPositionVar, const QString& tipRotationVar, - const QString& primaryFlexCoefficients, - const QString& secondaryFlexCoefficients); + const QString& alphaVar, const QString& enabledVar, + const QString& tipTargetFlexCoefficients, + const QString& midTargetFlexCoefficients); virtual ~AnimSplineIK() override; virtual const AnimPoseVec& evaluate(const AnimVariantMap& animVars, const AnimContext& context, float dt, AnimVariantMap& triggersOut) override; @@ -79,11 +78,6 @@ protected: QString _alphaVar; // float - (0, 1) 0 means underPoses only, 1 means IK only. QString _enabledVar; // bool - QString _endEffectorRotationVarVar; // string - QString _endEffectorPositionVarVar; // string - - QString _prevEndEffectorRotationVar; - QString _prevEndEffectorPositionVar; bool _previousEnableDebugIKTargets { false }; From f17cfbcbb188eb68bbdca695f50879d90a88a324 Mon Sep 17 00:00:00 2001 From: amantley Date: Mon, 28 Jan 2019 15:25:12 -0800 Subject: [PATCH 035/436] more cleaning, need to fix debug draw ik chain --- libraries/animation/src/AnimSplineIK.cpp | 141 ++++++++++------------- libraries/animation/src/AnimSplineIK.h | 4 +- 2 files changed, 60 insertions(+), 85 deletions(-) diff --git a/libraries/animation/src/AnimSplineIK.cpp b/libraries/animation/src/AnimSplineIK.cpp index 5355a02b3e..af1f3e9524 100644 --- a/libraries/animation/src/AnimSplineIK.cpp +++ b/libraries/animation/src/AnimSplineIK.cpp @@ -90,8 +90,8 @@ const AnimPoseVec& AnimSplineIK::evaluate(const AnimVariantMap& animVars, const // evaluate underPoses AnimPoseVec underPoses = _children[0]->evaluate(animVars, context, dt, triggersOut); - // if we don't have a skeleton, or jointName lookup failed. - if (!_skeleton || _baseJointIndex == -1 || _tipJointIndex == -1 || alpha == 0.0f || underPoses.size() == 0) { + // if we don't have a skeleton, or jointName lookup failed or the spline alpha is 0 or there are no underposes. + if (!_skeleton || _baseJointIndex == -1 || _midJointIndex == -1 || _tipJointIndex == -1 || alpha == 0.0f || underPoses.size() == 0) { // pass underPoses through unmodified. _poses = underPoses; return _poses; @@ -115,6 +115,7 @@ const AnimPoseVec& AnimSplineIK::evaluate(const AnimVariantMap& animVars, const } _enabled = enabled; + // now that we have saved the previous _poses in _snapshotChain, we can update to the current underposes _poses = underPoses; // don't build chains or do IK if we are disabled & not interping. @@ -127,91 +128,75 @@ const AnimPoseVec& AnimSplineIK::evaluate(const AnimVariantMap& animVars, const underChain.buildFromRelativePoses(_skeleton, underPoses, _tipJointIndex); AnimPose baseTargetAbsolutePose; - // now we override the hips with the hips target pose. - // if there is a baseJoint ik target in animvars then use that + // if there is a baseJoint ik target in animvars then set the joint to that // otherwise use the underpose - if (_poses.size() > 0) { - AnimPose baseJointUnderPose = _skeleton->getAbsolutePose(_baseJointIndex, _poses); - baseTargetAbsolutePose.rot() = animVars.lookupRigToGeometry(_baseRotationVar, baseJointUnderPose.rot()); - baseTargetAbsolutePose.trans() = animVars.lookupRigToGeometry(_basePositionVar, baseJointUnderPose.trans()); + AnimPose baseJointUnderPose = _skeleton->getAbsolutePose(_baseJointIndex, _poses); + baseTargetAbsolutePose.rot() = animVars.lookupRigToGeometry(_baseRotationVar, baseJointUnderPose.rot()); + baseTargetAbsolutePose.trans() = animVars.lookupRigToGeometry(_basePositionVar, baseJointUnderPose.trans()); - int baseParentIndex = _skeleton->getParentIndex(_baseJointIndex); - AnimPose baseParentAbsPose(Quaternions::IDENTITY,glm::vec3()); - if (baseParentIndex >= 0) { - baseParentAbsPose = _skeleton->getAbsolutePose(baseParentIndex, _poses); - } - - _poses[_baseJointIndex] = baseParentAbsPose.inverse() * baseTargetAbsolutePose; - _poses[_baseJointIndex].scale() = glm::vec3(1.0f); + int baseParentIndex = _skeleton->getParentIndex(_baseJointIndex); + AnimPose baseParentAbsPose(Quaternions::IDENTITY,glm::vec3()); + if (baseParentIndex >= 0) { + baseParentAbsPose = _skeleton->getAbsolutePose(baseParentIndex, _poses); } + _poses[_baseJointIndex] = baseParentAbsPose.inverse() * baseTargetAbsolutePose; + _poses[_baseJointIndex].scale() = glm::vec3(1.0f); + // initialize the tip target IKTarget tipTarget; - if (_tipJointIndex != -1) { - tipTarget.setType((int)IKTarget::Type::Spline); - tipTarget.setIndex(_tipJointIndex); - - AnimPose absPose = _skeleton->getAbsolutePose(_tipJointIndex, _poses); - glm::quat rotation = animVars.lookupRigToGeometry(_tipRotationVar, absPose.rot()); - glm::vec3 translation = animVars.lookupRigToGeometry(_tipPositionVar, absPose.trans()); - tipTarget.setPose(rotation, translation); - tipTarget.setWeight(1.0f); - tipTarget.setFlexCoefficients(_numTipTargetFlexCoefficients, _tipTargetFlexCoefficients); - } + tipTarget.setType((int)IKTarget::Type::Spline); + tipTarget.setIndex(_tipJointIndex); + AnimPose absPose = _skeleton->getAbsolutePose(_tipJointIndex, _poses); + glm::quat rotation = animVars.lookupRigToGeometry(_tipRotationVar, absPose.rot()); + glm::vec3 translation = animVars.lookupRigToGeometry(_tipPositionVar, absPose.trans()); + tipTarget.setPose(rotation, translation); + tipTarget.setWeight(1.0f); + tipTarget.setFlexCoefficients(_numTipTargetFlexCoefficients, _tipTargetFlexCoefficients); + AnimChain jointChain; - - if (_poses.size() > 0) { - - AnimPoseVec absolutePoses; - absolutePoses.resize(_poses.size()); - computeAbsolutePoses(absolutePoses); - jointChain.buildFromRelativePoses(_skeleton, _poses, tipTarget.getIndex()); - solveTargetWithSpline(context, tipTarget, absolutePoses, false, jointChain); - jointChain.buildDirtyAbsolutePoses(); - jointChain.outputRelativePoses(_poses); - } + AnimPoseVec absolutePoses; + absolutePoses.resize(_poses.size()); + computeAbsolutePoses(absolutePoses); + jointChain.buildFromRelativePoses(_skeleton, _poses, tipTarget.getIndex()); + solveTargetWithSpline(context, tipTarget, absolutePoses, false, jointChain); + jointChain.buildDirtyAbsolutePoses(); + jointChain.outputRelativePoses(_poses); + // initialize the middle joint target IKTarget midTarget; - if (_midJointIndex != -1) { - midTarget.setType((int)IKTarget::Type::Spline); - midTarget.setIndex(_midJointIndex); - - // set the middle joint to the position that is determined by the base-tip spline. - AnimPose afterSolveMidTarget = _skeleton->getAbsolutePose(_midJointIndex, _poses); - glm::quat midTargetRotation = animVars.lookupRigToGeometry(_midRotationVar, afterSolveMidTarget.rot()); - AnimPose updatedMidTarget = AnimPose(midTargetRotation, afterSolveMidTarget.trans()); - midTarget.setPose(updatedMidTarget.rot(), updatedMidTarget.trans()); - midTarget.setWeight(1.0f); - midTarget.setFlexCoefficients(_numMidTargetFlexCoefficients, _midTargetFlexCoefficients); - } + midTarget.setType((int)IKTarget::Type::Spline); + midTarget.setIndex(_midJointIndex); + // set the middle joint to the position that was just determined by the base-tip spline. + AnimPose afterSolveMidTarget = _skeleton->getAbsolutePose(_midJointIndex, _poses); + // use the rotation from the ik target value, if there is one. + glm::quat midTargetRotation = animVars.lookupRigToGeometry(_midRotationVar, afterSolveMidTarget.rot()); + AnimPose updatedMidTarget = AnimPose(midTargetRotation, afterSolveMidTarget.trans()); + midTarget.setPose(updatedMidTarget.rot(), updatedMidTarget.trans()); + midTarget.setWeight(1.0f); + midTarget.setFlexCoefficients(_numMidTargetFlexCoefficients, _midTargetFlexCoefficients); AnimChain midJointChain; + // Find the pose of the middle target's child. This is to correct the mid to tip + // after the base to mid spline is set. int childOfMiddleJointIndex = -1; AnimPose childOfMiddleJointAbsolutePoseAfterBaseTipSpline; - if (_poses.size() > 0) { - - childOfMiddleJointIndex = _tipJointIndex; - // start at the tip - while (_skeleton->getParentIndex(childOfMiddleJointIndex) != _midJointIndex) { - childOfMiddleJointIndex = _skeleton->getParentIndex(childOfMiddleJointIndex); - } - childOfMiddleJointAbsolutePoseAfterBaseTipSpline = _skeleton->getAbsolutePose(childOfMiddleJointIndex, _poses); - - AnimPoseVec absolutePosesAfterBaseTipSpline; - absolutePosesAfterBaseTipSpline.resize(_poses.size()); - computeAbsolutePoses(absolutePosesAfterBaseTipSpline); - midJointChain.buildFromRelativePoses(_skeleton, _poses, midTarget.getIndex()); - solveTargetWithSpline(context, midTarget, absolutePosesAfterBaseTipSpline, false, midJointChain); - midJointChain.outputRelativePoses(_poses); + childOfMiddleJointIndex = _tipJointIndex; + while (_skeleton->getParentIndex(childOfMiddleJointIndex) != _midJointIndex) { + childOfMiddleJointIndex = _skeleton->getParentIndex(childOfMiddleJointIndex); } + childOfMiddleJointAbsolutePoseAfterBaseTipSpline = _skeleton->getAbsolutePose(childOfMiddleJointIndex, _poses); - // set the tip/head rotation to match the absolute rotation of the target. - int tipParent = _skeleton->getParentIndex(_tipJointIndex); - int midTargetParent = _skeleton->getParentIndex(_midJointIndex); - if ((midTargetParent != -1) && (tipParent != -1) && (_poses.size() > 0)) { - AnimPose midTargetPose(midTarget.getRotation(), midTarget.getTranslation()); - _poses[childOfMiddleJointIndex] = midTargetPose.inverse() * childOfMiddleJointAbsolutePoseAfterBaseTipSpline; - } + AnimPoseVec absolutePosesAfterBaseTipSpline; + absolutePosesAfterBaseTipSpline.resize(_poses.size()); + computeAbsolutePoses(absolutePosesAfterBaseTipSpline); + midJointChain.buildFromRelativePoses(_skeleton, _poses, midTarget.getIndex()); + solveTargetWithSpline(context, midTarget, absolutePosesAfterBaseTipSpline, false, midJointChain); + midJointChain.outputRelativePoses(_poses); + + // set the mid to tip segment to match the absolute rotation of the target. + AnimPose midTargetPose(midTarget.getRotation(), midTarget.getTranslation()); + _poses[childOfMiddleJointIndex] = midTargetPose.inverse() * childOfMiddleJointAbsolutePoseAfterBaseTipSpline; // compute chain AnimChain ikChain; @@ -424,7 +409,6 @@ void AnimSplineIK::solveTargetWithSpline(const AnimContext& context, const IKTar relPose.trans() = glm::vec3(0.0f); } } - // note we are ignoring the constrained info for now. if (!chainInfoOut.setRelativePoseAtJointIndex(splineJointInfo.jointIndex, relPose)) { qCDebug(animation) << "we didn't find the joint index for the spline!!!!"; } @@ -450,7 +434,6 @@ const std::vector* AnimSplineIK::findOrCreateSpli return &(iter->second); } } - return nullptr; } @@ -460,13 +443,7 @@ void AnimSplineIK::computeAndCacheSplineJointInfosForIKTarget(const AnimContext& // build spline between the default poses. AnimPose tipPose = _skeleton->getAbsoluteDefaultPose(target.getIndex()); - AnimPose basePose; - if (target.getIndex() == _tipJointIndex) { - basePose = _skeleton->getAbsoluteDefaultPose(_baseJointIndex); - //basePose = _skeleton->getAbsoluteDefaultPose(_secondaryTargetIndex); - } else { - basePose = _skeleton->getAbsoluteDefaultPose(_baseJointIndex); - } + AnimPose basePose = _skeleton->getAbsoluteDefaultPose(_baseJointIndex); CubicHermiteSplineFunctorWithArcLength spline; if (target.getIndex() == _tipJointIndex) { @@ -474,7 +451,6 @@ void AnimSplineIK::computeAndCacheSplineJointInfosForIKTarget(const AnimContext& const float HIPS_GAIN = 0.5f; const float HEAD_GAIN = 1.0f; spline = computeSplineFromTipAndBase(tipPose, basePose, HIPS_GAIN, HEAD_GAIN); - // spline = computeSplineFromTipAndBase(tipPose, basePose); } else { spline = computeSplineFromTipAndBase(tipPose, basePose); } @@ -516,7 +492,6 @@ void AnimSplineIK::computeAndCacheSplineJointInfosForIKTarget(const AnimContext& splineJointInfoVec.push_back(splineJointInfo); index = _skeleton->getParentIndex(index); } - _splineJointInfoMap[target.getIndex()] = splineJointInfoVec; } diff --git a/libraries/animation/src/AnimSplineIK.h b/libraries/animation/src/AnimSplineIK.h index ea7a897362..2109d43456 100644 --- a/libraries/animation/src/AnimSplineIK.h +++ b/libraries/animation/src/AnimSplineIK.h @@ -87,14 +87,14 @@ protected: AnimChain _snapshotChain; - // used to pre-compute information about each joint influeced by a spline IK target. + // used to pre-compute information about each joint influenced by a spline IK target. struct SplineJointInfo { int jointIndex; // joint in the skeleton that this information pertains to. float ratio; // percentage (0..1) along the spline for this joint. AnimPose offsetPose; // local offset from the spline to the joint. }; - bool _lastEnableDebugDrawIKTargets{ false }; + bool _lastEnableDebugDrawIKTargets { false }; void AnimSplineIK::solveTargetWithSpline(const AnimContext& context, const IKTarget& target, const AnimPoseVec& absolutePoses, bool debug, AnimChain& chainInfoOut) const; void computeAndCacheSplineJointInfosForIKTarget(const AnimContext& context, const IKTarget& target) const; const std::vector* findOrCreateSplineJointInfo(const AnimContext& context, const IKTarget& target) const; From b1e4e17f47065d4269048400682ac4f806bc4259 Mon Sep 17 00:00:00 2001 From: Brad Davis Date: Tue, 20 Nov 2018 10:51:55 -0800 Subject: [PATCH 036/436] Santa Cruz --- .gitignore | 1 + CMakeLists.txt | 1 + .../gvrinterface/InterfaceActivity.java | 42 - .../hifiinterface/InterfaceActivity.java | 21 +- .../fragment/SignedInFragment.java | 73 + ...d_button_color1.xml => rounded_button.xml} | 0 .../src/main/res/drawable/rounded_edit.xml | 7 + .../src/main/res/layout/fragment_signedin.xml | 63 + android/apps/questFramePlayer/CMakeLists.txt | 9 + android/apps/questFramePlayer/build.gradle | 51 + .../proguard-rules.pro | 0 .../src/main/AndroidManifest.xml | 55 + .../src/main/cpp/PlayerWindow.cpp | 25 + .../src/main/cpp/PlayerWindow.h | 29 + .../src/main/cpp/RenderThread.cpp | 239 ++++ .../src/main/cpp/RenderThread.h | 44 + .../questFramePlayer/src/main/cpp/main.cpp | 56 + .../frameplayer/QuestQtActivity.java | 52 + .../frameplayer/QuestRenderActivity.java | 14 + .../src/main/res/drawable/ic_launcher.xml | 0 .../src/main/res/values/strings.xml | 3 + android/apps/questInterface/CMakeLists.txt | 16 + android/apps/questInterface/build.gradle | 149 ++ .../apps/questInterface/proguard-rules.pro | 25 + .../src/main/AndroidManifest.xml | 54 + .../questInterface/src/main/cpp/native.cpp | 86 ++ .../questInterface/MainActivity.java | 70 + .../questInterface/PermissionsChecker.java | 65 + .../questInterface/QuestActivity.java | 25 + .../src/main/res/drawable/ic_launcher.xml | 17 + .../src/main/res/values/strings.xml | 3 + android/apps/ui/CMakeLists.txt | 7 + android/apps/ui/proguard-rules.pro | 25 + android/apps/ui/src/main/AndroidManifest.xml | 32 + android/apps/ui/src/main/cpp/PlayerWindow.cpp | 22 + android/apps/ui/src/main/cpp/PlayerWindow.h | 27 + android/apps/ui/src/main/cpp/RenderThread.cpp | 98 ++ android/apps/ui/src/main/cpp/RenderThread.h | 42 + android/apps/ui/src/main/cpp/main.cpp | 58 + android/apps/ui/src/main/cpp/main.qml | 21 + android/apps/ui/src/main/cpp/mainqt.cpp | 5 + android/apps/ui/src/main/cpp/resources.qrc | 6 + .../java/io/highfidelity/ui/UiActivity.java | 21 + .../ui/src/main/res/drawable/ic_launcher.xml | 17 + .../apps/ui/src/main/res/values/strings.xml | 3 + android/apps/ui/src/main/uiApp.pro | 22 + android/build.gradle | 122 +- android/gradle.properties | 1 + .../gradle/wrapper/gradle-wrapper.properties | 4 +- android/libraries/oculus/build.gradle | 17 + .../oculus/src/main/AndroidManifest.xml | 2 + .../oculus/OculusMobileActivity.java | 103 ++ .../qt5/android/bindings/QtActivity.java | 20 +- android/settings.gradle | 25 +- cmake/macros/IncludeHifiLibraryHeaders.cmake | 2 +- cmake/macros/LinkHifiLibraries.cmake | 4 +- cmake/macros/TargetEGL.cmake | 4 + cmake/macros/TargetOculusMobile.cmake | 20 + cmake/ports/hifi-client-deps/CONTROL | 2 +- gvr-interface/CMakeLists.txt | 85 -- gvr-interface/res/drawable/icon.png | Bin 9914 -> 0 bytes gvr-interface/src/Client.cpp | 73 - gvr-interface/src/Client.h | 33 - gvr-interface/src/GVRInterface.cpp | 191 --- gvr-interface/src/GVRInterface.h | 72 - gvr-interface/src/GVRMainWindow.cpp | 176 --- gvr-interface/src/GVRMainWindow.h | 58 - gvr-interface/src/InterfaceView.cpp | 18 - gvr-interface/src/InterfaceView.h | 23 - gvr-interface/src/LoginDialog.cpp | 69 - gvr-interface/src/LoginDialog.h | 34 - gvr-interface/src/RenderingClient.cpp | 156 --- gvr-interface/src/RenderingClient.h | 57 - .../gvrinterface/InterfaceActivity.java | 41 - gvr-interface/src/main.cpp | 28 - .../templates/InterfaceBetaActivity.java.in | 51 - gvr-interface/templates/hockeyapp.xml.in | 5 - hifi_android.py | 7 + interface/CMakeLists.txt | 11 +- interface/resources/qml/+android/StatText.qml | 9 - interface/resources/qml/+android/Stats.qml | 410 ------ interface/resources/qml/Browser.qml | 22 +- .../LoginDialog/+android/LinkAccountBody.qml | 292 ---- .../qml/LoginDialog/+android/SignUpBody.qml | 297 ---- interface/resources/qml/QmlWebWindow.qml | 29 +- interface/resources/qml/TabletBrowser.qml | 38 +- interface/resources/qml/Web3DSurface.qml | 75 +- .../qml/controls/FlickableWebViewCore.qml | 39 +- .../resources/qml/controls/TabletWebView.qml | 1 - .../qml/controlsUit/+android/ImageButton.qml | 82 -- .../resources/qml/controlsUit/BaseWebView.qml | 12 +- .../resources/qml/controlsUit/WebSpinner.qml | 4 +- .../qml/desktop/+android/FocusHack.qml | 26 - interface/resources/qml/desktop/Desktop.qml | 11 +- .../resources/qml/hifi/+android/ActionBar.qml | 71 - .../resources/qml/hifi/+android/AudioBar.qml | 84 -- .../qml/hifi/+android/AvatarOption.qml | 117 -- .../resources/qml/hifi/+android/Desktop.qml | 63 - .../qml/hifi/+android/HifiConstants.qml | 56 - .../resources/qml/hifi/+android/StatsBar.qml | 71 - .../qml/hifi/+android/WindowHeader.qml | 113 -- .../qml/hifi/+android/bottomHudOptions.qml | 86 -- .../resources/qml/hifi/+android/button.qml | 225 --- .../resources/qml/hifi/+android/modesbar.qml | 72 - interface/resources/qml/hifi/Desktop.qml | 35 +- interface/resources/qml/hifi/WebBrowser.qml | 95 +- .../resources/qml/hifi/avatarapp/Spinner.qml | 1 - .../qml/hifi/tablet/BlocksWebView.qml | 3 +- .../resources/qml/hifi/tablet/TabletMenu.qml | 2 - .../qml/hifi/tablet/TabletWebView.qml | 1 - .../qml/hifi/tablet/WindowWebView.qml | 1 - .../qml/stylesUit/+android/HifiConstants.qml | 358 ----- interface/src/Application.cpp | 74 +- interface/src/Application.h | 6 +- interface/src/LODManager.cpp | 1 + interface/src/avatar/MyAvatar.cpp | 12 +- .../interface/InterfaceActivity.java | 40 - .../src/octree/OctreePacketProcessor.cpp | 5 +- interface/src/raypick/LaserPointer.cpp | 6 +- .../raypick/LaserPointerScriptingInterface.h | 2 +- interface/src/raypick/ParabolaPick.cpp | 14 +- interface/src/raypick/ParabolaPointer.cpp | 2 +- interface/src/raypick/PathPointer.cpp | 12 +- .../src/raypick/PickScriptingInterface.cpp | 22 +- .../src/raypick/PickScriptingInterface.h | 131 +- .../src/raypick/PointerScriptingInterface.h | 9 +- interface/src/raypick/RayPick.cpp | 13 +- .../src/raypick/RayPickScriptingInterface.h | 10 +- interface/src/raypick/StylusPointer.cpp | 2 +- interface/src/ui/AnimStats.cpp | 2 +- interface/src/ui/Keyboard.cpp | 3 +- interface/src/ui/Stats.cpp | 2 +- .../animation/src/AnimInverseKinematics.cpp | 2 +- .../src/display-plugins/DisplayPlugin.cpp | 2 + .../display-plugins/OpenGLDisplayPlugin.cpp | 6 +- .../src/display-plugins/OpenGLDisplayPlugin.h | 3 + .../hmd/DebugHmdDisplayPlugin.cpp | 13 + .../display-plugins/hmd/HmdDisplayPlugin.h | 2 +- .../src/EntityTreeRenderer.cpp | 10 +- libraries/entities/CMakeLists.txt | 1 - .../entities/src/EntityScriptingInterface.cpp | 130 +- .../entities/src/EntityScriptingInterface.h | 95 +- libraries/entities/src/EntityTree.cpp | 374 +++-- libraries/entities/src/EntityTree.h | 57 +- libraries/entities/src/EntityTreeElement.cpp | 256 +--- libraries/entities/src/EntityTreeElement.h | 52 +- libraries/gl/CMakeLists.txt | 2 +- libraries/gl/src/gl/Context.cpp | 24 +- libraries/gl/src/gl/ContextQt.cpp | 12 +- libraries/gl/src/gl/OffscreenGLCanvas.cpp | 14 +- libraries/gl/src/gl/QOpenGLContextWrapper.cpp | 30 +- libraries/gl/src/gl/QOpenGLContextWrapper.h | 22 +- .../gpu-gl-common/src/gpu/gl/GLBackend.cpp | 4 + .../gpu-gl-common/src/gpu/gl/GLBackend.h | 4 +- .../src/gpu/gl45/GL45BackendTexture.cpp | 12 +- .../src/gpu/gles/GLESBackendOutput.cpp | 2 +- libraries/gpu/src/gpu/Context.h | 1 + libraries/gpu/src/gpu/FrameReader.cpp | 29 +- libraries/gpu/src/gpu/Transform.slh | 2 +- .../src/input-plugins/InputPlugin.cpp | 3 + libraries/oculusMobile/CMakeLists.txt | 11 + libraries/oculusMobile/src/ovr/Forward.h | 17 + .../oculusMobile/src/ovr/Framebuffer.cpp | 93 ++ libraries/oculusMobile/src/ovr/Framebuffer.h | 34 + libraries/oculusMobile/src/ovr/GLContext.cpp | 182 +++ libraries/oculusMobile/src/ovr/GLContext.h | 37 + libraries/oculusMobile/src/ovr/Helpers.cpp | 38 + libraries/oculusMobile/src/ovr/Helpers.h | 94 ++ libraries/oculusMobile/src/ovr/TaskQueue.cpp | 40 + libraries/oculusMobile/src/ovr/TaskQueue.h | 42 + libraries/oculusMobile/src/ovr/VrHandler.cpp | 337 +++++ libraries/oculusMobile/src/ovr/VrHandler.h | 47 + libraries/oculusMobilePlugin/CMakeLists.txt | 29 + libraries/oculusMobilePlugin/src/Logging.cpp | 4 + libraries/oculusMobilePlugin/src/Logging.h | 13 + .../src/OculusMobileControllerManager.cpp | 694 ++++++++++ .../src/OculusMobileControllerManager.h | 43 + .../src/OculusMobileDisplayPlugin.cpp | 269 ++++ .../src/OculusMobileDisplayPlugin.h | 65 + libraries/pointers/src/Pick.cpp | 5 +- libraries/pointers/src/Pick.h | 79 +- libraries/pointers/src/PickCacheOptimizer.h | 6 +- libraries/qml/src/qml/OffscreenSurface.cpp | 15 + libraries/qml/src/qml/OffscreenSurface.h | 2 + libraries/render-utils/src/Model.cpp | 5 + .../render-utils/src/parabola_forward.slv | 7 + libraries/render/src/render/CullTask.cpp | 16 +- .../src/ConsoleScriptingInterface.cpp | 12 + libraries/shaders/headers/310es/header.glsl | 3 + libraries/shaders/src/shaders/Shaders.cpp | 4 +- libraries/shared/src/shared/FileUtils.cpp | 3 + libraries/ui/src/QmlFragmentClass.cpp | 9 +- libraries/ui/src/QmlWindowClass.cpp | 2 + libraries/ui/src/ui/OffscreenQmlSurface.cpp | 11 +- plugins/oculus/src/OculusDisplayPlugin.cpp | 4 + scripts/+android/defaultScripts.js | 128 -- scripts/defaultScripts.js | 23 +- .../utilities/tests/entityPerfTest.js | 8 + scripts/system/+android/actionbar.js | 59 - scripts/system/+android/audio.js | 71 - scripts/system/+android/clickWeb.js | 108 -- scripts/system/+android/displayNames.js | 167 --- scripts/system/+android/modes.js | 124 -- scripts/system/+android/radar.js | 1217 ----------------- scripts/system/+android/stats.js | 39 - .../system/+android/touchscreenvirtualpad.js | 22 - scripts/system/+android/uniqueColor.js | 54 - scripts/system/goto.js | 51 +- scripts/system/html/js/miniTablet.js | 24 +- scripts/system/miniTablet.js | 5 +- tools/CMakeLists.txt | 1 + tools/gpu-frame-player/CMakeLists.txt | 3 +- tools/gpu-frame-player/src/PlayerWindow.cpp | 46 +- tools/gpu-frame-player/src/RenderThread.cpp | 39 +- tools/gpu-frame-player/src/RenderThread.h | 2 + tools/noramlizeFrame.py | 62 + tools/webview/CMakeLists.txt | 7 + tools/webview/src/PlayerWindow.cpp | 23 + tools/webview/src/PlayerWindow.h | 27 + tools/webview/src/RenderThread.cpp | 95 ++ tools/webview/src/RenderThread.h | 42 + tools/webview/src/main.cpp | 31 + tools/webview/src/main.qml | 23 + tools/webview/src/mainqt.cpp | 5 + tools/webview/src/resources.qrc | 6 + .../DomainContent/Toybox/pistol/pistol.js | 2 +- 226 files changed, 5403 insertions(+), 6931 deletions(-) delete mode 100644 android/apps/interface/src/main/java/io/highfidelity/gvrinterface/InterfaceActivity.java create mode 100644 android/apps/interface/src/main/java/io/highfidelity/hifiinterface/fragment/SignedInFragment.java rename android/apps/interface/src/main/res/drawable/{rounded_button_color1.xml => rounded_button.xml} (100%) create mode 100644 android/apps/interface/src/main/res/drawable/rounded_edit.xml create mode 100644 android/apps/interface/src/main/res/layout/fragment_signedin.xml create mode 100644 android/apps/questFramePlayer/CMakeLists.txt create mode 100644 android/apps/questFramePlayer/build.gradle rename android/apps/{interface => questFramePlayer}/proguard-rules.pro (100%) create mode 100644 android/apps/questFramePlayer/src/main/AndroidManifest.xml create mode 100644 android/apps/questFramePlayer/src/main/cpp/PlayerWindow.cpp create mode 100644 android/apps/questFramePlayer/src/main/cpp/PlayerWindow.h create mode 100644 android/apps/questFramePlayer/src/main/cpp/RenderThread.cpp create mode 100644 android/apps/questFramePlayer/src/main/cpp/RenderThread.h create mode 100644 android/apps/questFramePlayer/src/main/cpp/main.cpp create mode 100644 android/apps/questFramePlayer/src/main/java/io/highfidelity/frameplayer/QuestQtActivity.java create mode 100644 android/apps/questFramePlayer/src/main/java/io/highfidelity/frameplayer/QuestRenderActivity.java rename android/apps/{interface => questFramePlayer}/src/main/res/drawable/ic_launcher.xml (100%) create mode 100644 android/apps/questFramePlayer/src/main/res/values/strings.xml create mode 100644 android/apps/questInterface/CMakeLists.txt create mode 100644 android/apps/questInterface/build.gradle create mode 100644 android/apps/questInterface/proguard-rules.pro create mode 100644 android/apps/questInterface/src/main/AndroidManifest.xml create mode 100644 android/apps/questInterface/src/main/cpp/native.cpp create mode 100644 android/apps/questInterface/src/main/java/io/highfidelity/questInterface/MainActivity.java create mode 100644 android/apps/questInterface/src/main/java/io/highfidelity/questInterface/PermissionsChecker.java create mode 100644 android/apps/questInterface/src/main/java/io/highfidelity/questInterface/QuestActivity.java create mode 100644 android/apps/questInterface/src/main/res/drawable/ic_launcher.xml create mode 100644 android/apps/questInterface/src/main/res/values/strings.xml create mode 100644 android/apps/ui/CMakeLists.txt create mode 100644 android/apps/ui/proguard-rules.pro create mode 100644 android/apps/ui/src/main/AndroidManifest.xml create mode 100644 android/apps/ui/src/main/cpp/PlayerWindow.cpp create mode 100644 android/apps/ui/src/main/cpp/PlayerWindow.h create mode 100644 android/apps/ui/src/main/cpp/RenderThread.cpp create mode 100644 android/apps/ui/src/main/cpp/RenderThread.h create mode 100644 android/apps/ui/src/main/cpp/main.cpp create mode 100644 android/apps/ui/src/main/cpp/main.qml create mode 100644 android/apps/ui/src/main/cpp/mainqt.cpp create mode 100644 android/apps/ui/src/main/cpp/resources.qrc create mode 100644 android/apps/ui/src/main/java/io/highfidelity/ui/UiActivity.java create mode 100644 android/apps/ui/src/main/res/drawable/ic_launcher.xml create mode 100644 android/apps/ui/src/main/res/values/strings.xml create mode 100644 android/apps/ui/src/main/uiApp.pro create mode 100644 android/libraries/oculus/build.gradle create mode 100644 android/libraries/oculus/src/main/AndroidManifest.xml create mode 100644 android/libraries/oculus/src/main/java/io/highfidelity/oculus/OculusMobileActivity.java create mode 100644 cmake/macros/TargetEGL.cmake create mode 100644 cmake/macros/TargetOculusMobile.cmake delete mode 100644 gvr-interface/CMakeLists.txt delete mode 100644 gvr-interface/res/drawable/icon.png delete mode 100644 gvr-interface/src/Client.cpp delete mode 100644 gvr-interface/src/Client.h delete mode 100644 gvr-interface/src/GVRInterface.cpp delete mode 100644 gvr-interface/src/GVRInterface.h delete mode 100644 gvr-interface/src/GVRMainWindow.cpp delete mode 100644 gvr-interface/src/GVRMainWindow.h delete mode 100644 gvr-interface/src/InterfaceView.cpp delete mode 100644 gvr-interface/src/InterfaceView.h delete mode 100644 gvr-interface/src/LoginDialog.cpp delete mode 100644 gvr-interface/src/LoginDialog.h delete mode 100644 gvr-interface/src/RenderingClient.cpp delete mode 100644 gvr-interface/src/RenderingClient.h delete mode 100644 gvr-interface/src/java/io/highfidelity/gvrinterface/InterfaceActivity.java delete mode 100644 gvr-interface/src/main.cpp delete mode 100644 gvr-interface/templates/InterfaceBetaActivity.java.in delete mode 100644 gvr-interface/templates/hockeyapp.xml.in delete mode 100644 interface/resources/qml/+android/StatText.qml delete mode 100644 interface/resources/qml/+android/Stats.qml delete mode 100644 interface/resources/qml/LoginDialog/+android/LinkAccountBody.qml delete mode 100644 interface/resources/qml/LoginDialog/+android/SignUpBody.qml delete mode 100644 interface/resources/qml/controlsUit/+android/ImageButton.qml delete mode 100644 interface/resources/qml/desktop/+android/FocusHack.qml delete mode 100644 interface/resources/qml/hifi/+android/ActionBar.qml delete mode 100644 interface/resources/qml/hifi/+android/AudioBar.qml delete mode 100644 interface/resources/qml/hifi/+android/AvatarOption.qml delete mode 100644 interface/resources/qml/hifi/+android/Desktop.qml delete mode 100644 interface/resources/qml/hifi/+android/HifiConstants.qml delete mode 100644 interface/resources/qml/hifi/+android/StatsBar.qml delete mode 100644 interface/resources/qml/hifi/+android/WindowHeader.qml delete mode 100644 interface/resources/qml/hifi/+android/bottomHudOptions.qml delete mode 100644 interface/resources/qml/hifi/+android/button.qml delete mode 100644 interface/resources/qml/hifi/+android/modesbar.qml delete mode 100644 interface/resources/qml/stylesUit/+android/HifiConstants.qml delete mode 100644 interface/src/java/io/highfidelity/interface/InterfaceActivity.java create mode 100644 libraries/oculusMobile/CMakeLists.txt create mode 100644 libraries/oculusMobile/src/ovr/Forward.h create mode 100644 libraries/oculusMobile/src/ovr/Framebuffer.cpp create mode 100644 libraries/oculusMobile/src/ovr/Framebuffer.h create mode 100644 libraries/oculusMobile/src/ovr/GLContext.cpp create mode 100644 libraries/oculusMobile/src/ovr/GLContext.h create mode 100644 libraries/oculusMobile/src/ovr/Helpers.cpp create mode 100644 libraries/oculusMobile/src/ovr/Helpers.h create mode 100644 libraries/oculusMobile/src/ovr/TaskQueue.cpp create mode 100644 libraries/oculusMobile/src/ovr/TaskQueue.h create mode 100644 libraries/oculusMobile/src/ovr/VrHandler.cpp create mode 100644 libraries/oculusMobile/src/ovr/VrHandler.h create mode 100644 libraries/oculusMobilePlugin/CMakeLists.txt create mode 100644 libraries/oculusMobilePlugin/src/Logging.cpp create mode 100644 libraries/oculusMobilePlugin/src/Logging.h create mode 100644 libraries/oculusMobilePlugin/src/OculusMobileControllerManager.cpp create mode 100644 libraries/oculusMobilePlugin/src/OculusMobileControllerManager.h create mode 100644 libraries/oculusMobilePlugin/src/OculusMobileDisplayPlugin.cpp create mode 100644 libraries/oculusMobilePlugin/src/OculusMobileDisplayPlugin.h create mode 100644 libraries/render-utils/src/parabola_forward.slv delete mode 100644 scripts/+android/defaultScripts.js delete mode 100644 scripts/system/+android/actionbar.js delete mode 100644 scripts/system/+android/audio.js delete mode 100644 scripts/system/+android/clickWeb.js delete mode 100644 scripts/system/+android/displayNames.js delete mode 100644 scripts/system/+android/modes.js delete mode 100644 scripts/system/+android/radar.js delete mode 100644 scripts/system/+android/stats.js delete mode 100644 scripts/system/+android/touchscreenvirtualpad.js delete mode 100644 scripts/system/+android/uniqueColor.js create mode 100644 tools/noramlizeFrame.py create mode 100644 tools/webview/CMakeLists.txt create mode 100644 tools/webview/src/PlayerWindow.cpp create mode 100644 tools/webview/src/PlayerWindow.h create mode 100644 tools/webview/src/RenderThread.cpp create mode 100644 tools/webview/src/RenderThread.h create mode 100644 tools/webview/src/main.cpp create mode 100644 tools/webview/src/main.qml create mode 100644 tools/webview/src/mainqt.cpp create mode 100644 tools/webview/src/resources.qrc diff --git a/.gitignore b/.gitignore index 5a965b494c..4c262f9f4a 100644 --- a/.gitignore +++ b/.gitignore @@ -24,6 +24,7 @@ android/**/bin android/**/src/main/res/values/libs.xml android/**/src/main/assets android/**/gradle* +*.class # VSCode # List taken from Github Global Ignores master@435c4d92 diff --git a/CMakeLists.txt b/CMakeLists.txt index 6956fd22c3..4d616e1f3a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -80,6 +80,7 @@ endif() if (ANDROID) set(GLES_OPTION ON) set(PLATFORM_QT_COMPONENTS AndroidExtras WebView) + add_definitions(-DHIFI_ANDROID_APP=\"${HIFI_ANDROID_APP}\") else () set(PLATFORM_QT_COMPONENTS WebEngine) endif () diff --git a/android/apps/interface/src/main/java/io/highfidelity/gvrinterface/InterfaceActivity.java b/android/apps/interface/src/main/java/io/highfidelity/gvrinterface/InterfaceActivity.java deleted file mode 100644 index aad769de70..0000000000 --- a/android/apps/interface/src/main/java/io/highfidelity/gvrinterface/InterfaceActivity.java +++ /dev/null @@ -1,42 +0,0 @@ -// -// InterfaceActivity.java -// gvr-interface/java -// -// Created by Stephen Birarda on 1/26/15. -// Copyright 2015 High Fidelity, Inc. -// -// Distributed under the Apache License, Version 2.0. -// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html -// - -package io.highfidelity.gvrinterface; - -import android.content.Intent; -import android.net.Uri; -import android.os.Bundle; -import android.view.View; -import android.view.WindowManager; -import android.util.Log; -import org.qtproject.qt5.android.bindings.QtActivity; - -public class InterfaceActivity extends QtActivity { - - public static native void handleHifiURL(String hifiURLString); - - @Override - public void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); - - // Get the intent that started this activity in case we have a hifi:// URL to parse - Intent intent = getIntent(); - if (intent.getAction() == Intent.ACTION_VIEW) { - Uri data = intent.getData(); - - if (data.getScheme().equals("hifi")) { - handleHifiURL(data.toString()); - } - } - - } -} \ No newline at end of file diff --git a/android/apps/interface/src/main/java/io/highfidelity/hifiinterface/InterfaceActivity.java b/android/apps/interface/src/main/java/io/highfidelity/hifiinterface/InterfaceActivity.java index b7d2157737..fce5c2553e 100644 --- a/android/apps/interface/src/main/java/io/highfidelity/hifiinterface/InterfaceActivity.java +++ b/android/apps/interface/src/main/java/io/highfidelity/hifiinterface/InterfaceActivity.java @@ -166,8 +166,27 @@ public class InterfaceActivity extends QtActivity implements WebViewFragment.OnW @Override protected void onDestroy() { - super.onDestroy(); nativeOnDestroy(); + /* + cduarte https://highfidelity.manuscript.com/f/cases/16712/App-freezes-on-opening-randomly + After Qt upgrade to 5.11 we had a black screen crash after closing the application with + the hardware button "Back" and trying to start the app again. It could only be fixed after + totally closing the app swiping it in the list of running apps. + This problem did not happen with the previous Qt version. + After analysing changes we came up with this case and change: + https://codereview.qt-project.org/#/c/218882/ + In summary they've moved libs loading to the same thread as main() and as a matter of correctness + in the onDestroy method in QtActivityDelegate, they exit that thread with `QtNative.m_qtThread.exit();` + That exit call is the main reason of this problem. + + In this fix we just replace the `QtApplication.invokeDelegate();` call that may end using the + entire onDestroy method including that thread exit line for other three lines that purposely + terminate qt (borrowed from QtActivityDelegate::onDestroy as well). + */ + QtNative.terminateQt(); + QtNative.setActivity(null, null); + System.exit(0); + super.onDestroy(); } @Override diff --git a/android/apps/interface/src/main/java/io/highfidelity/hifiinterface/fragment/SignedInFragment.java b/android/apps/interface/src/main/java/io/highfidelity/hifiinterface/fragment/SignedInFragment.java new file mode 100644 index 0000000000..9ed2f1c7f5 --- /dev/null +++ b/android/apps/interface/src/main/java/io/highfidelity/hifiinterface/fragment/SignedInFragment.java @@ -0,0 +1,73 @@ +package io.highfidelity.hifiinterface.fragment; + +import android.app.Fragment; +import android.content.Context; +import android.os.Bundle; +import android.text.Html; +import android.text.Spanned; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.Button; +import android.widget.TextView; + +import java.io.IOException; +import java.io.InputStream; + +import io.highfidelity.hifiinterface.R; + +public class SignedInFragment extends Fragment { + + private Button mGetStartedButton; + private OnSignedInInteractionListener mListener; + + public SignedInFragment() { + // Required empty public constructor + } + + public static SignedInFragment newInstance() { + SignedInFragment fragment = new SignedInFragment(); + return fragment; + } + + @Override + public View onCreateView(LayoutInflater inflater, ViewGroup container, + Bundle savedInstanceState) { + View rootView = inflater.inflate(R.layout.fragment_signedin, container, false); + mGetStartedButton = rootView.findViewById(R.id.getStarted); + + mGetStartedButton.setOnClickListener(view -> { + getStarted(); + }); + + return rootView; + } + + @Override + public void onAttach(Context context) { + super.onAttach(context); + if (context instanceof SignedInFragment.OnSignedInInteractionListener) { + mListener = (SignedInFragment.OnSignedInInteractionListener) context; + } else { + throw new RuntimeException(context.toString() + + " must implement OnSignedInInteractionListener"); + } + } + + @Override + public void onDetach() { + super.onDetach(); + mListener = null; + } + + public void getStarted() { + if (mListener != null) { + mListener.onGettingStarted(); + } + } + + public interface OnSignedInInteractionListener { + void onGettingStarted(); + } + +} diff --git a/android/apps/interface/src/main/res/drawable/rounded_button_color1.xml b/android/apps/interface/src/main/res/drawable/rounded_button.xml similarity index 100% rename from android/apps/interface/src/main/res/drawable/rounded_button_color1.xml rename to android/apps/interface/src/main/res/drawable/rounded_button.xml diff --git a/android/apps/interface/src/main/res/drawable/rounded_edit.xml b/android/apps/interface/src/main/res/drawable/rounded_edit.xml new file mode 100644 index 0000000000..3c1cac4d1d --- /dev/null +++ b/android/apps/interface/src/main/res/drawable/rounded_edit.xml @@ -0,0 +1,7 @@ + + + + + + \ No newline at end of file diff --git a/android/apps/interface/src/main/res/layout/fragment_signedin.xml b/android/apps/interface/src/main/res/layout/fragment_signedin.xml new file mode 100644 index 0000000000..1c982b0e0d --- /dev/null +++ b/android/apps/interface/src/main/res/layout/fragment_signedin.xml @@ -0,0 +1,63 @@ + + + + + + + +