-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbcorner_move.cpp
More file actions
74 lines (69 loc) · 2.6 KB
/
bcorner_move.cpp
File metadata and controls
74 lines (69 loc) · 2.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
FLAMEGPU_AGENT_FUNCTION(bcorner_move, flamegpu::MessageNone, flamegpu::MessageNone) {
//Agent position vector
float agent_x = FLAMEGPU->getVariable<float>("x");
float agent_y = FLAMEGPU->getVariable<float>("y");
float agent_z = FLAMEGPU->getVariable<float>("z");
int agent_id = FLAMEGPU->getVariable<int>("id");
//Boundary positions
const float COORD_BOUNDARY_X_POS = FLAMEGPU->environment.getProperty<float>("COORDS_BOUNDARIES",0);
const float COORD_BOUNDARY_X_NEG = FLAMEGPU->environment.getProperty<float>("COORDS_BOUNDARIES",1);
const float COORD_BOUNDARY_Y_POS = FLAMEGPU->environment.getProperty<float>("COORDS_BOUNDARIES",2);
const float COORD_BOUNDARY_Y_NEG = FLAMEGPU->environment.getProperty<float>("COORDS_BOUNDARIES",3);
const float COORD_BOUNDARY_Z_POS = FLAMEGPU->environment.getProperty<float>("COORDS_BOUNDARIES",4);
const float COORD_BOUNDARY_Z_NEG = FLAMEGPU->environment.getProperty<float>("COORDS_BOUNDARIES",5);
//printf("BCORNER %d position update -> (%2.6f, %2.6f,%2.6f, %2.6f, %2.6f, %2.6f)\n", agent_id, COORD_BOUNDARY_X_POS, COORD_BOUNDARY_X_NEG, COORD_BOUNDARY_Y_POS, COORD_BOUNDARY_Y_NEG, COORD_BOUNDARY_Z_POS, COORD_BOUNDARY_Z_NEG);
switch((int)agent_id) {
case 1 :
// +x,+y,+z
agent_x = COORD_BOUNDARY_X_POS;
agent_y = COORD_BOUNDARY_Y_POS;
agent_z = COORD_BOUNDARY_Z_POS;
break;
case 2 :
// -x,+y,+z
agent_x = COORD_BOUNDARY_X_NEG;
agent_y = COORD_BOUNDARY_Y_POS;
agent_z = COORD_BOUNDARY_Z_POS;
break;
case 3 :
// -x,-y,+z
agent_x = COORD_BOUNDARY_X_NEG;
agent_y = COORD_BOUNDARY_Y_NEG;
agent_z = COORD_BOUNDARY_Z_POS;
break;
case 4 :
// +x,-y,+z
agent_x = COORD_BOUNDARY_X_POS;
agent_y = COORD_BOUNDARY_Y_NEG;
agent_z = COORD_BOUNDARY_Z_POS;
break;
case 5 :
// +x,+y,-z
agent_x = COORD_BOUNDARY_X_POS;
agent_y = COORD_BOUNDARY_Y_POS;
agent_z = COORD_BOUNDARY_Z_NEG;
break;
case 6 :
// -x,+y,-z
agent_x = COORD_BOUNDARY_X_NEG;
agent_y = COORD_BOUNDARY_Y_POS;
agent_z = COORD_BOUNDARY_Z_NEG;
break;
case 7 :
// -x,-y,-z
agent_x = COORD_BOUNDARY_X_NEG;
agent_y = COORD_BOUNDARY_Y_NEG;
agent_z = COORD_BOUNDARY_Z_NEG;
break;
case 8 :
// +x,-y,-z
agent_x = COORD_BOUNDARY_X_POS;
agent_y = COORD_BOUNDARY_Y_NEG;
agent_z = COORD_BOUNDARY_Z_NEG;
break;
}
FLAMEGPU->setVariable<float>("x",agent_x);
FLAMEGPU->setVariable<float>("y",agent_y);
FLAMEGPU->setVariable<float>("z",agent_z);
return flamegpu::ALIVE;
}