我想达成的结果是——通过发生器创建四种不同的临时实体,分别是绕x轴旋转180度、绕z轴旋转180度、绕x轴和z轴旋转180度、不旋转这四种临时实体,同时给这四种临时实体赋标签分别为xRotation、zRotation、xzRotation、noRotation。然后从PF里的判断命令中引出4条支线1、2、3、4分别对应上面四种实体,判断里的代码总是识别不了我给临时实体设置的标签,有没有哪位老师可以帮我看一下,是哪里的问题,该怎么办才能解决,十分感谢!
7 X0 L; G% l: K% [' C4 k$ P& i发生器的代码如下:( h' g" ]: u4 V$ E+ [! P- n
/**Custom Code*/# t" v% C7 S1 f& }5 |
, s% h4 [7 [# N1 {
Object current = ownerobject(c);! l- ^) E8 C/ X1 m# w: K. e5 a5 E
Object item = param(1);
4 K& I+ D/ `. V8 }% W7 h* ]3 dint port = param(2);( w& C2 v1 s& y: E
4 ]6 G8 W; v1 \( f% ?3 x7 GObject involved = item;& |. o5 @% }+ l+ w8 A
double x1 =180;$ C' G, N% ? `& K- Y1 M, F+ N
double y1 = 0;
2 y; o; N8 q7 Ndouble z1 = 0; c6 b4 x- ~; \) e7 E$ |
; E7 {* ~! B- ^; Ydouble x2 = 0;
; n$ b! g6 M% o5 s& @+ P0 ~double y2 = 0;. P" P' h8 U% d8 K
double z2 = 180;1 s3 V% g K! ]
% Y; O9 ~: ~$ I* k. Zdouble x3 = 180;9 @. W$ |' U- k4 T5 B* h( B$ `
double y3 = 0;
4 m0 R7 @* C( C; ?& J9 Xdouble z3 = 180;
' @, u& V. L* d7 u! B1 \# z* p8 o! V1 i& r1 T# ^# [
double x4 = 0;/ o4 t0 I5 B- G% ?
double y4 = 0;$ _4 B3 K/ q1 F
double z4 = 0;
- w! ~9 w6 W' @- V1 l0 `, z7 K* F' i4 p! m1 m9 E
double randomVal = duniform(0, 4);( w- y% w! N) v; `
if(randomVal < 1)
; C9 A% a! E" E8 ~" Z# D{
$ e& z" V7 @4 _1 f1 T# H& R setrot(involved, x1, y1, z1);
$ B# j/ O3 R: E0 B1 [# d, E: P4 F& N setlabel(involved,"Rotation","xRotation");+ \* g- M4 l# q5 y! q; z
}; I" J5 Q3 k( S" e; T
else if( randomVal < 2)
1 b% X" P; ]- |: J/ U7 m* o2 g O{
/ o4 t, w1 i& r: t setrot(involved, x2, y2, z2);
$ t# h" h& r- k7 n; \& j# P# W: E" V setlabel(involved,"Rotation","zRotation");
7 e, e/ v% p6 `: [}
& N9 Q' t" t! }0 Helse if(randomVal < 3 )& N: y- V& E6 G: C; ^
{$ T$ i% g3 [; m' j N* A0 n, W0 J
setrot(involved, x3, y3, z3);
. J+ A: Y9 v2 ^ ~ setlabel(involved,"Rotation","xzRotation");8 v1 ?/ F, ?& |# R' g( P& `1 V
}0 o; s5 l; a" E5 @( L4 M3 {: q
else
* |! N9 v! Q0 A2 K; L6 z9 g! }{" A* k* h4 t1 n* f: H5 W* B* N5 y
setrot(involved, x4, y4, z4);4 h- G3 T% ?$ I5 V3 E, c$ m
setlabel(involved,"Rotation","noRotation");
# j6 F) z6 h# N& N* X( r# N}
! {" Q7 y# O5 G) C/ T: A判断的代码如下:
- D% q2 g: v0 f+ A0 k- f1 m/**Custom Code*/! y9 U, s4 l/ Z7 p
Object current =ownerobject(c);- f, j2 w5 M: o
Object item = param(1);
; k0 a" i0 R3 E' D, Y* Mint port = param(2);
# M/ _1 K4 w; ]6 i$ w1 P8 L
! Q$ u. s" T) T8 M( ~Object involved = item;* g: Q: y( B0 [. I2 r
) g* j' ~' h1 J+ l. T' p% Rstring labelVal = getlabelstr(involved, "Rotation");
3 I G6 ^. {5 m
* Q5 a: t$ V" S+ H) L8 jif(labelVal == "xRotation")
: F5 ?# M4 K7 e3 ~; p. F{7 g# t# V) z7 J1 a
return 1; // Divert the item to port 1
. g9 C" }! a! }( L" g' ^}
( |0 F/ e% K. c9 S! G1 Z8 telse if(labelVal == "zRotation")
4 v0 M" v0 K2 k, F{
- k/ B3 M& ]' l% K return 2; // Divert the item to port 2
( b" u6 D+ e9 Y1 x5 A4 c4 [0 m}, E' P q8 l3 X7 p& I0 L( y# g
else if(labelVal == "xzRotation")
, I3 o4 m6 X0 v' U. u# b- `% P{& i* l; @$ d/ v" @. F
return 3; // Divert the item to port 3$ Q; ?$ h- Q2 k7 b. N( d# u/ j
}
# w) M, H, |& U) r' u: g) Gelse if(labelVal == "noRotation")
! z% ]- Q# l7 c: A! @ X{+ H, d+ h: c: u0 G
return 4; // Divert the item to port 4 e% A3 I3 h* {0 Z6 B- _
}
1 m( V: X4 @$ u2 K/ l
, e1 b* A3 z& |) ]' g0 l模型附上:8 u- v% m+ V6 `( z' ?3 z7 w q
|