| 176 | } |
| 177 | |
| 178 | void CPHActorCharacter::Jump(const Fvector& accel) |
| 179 | { |
| 180 | if (!b_exist) |
| 181 | return; |
| 182 | if (!b_lose_control && (m_ground_contact_normal[1] > 0.5f || m_elevator_state.ClimbingState())) |
| 183 | { |
| 184 | b_jump = true; |
| 185 | const dReal* vel = dBodyGetLinearVel(m_body); |
| 186 | dReal amag = m_acceleration.magnitude(); |
| 187 | if (amag < 1.f) |
| 188 | amag = 1.f; |
| 189 | if (m_elevator_state.ClimbingState()) |
| 190 | { |
| 191 | m_elevator_state.GetJumpDir(m_acceleration, m_jump_accel); |
| 192 | m_jump_accel.mul(JUMP_UP_VELOCITY / 2.f); |
| 193 | // if(accel.square_magnitude()>EPS_L)m_jump_accel.mul(4.f); |
| 194 | } |
| 195 | else |
| 196 | { |
| 197 | m_jump_accel.set(vel[0] * JUMP_INCREASE_VELOCITY_RATE + m_acceleration.x / amag * 0.2f, jump_up_velocity, |
| 198 | vel[2] * JUMP_INCREASE_VELOCITY_RATE + m_acceleration.z / amag * 0.2f); |
| 199 | } |
| 200 | Enable(); |
| 201 | } |
| 202 | } |
| 203 | void CPHActorCharacter::SetObjectContactCallback(ObjectContactCallbackFun* callback) { inherited::SetObjectContactCallback(callback); } |
| 204 | |
| 205 | void CPHActorCharacter::Disable() { inherited::Disable(); } |
nothing calls this directly
no test coverage detected