Jump to content

about change character random


photo

Recommended Posts

Hi,

 

my scene is a metro station, there are many people sit or stand on the train(more than 200 people).there are only 15 kinds model, but each model have 3-5 suits cloth(material) .in fact, 3 pants with 3 jacket could mix to 9 suits.

 

I want that every time I reload the world ,the model and their material would changed random.

 

Now my way is create every possible suit to materials. it's a huge work..

 

does any one have good ideas? thanks!

 

this is part of code
 
Node peopie_n;
//obstacle = new ObstacleSphere(0.3f);
//random load station passenger
void randloadhuman(){
 
int count=10;
forloop(int i =0; count){
Node n = engine.editor.getNodeByName("Brith_" + string(i));
Brith_n.append(node_cast(n));
Vec3 p = Brith_n.getPosition();
Brith_pos.append(p);
int passenger=rand(1,10);
if(passenger==1){
peopie_n = node_load("metro/human/man/nodes/man_idle_basic.node");
 
}else if(passenger==2){
peopie_n = node_load("metro/human/boy/nodes/boy_idle_basic.node");
 
}else if(passenger==3){
peopie_n = node_load("metro/human/girl/nodes/girl_idle_basic.node");
 
}else if(passenger==4){
peopie_n = node_load("metro/human/man_handbag/nodes/man_handbag_idle_basic.node");
 
}else if(passenger==5){
peopie_n = node_load("metro/human/woman/nodes/woman_idle_basic.node");
 
}else if(passenger==6){
peopie_n = node_load("metro/human/woman_handbag/nodes/woman_handbag_idle_basic.node");
 
}else if(passenger==7){
peopie_n = node_load("metro/human/children/nodes/children_idle_basic.node");
 
}else if(passenger==8){
peopie_n = node_load("metro/human/grandma/nodes/grandma_idle_basic.node");
 
}else if(passenger==9){
peopie_n = node_load("metro/human/grandpa/nodes/grandpa_idle_basic.node");
 
}
peopie_n.setPosition(Brith_pos);
peopie_n.setRotation(peopie_n.getRotation() * quat(rotateZ(180))) ;
//peopie_n.addChild(obstacle);
//obstacle.setTransform(translate(Vec3(0,0,0)));
humans.append(node_cast(peopie_n));
count--;
//engine.editor.addNode(peopie_n);
}
Link to comment
×
×
  • Create New...