// burn resources proportional to composition
// factor = 1/total * 1/efficiency * amount * -1
double factor = -amount / (composition.TotalMass() * EnergyEfficiency());
// burn resources proportional to composition
// factor = 1/total * 1/efficiency * amount * -1
double factor = -amount / (composition.TotalMass() * EnergyEfficiency());
double value = cmp.value * factor * sim.Resources()[cmp.resource].inverse_energy;
AddMass(cmp.resource, value);
}
double value = cmp.value * factor * sim.Resources()[cmp.resource].inverse_energy;
AddMass(cmp.resource, value);
}
// if active goal can be interrupted, check priorities
if (goals.size() > 1 && goals[0]->Interruptible()) {
std::sort(goals.begin(), goals.end(), GoalCompare);
}
// if active goal can be interrupted, check priorities
if (goals.size() > 1 && goals[0]->Interruptible()) {
std::sort(goals.begin(), goals.end(), GoalCompare);
}
}
orient[0] = normalize(cross(orient[1], orient[2]));
orient[2] = normalize(cross(orient[0], orient[1]));
}
orient[0] = normalize(cross(orient[1], orient[2]));
orient[2] = normalize(cross(orient[0], orient[1]));
- return glm::translate(glm::dvec3(pos.x, pos.y, pos.z + half_size))
- * glm::dmat4(orient);
+ return glm::translate(glm::dvec3(pos.x, pos.y, pos.z))
+ * glm::dmat4(orient)
+ * glm::translate(glm::dvec3(0.0, half_size, 0.0));