我想达成的结果是——通过发生器创建四种不同的临时实体,分别是绕x轴旋转180度、绕z轴旋转180度、绕x轴和z轴旋转180度、不旋转这四种临时实体,同时给这四种临时实体赋标签分别为xRotation、zRotation、xzRotation、noRotation。然后从PF里的判断命令中引出4条支线1、2、3、4分别对应上面四种实体,判断里的代码总是识别不了我给临时实体设置的标签,有没有哪位老师可以帮我看一下,是哪里的问题,该怎么办才能解决,十分感谢!& O3 Y2 H4 C( G& Z% d
发生器的代码如下:9 ^' b+ R1 D0 _1 f# H% y
/**Custom Code*/9 ^9 R" M( n* g+ Y; J
, K4 k% R! c& b# D7 l U4 N
Object current = ownerobject(c);+ f5 |1 [7 b+ D7 W6 q% l6 u
Object item = param(1);! n. S- I: u$ c' O, p8 X7 o
int port = param(2);3 t6 a0 ^" o, R* I8 ]
7 o+ o4 t4 u5 _* x# G; yObject involved = item;
1 F+ T1 j3 ?1 p1 X! o+ t7 y& Xdouble x1 =180;
0 Z% g. r9 a) K. |1 Y2 `2 tdouble y1 = 0;
6 U2 B; l2 |! x& `& Udouble z1 = 0;
' ~5 l- n$ e$ d( M& c' U+ q" A2 N X
% M$ M7 {8 a0 A( ]: Q- Zdouble x2 = 0;' ~& Q1 Q4 ~# |/ v! o* B! ^( V! K/ q
double y2 = 0;
7 P8 {+ {, w8 Ydouble z2 = 180;# z+ X+ p( `! X! S
, P% R9 o" z" |0 Z3 \
double x3 = 180;
* M2 J$ L( B [! ndouble y3 = 0;/ ~. z% B6 I1 X( d' }8 J* t/ H/ {
double z3 = 180;
" |" X6 o9 x; q
- W4 a; {5 e. Q/ g, Bdouble x4 = 0;
' `) X O# `) L+ H. Bdouble y4 = 0;
& B. h. O7 e j. U) W- t& Ddouble z4 = 0;7 p# m- j; K0 H( Z
3 G5 j; ]+ \. gdouble randomVal = duniform(0, 4);
4 v& {4 f1 d8 K: Fif(randomVal < 1)
6 |0 z7 @- p R: i& E6 n* g% h; I% j{ _5 v' w1 u' u. t. ^1 @$ L
setrot(involved, x1, y1, z1);
- V! H. y( m7 W; a setlabel(involved,"Rotation","xRotation");
2 F; E- Y# p0 @: E) j' z}
$ W5 v! z+ \6 p+ B. welse if( randomVal < 2)
' \+ q8 u3 d9 H- y/ f{ 2 l# }8 p% g u2 i; {% m3 _
setrot(involved, x2, y2, z2);
" {0 O% V7 j1 ?5 P( d" Y# H setlabel(involved,"Rotation","zRotation");7 o/ {7 C* ]. D) m1 }
}1 @9 e0 z) F, G* b H* V
else if(randomVal < 3 )
6 [! B" ]) a- o: t{
/ B1 T% g' g- Z! F$ L5 R! w, |& [ setrot(involved, x3, y3, z3);9 j! x% e, v& b* _+ B
setlabel(involved,"Rotation","xzRotation");
- Q0 U2 w" ^3 d, [5 f/ Q! q}
! {* y% g$ y* z- P5 _else
- m `. e5 s3 C; S, \6 a% ]: C9 a{
$ G( W0 j$ g) d. W$ e0 {$ Z8 R3 ` setrot(involved, x4, y4, z4);
9 j; P" I1 w; M; x& S$ g9 Z setlabel(involved,"Rotation","noRotation");
0 t! C5 ~" w4 [) w3 F" u6 d( t}
) n$ [6 j9 t6 _判断的代码如下:6 U0 s0 {. C( T( [2 h# I
/**Custom Code*/+ Q. `7 k4 z" K" } N' Z7 g
Object current =ownerobject(c);
8 c' w; C; M& [/ F2 U; }Object item = param(1);3 b2 S; g I `2 w
int port = param(2);2 L' k$ H1 P+ w) P
5 s! \4 ^' @ kObject involved = item;2 r9 G e( H. U2 X+ A, ^( e
) O. y) l) w4 G) C1 W3 Mstring labelVal = getlabelstr(involved, "Rotation");' L. }; {2 ?/ f9 Q+ ?; O# ~/ r
+ G y% G/ W% g$ _, ?& Uif(labelVal == "xRotation")
4 X. C1 b0 E& L( Y{5 ?/ n+ @% a, O9 C0 r K
return 1; // Divert the item to port 1
8 P& y' o8 C/ `8 T. G}
) U" Y3 `0 e7 O" d5 qelse if(labelVal == "zRotation")7 q3 F n( j- l, D9 V( z6 f6 X) C
{6 [0 t/ m+ |1 }+ i0 S! b9 `
return 2; // Divert the item to port 2
@1 _2 I/ o4 G3 \# ~}7 A2 L5 O# O8 V0 q# ^8 P
else if(labelVal == "xzRotation")
/ d5 m$ e0 H0 z/ F( M/ M{
1 E4 a: x o& [ return 3; // Divert the item to port 3$ \! s5 v' h3 g3 T5 I8 Z8 Y2 [7 b
}# W: F2 Q& a+ @9 O- m8 O: J+ l
else if(labelVal == "noRotation")( ^% d7 K" v, {
{3 d2 V; Z3 H9 c9 r
return 4; // Divert the item to port 4; G: N/ j0 U- A$ C7 e' f
}0 N9 v2 x+ m6 h& F- `- J9 l b
9 _9 k4 u; @8 h2 ^, b( S模型附上:' p3 h% D, e) n4 a' m
|