我想达成的结果是——通过发生器创建四种不同的临时实体,分别是绕x轴旋转180度、绕z轴旋转180度、绕x轴和z轴旋转180度、不旋转这四种临时实体,同时给这四种临时实体赋标签分别为xRotation、zRotation、xzRotation、noRotation。然后从PF里的判断命令中引出4条支线1、2、3、4分别对应上面四种实体,判断里的代码总是识别不了我给临时实体设置的标签,有没有哪位老师可以帮我看一下,是哪里的问题,该怎么办才能解决,十分感谢!, S- q2 m- L' U- H* p: z
发生器的代码如下:' e, Y w: a) _ y2 J$ w" N* r$ g
/**Custom Code*/5 c$ Z5 V8 S) M$ J! V4 X2 W9 n9 Z
) w4 Z- x8 q2 G; n2 z0 G
Object current = ownerobject(c);
; q7 }6 i9 L3 c {' z; EObject item = param(1);7 ]& I/ ^$ g% q! v
int port = param(2);
7 ~: b- U, Z+ S2 S' `" E" L5 }# f$ j; [3 o+ @; b( }
Object involved = item;
0 ?* D, d) |- |' Z: Gdouble x1 =180;1 Q: i( L/ t9 p0 z( v) V
double y1 = 0;
0 I8 w' Y& G7 E) [% i& U4 c1 zdouble z1 = 0;1 z6 ~8 b1 b" e" O8 }! O
; v3 z7 l1 D7 R
double x2 = 0;9 B7 J, u& F: {6 f
double y2 = 0;
% i V: t" V$ Fdouble z2 = 180;# i4 a( C7 c8 c. g
' t7 u% Y7 k" r! }: T
double x3 = 180;
0 X/ f$ m+ L: A4 T5 {2 } ldouble y3 = 0;! _6 v& K( c" f1 Z! t* |6 `
double z3 = 180; l* ~; Q" o7 R& j
. ` w+ i4 T7 E: d( O- K8 G
double x4 = 0;
# X$ k3 i# K/ O" idouble y4 = 0;' Y J- b( J. w* r2 x4 i4 o
double z4 = 0;) c4 d; I6 e0 A: o) y* q
& s% V3 R2 _' o) Z9 o: e& }
double randomVal = duniform(0, 4);- v) Z% z4 b/ i+ w6 m8 I* [
if(randomVal < 1)
8 y7 h3 `. y- l" q, b0 e{
! B r, x2 Z, f+ Y8 I( y setrot(involved, x1, y1, z1);. L5 ], G* ~2 r5 Q
setlabel(involved,"Rotation","xRotation");
' Z5 G4 F5 ?0 V+ D) `5 ?}
! `& I0 C2 `+ G- d: o# [else if( randomVal < 2)$ }, F8 h3 v! d( Y9 V
{ 3 w) v: _, p- |2 ]
setrot(involved, x2, y2, z2);
% {- B3 C4 N! E5 L1 |7 z setlabel(involved,"Rotation","zRotation");
- O9 @2 y$ B9 @$ B4 }* L}7 I: \9 R' b. |
else if(randomVal < 3 )- R1 Z* t9 x; j9 B7 k: d
{# R! w* Z1 ]. K/ H( `7 f" I
setrot(involved, x3, y3, z3);
+ s3 S* L# m! A, T# U setlabel(involved,"Rotation","xzRotation");$ G# r/ F/ ]7 I+ Q
}! D+ w/ |) t4 R6 H4 a( K8 Y' D
else
9 y: G, u( N5 Y p8 P{
( ^3 q0 o& w: i4 d setrot(involved, x4, y4, z4);5 y9 {2 o3 K: q9 R+ Q
setlabel(involved,"Rotation","noRotation");
4 E. _( l# u+ c- T! ?6 ?}7 `/ Z( q6 p# i9 a/ Q3 p
判断的代码如下:1 ?, j8 f z1 T5 w* r: F
/**Custom Code*/+ H# R1 y8 t9 W
Object current =ownerobject(c);
4 p+ `2 M$ ^9 {. l7 dObject item = param(1);' r, \6 k( J( t& a- u7 y/ p
int port = param(2);
% H3 ?/ w0 u2 P1 a
) R$ q' c7 o0 E/ G( bObject involved = item;
: T# k& `7 k* W. `' H! `0 B7 A' ^& I9 l6 H" j& c
string labelVal = getlabelstr(involved, "Rotation");
2 s( n4 b# k- F" d+ H" h ], a; u$ z( D1 w0 P v1 V" K9 G0 [# O
if(labelVal == "xRotation")& I: k9 I+ v( }5 H2 z4 Z+ J
{
d; O9 e; W0 q) B return 1; // Divert the item to port 1
% z8 o$ _5 x a7 K' D}
* k2 m$ [6 N2 z. {6 G G+ melse if(labelVal == "zRotation")
, \" }1 s; z9 c{
: O/ ~" i: {( Z- ^ return 2; // Divert the item to port 2
9 E% B( Q: B+ N, z( L* U}; k, l/ v' m2 L! k- _. s( b ]
else if(labelVal == "xzRotation")- e8 v# u3 z" O' P1 R
{) u7 M2 Z& d2 }3 Y: e
return 3; // Divert the item to port 3
! b: ?, ]4 t/ Z! F4 H$ d& [8 u}
- \7 ?0 K" F, w8 W0 e- O: s% qelse if(labelVal == "noRotation")7 a: l; S- n( P9 Q& D3 V" z. W
{
# c) C) r2 E! s1 e: M4 f return 4; // Divert the item to port 4
5 q7 Z& h" F& {9 G& ^0 v}
6 }/ I* p5 F/ U7 V/ k8 E8 g: ?! }( ]2 v# E1 k! X+ p* Y* t
模型附上:
' N; l- B# i; a7 f |