}
public void updatePosition(ParsedData data){
if(data.fixedObjects == null || data.fixedObjects.size() < 1)
return;
Vector3D accumulator = Vector3D.cartesian(0.0, 0.0, 0.0);
for(Entry<FixedObject, Vector3D> flag : data.fixedObjects.entrySet()){
Vector3D absolute = flag.getKey().getAbsolutePosition();
Vector3D seen = flag.getValue();
//the order of rotations is SIGNIFICANT! This order is the most suitable for a standing agent, it differs the least from the real position
Vector3D ourPosition = seen.rotateOverY(agent.rotationY).rotateOverZ(agent.rotationZ).rotateOverX(agent.rotationX).negate();
ourPosition = ourPosition.add(absolute);
accumulator = accumulator.add(ourPosition);
}
agent.position = accumulator.divide(data.fixedObjects.size());
Log.log(AGENT_MODEL, "My position: [%.2f,%.2f,%.2f]", agent.position.getX(), agent.position.getY(), agent.position.getZ());