| 1075 | } |
| 1076 | |
| 1077 | void hanging_state_type::start_detaching() |
| 1078 | { |
| 1079 | xVec3 eulerVec; |
| 1080 | xMat3x3 mat; |
| 1081 | |
| 1082 | detaching = true; |
| 1083 | calc_drop_off_velocity(drop_off_vel, shared.hook_loc, shared.drop_loc, |
| 1084 | globals.player.g.Gravity, |
| 1085 | shared.hook->asset->detach.free_fall_time); |
| 1086 | |
| 1087 | xVec3 localMatRIght = local_to_world(globals.camera.mat.right); |
| 1088 | mat.right = globals.camera.mat.right; |
| 1089 | mat.up.assign(0.0f, 1.0f, 0.0f); |
| 1090 | mat.at = localMatRIght.cross(mat.up); |
| 1091 | |
| 1092 | F32 hgoal = globals.camera.hgoal; |
| 1093 | F32 dgoal = globals.camera.dgoal; |
| 1094 | detach.start_loc = globals.camera.mat.pos - localMatRIght; |
| 1095 | detach.end_loc = mat.up * hgoal + mat.at * -dgoal; |
| 1096 | |
| 1097 | xMat3x3GetEuler(&mat, &eulerVec); |
| 1098 | eulerVec.x = zCameraTweakGlobal_GetPitch(); |
| 1099 | eulerVec.y = 0.0f; |
| 1100 | xMat3x3Euler(&mat, &eulerVec); |
| 1101 | |
| 1102 | xQuatFromMat(&detach.start_dir, &globals.camera.mat); |
| 1103 | xQuatFromMat(&detach.end_dir, &mat); |
| 1104 | |
| 1105 | detach.time = 0.0f; |
| 1106 | detach.end_time = xsqrt(__fabs(loc.length() / h.detach.accel)); |
| 1107 | if (detach.end_time >= -1e-5f && detach.end_time <= 1e-5f) |
| 1108 | { |
| 1109 | detach.end_time = 0.01f; |
| 1110 | } |
| 1111 | |
| 1112 | globals.camera.tm_dec = 0.0f; |
| 1113 | globals.camera.tm_acc = 0.0f; |
| 1114 | globals.camera.tmr = 0.0f; |
| 1115 | globals.camera.ltm_dec = 0.0f; |
| 1116 | globals.camera.ltm_acc = 0.0f; |
| 1117 | globals.camera.ltmr = 0.0f; |
| 1118 | globals.camera.pgoal = PI + eulerVec.x; |
| 1119 | globals.camera.pcur = PI + eulerVec.x; |
| 1120 | } |
| 1121 | |
| 1122 | S32 hanging_state_type::cb_cache_collisions::operator()(xEnt& ent, xGridBound& bound) |
| 1123 | { |
nothing calls this directly
no test coverage detected