MCPcopy Create free account
hub / github.com/OGSR/OGSR-Engine / Jump

Method Jump

ogsr_engine/xrGame/PHActorCharacter.cpp:178–202  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

176}
177
178void 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}
203void CPHActorCharacter::SetObjectContactCallback(ObjectContactCallbackFun* callback) { inherited::SetObjectContactCallback(callback); }
204
205void CPHActorCharacter::Disable() { inherited::Disable(); }

Callers

nothing calls this directly

Calls 7

dBodyGetLinearVelFunction · 0.85
EnableFunction · 0.85
ClimbingStateMethod · 0.80
GetJumpDirMethod · 0.80
magnitudeMethod · 0.45
mulMethod · 0.45
setMethod · 0.45

Tested by

no test coverage detected