void LLAgentListener::setAutoPilotTarget(LLSD const & event_data) const { if (event_data.has("target_global")) { LLVector3d target_global(ll_vector3d_from_sd(event_data["target_global"])); mAgent.setAutoPilotTargetGlobal(target_global); } }
void llsdutil_object::test<5>() { LLSD sd; LLVector3d vec1((F64)(U64L(0xFEDCBA9876543210) << 2), -1., 0); sd = ll_sd_from_vector3d(vec1); LLVector3d vec2 = ll_vector3d_from_sd(sd); ensure_equals("vector3d -> sd -> vector3d: 1", vec1, vec2); LLVector3d vec3(sd); ensure_equals("vector3d -> sd -> vector3d : 2", vec1, vec3); }
void LLAgentListener::startAutoPilot(LLSD const & event_data) { LLQuaternion target_rotation_value; LLQuaternion* target_rotation = NULL; if (event_data.has("target_rotation")) { target_rotation_value = ll_quaternion_from_sd(event_data["target_rotation"]); target_rotation = &target_rotation_value; } // *TODO: Use callback_pump and callback_data F32 rotation_threshold = 0.03f; if (event_data.has("rotation_threshold")) { rotation_threshold = event_data["rotation_threshold"].asReal(); } BOOL allow_flying = TRUE; if (event_data.has("allow_flying")) { allow_flying = (BOOL) event_data["allow_flying"].asBoolean(); mAgent.setFlying(allow_flying); } F32 stop_distance = 0.f; if (event_data.has("stop_distance")) { stop_distance = event_data["stop_distance"].asReal(); } // Clear follow target, this is doing a path mFollowTarget.setNull(); mAgent.startAutoPilotGlobal(ll_vector3d_from_sd(event_data["target_global"]), event_data["behavior_name"], target_rotation, NULL, NULL, stop_distance, rotation_threshold, allow_flying); }
void LLAgentPilot::loadXML(const std::string& filename) { if(filename.empty()) { return; } llifstream file(filename); if (!file) { lldebugs << "Couldn't open " << filename << ", aborting agentpilot load!" << llendl; return; } else { llinfos << "Opening pilot file " << filename << llendl; } mActions.reset(); LLSD record; while (!file.eof() && LLSDSerialize::fromXML(record, file)) { Action action; action.mTime = record["time"].asReal(); action.mType = (EActionType)record["type"].asInteger(); action.mCameraView = record["camera_view"].asReal(); action.mTarget = ll_vector3d_from_sd(record["target"]); action.mCameraOrigin = ll_vector3_from_sd(record["camera_origin"]); action.mCameraXAxis = ll_vector3_from_sd(record["camera_xaxis"]); action.mCameraYAxis = ll_vector3_from_sd(record["camera_yaxis"]); action.mCameraZAxis = ll_vector3_from_sd(record["camera_zaxis"]); mActions.put(action); } mOverrideCamera = true; file.close(); }
//virtual void LLSDMessageReader::getVector3d(const char *block, const char *var, LLVector3d &vec, S32 blocknum) { vec = ll_vector3d_from_sd(getLLSD(mMessage, block, var, blocknum)); }