我想达成的结果是——通过发生器创建四种不同的临时实体,分别是绕x轴旋转180度、绕z轴旋转180度、绕x轴和z轴旋转180度、不旋转这四种临时实体,同时给这四种临时实体赋标签分别为xRotation、zRotation、xzRotation、noRotation。然后从PF里的判断命令中引出4条支线1、2、3、4分别对应上面四种实体,判断里的代码总是识别不了我给临时实体设置的标签,有没有哪位老师可以帮我看一下,是哪里的问题,该怎么办才能解决,十分感谢!
+ t) V* F1 B- G; W3 c发生器的代码如下:8 r4 l: ?8 V+ o7 q8 t7 N/ N
/**Custom Code*/% E' z" l5 ]5 L7 l$ t( O/ W
" A+ X: d) x5 }4 S
Object current = ownerobject(c);6 ^8 P4 r, F6 h+ i5 D
Object item = param(1);& W( C! t, d t. D5 \: H1 r: k
int port = param(2);
0 s& @. b1 b7 ^" F6 Q0 A" L I8 T
8 f0 f0 o& d) qObject involved = item;
$ Z) w! q. |) U. }# G% vdouble x1 =180;1 x* ^$ S! M9 V
double y1 = 0;
* U6 t2 W0 ]9 f# u6 ldouble z1 = 0;3 f" }$ J( F, o3 H" o- P5 ~9 |0 w
" X& u9 G% J# t' b' C% m
double x2 = 0;; z" s" t- j9 {9 k e, A
double y2 = 0;- n4 _& J8 E7 y' S' Q$ z r
double z2 = 180;
; M: k/ j+ X- Q& N l( y) n, @+ H, F& }
double x3 = 180;
3 U: R" N( i& B4 D1 C* p# ddouble y3 = 0;
6 u8 R8 Z2 v9 l; R K/ cdouble z3 = 180;
6 q1 Q Y' p: G% l& l1 N; P
% w; a9 X" L6 Q- k' Z8 T4 k0 `double x4 = 0;
3 ]& A. [& ^" I' \8 _double y4 = 0;
( U6 S; f# r, Z& gdouble z4 = 0;& r4 Z& ]. b1 V- Q- q
9 L$ C; b P/ n4 C/ Zdouble randomVal = duniform(0, 4);
& d2 u1 @; u) ~9 h0 I2 S: [/ @if(randomVal < 1)
3 u- B* y% f: J1 w: h6 N) L6 c" {) H! Z{2 P4 m7 @9 ?) H0 y
setrot(involved, x1, y1, z1);/ e! Y* I2 E" E. ~% g* V" d
setlabel(involved,"Rotation","xRotation");, V! f# P8 `" E G+ o
}- {3 C) m- O0 k1 B; O" K& Y( i5 n: P+ I+ s
else if( randomVal < 2)+ W- _4 M' h" l- k
{ 7 D+ V% m) l1 x4 J5 y) C2 a
setrot(involved, x2, y2, z2);
" R9 \1 t; \ w' D0 P: Z9 Q setlabel(involved,"Rotation","zRotation");
9 y. [5 c5 v; A" Z9 y1 r1 Y}6 j4 K4 x1 _: X$ x1 {9 `7 M0 [
else if(randomVal < 3 )
$ t* Z0 ?# ?* S, m{3 o0 j7 `( d% d' V+ a. |# ]) q
setrot(involved, x3, y3, z3);
* r& n; | P: ?1 [. U4 p' ]2 N setlabel(involved,"Rotation","xzRotation");' R/ f4 R0 F0 @$ h& W! ~. @8 ^) S
}
' K" I) n) A6 @else) S+ A% g N8 f" P5 |& g1 J3 }
{5 J R* N( V% ?" W O1 y
setrot(involved, x4, y4, z4);
" Q. {9 a2 { b @ setlabel(involved,"Rotation","noRotation");
4 e4 N3 A1 G/ {1 D- B5 Z; ~, e, L}+ J+ Y, ?, G/ @+ p
判断的代码如下:3 a# |3 o! G1 \6 K) }! @
/**Custom Code*/
. R4 I& B3 E! `Object current =ownerobject(c);
, r8 n/ w, o8 h- Z' WObject item = param(1);; J0 R/ F) u% S7 a$ ~% V6 F
int port = param(2);6 s& C9 e) h. ~7 P! z& T
0 @& v! A& m. \4 T9 n2 b3 FObject involved = item;) o4 Y. i/ j& ^0 X; Z
~1 u: z9 `# Y9 L& A( R& U. \: z
string labelVal = getlabelstr(involved, "Rotation");
2 ? {2 s ^+ t4 |+ F5 N' e3 Q+ t+ u, @/ [& T {* u4 N
if(labelVal == "xRotation")+ i9 f |5 C$ y9 L2 q. d2 n% [
{
, Y- ^; Y% W" v' j, l7 I5 M return 1; // Divert the item to port 1! n6 n$ O7 |1 w
}- U& r" X+ m& ^4 c
else if(labelVal == "zRotation")
: E3 S) J0 A6 T! _{
& ~- ~0 L7 Y9 k* k) m n7 z return 2; // Divert the item to port 2
# C% l) p) t& J: ]( E1 b9 d5 M}0 T. R. l- @) r+ J6 C" C$ Z
else if(labelVal == "xzRotation")" h" \5 d; U+ s1 B k$ t b
{0 v& J6 q) ~9 I. {
return 3; // Divert the item to port 35 x$ [, x) E' [" E% |/ x
}9 m1 A' @. x' u1 o4 U
else if(labelVal == "noRotation")
' \2 T5 G7 {/ s4 E J{
' J1 n9 x& @( |0 |$ r' l return 4; // Divert the item to port 4
4 t5 J1 p+ P. c}
5 E+ H5 v' O% }. ?2 v. q
4 T* O+ E4 q* H4 t0 H4 D模型附上:9 i2 {, A% k- Z% \- g2 l
|