position.X = rangelim(position.X, lwn_f.X-maxd, lwn_f.X+maxd);
position.Z = rangelim(position.Z, lwn_f.Z-maxd, lwn_f.Z+maxd);
- f32 min_y = lwn_f.Y + 0.5*BS;
- if(position.Y < min_y)
+ if(!is_climbing)
{
- position.Y = min_y;
+ f32 min_y = lwn_f.Y + 0.5*BS;
+ if(position.Y < min_y)
+ {
+ position.Y = min_y;
- if(m_speed.Y < 0)
- m_speed.Y = 0;
+ if(m_speed.Y < 0)
+ m_speed.Y = 0;
+ }
}
}
bool touching_ground_was = touching_ground;
touching_ground = result.touching_ground;
- bool standing_on_unloaded = result.standing_on_unloaded;
+ //bool standing_on_unloaded = result.standing_on_unloaded;
/*
Check the nodes under the player to see from which node the
/*
Report collisions
*/
+ bool bouncy_jump = false;
if(collision_info)
{
- // Report fall collision
- if(old_speed.Y < m_speed.Y - 0.1 && !standing_on_unloaded)
- {
- CollisionInfo info;
- info.t = COLLISION_FALL;
- info.speed = m_speed.Y - old_speed.Y;
+ for(size_t i=0; i<result.collisions.size(); i++){
+ const CollisionInfo &info = result.collisions[i];
collision_info->push_back(info);
+ if(info.new_speed.Y - info.old_speed.Y > 0.1*BS &&
+ info.bouncy)
+ bouncy_jump = true;
}
}
+ if(bouncy_jump && control.jump){
+ m_speed.Y += 6.5*BS;
+ touching_ground = false;
+ MtEvent *e = new SimpleTriggerEvent("PlayerJump");
+ m_gamedef->event()->put(e);
+ }
+
if(!touching_ground_was && touching_ground){
MtEvent *e = new SimpleTriggerEvent("PlayerRegainGround");
m_gamedef->event()->put(e);