public ActorFootstepManager() { is_grounded = false; ground_type = GameConstants.GroundType.ground_default; velocity = 0f; is_in_water = false; is_submerged = false; }
private void UpdateGroundedSphere() { // check grounding by sphere. is_spherecast_hit = Physics.SphereCast(transform.position, GROUNDED_SPHERECAST_RADIUS, Vector3.down, out spherecast_hit_info, GROUNDED_RAYCAST_DISTANCE); if (is_spherecast_hit) { is_spherecast_grounded = spherecast_hit_info.distance <= grounded_spherecast_max_distance; // if also ray grounded // set the slope normal. spherecast_grounded_slope_normal = (is_raycast_grounded) ? spherecast_hit_info.normal : raycast_hit_info.normal; // if also ray grounded // set the angle of the surface. spherecast_grounded_slope_angle = (is_raycast_grounded) ? Vector3.Angle(raycast_hit_info.normal, Vector3.up) : raycast_grounded_slope_angle; // set the grounded type, if grounded. if (is_spherecast_grounded) { if (spherecast_hit_info.collider.gameObject .GetComponent <MapAttributeGroundType>() == null) { ground_type = GameConstants.GroundType.ground_default; } else { ground_type = spherecast_hit_info.collider.gameObject .GetComponent <MapAttributeGroundType>().ground_type; } } else { ground_type = GameConstants.GroundType.ground_default; } } }