#}
if mat.SR_data.shader == 'invisible': flags |= 0x10
if mat.SR_data.shader == 'boundary': flags |= (0x10|0x20)
+ if mat.SR_data.shader == 'walking': flags |= (0x10|0x80)
#}
m.flags = flags
m.colour[2] = pow( mat.SR_data.tint[2], 1.0/2.2 )
m.colour[3] = pow( mat.SR_data.tint[3], 1.0/2.2 )
#}
+
+ if mat.SR_data.shader == 'walking':#{
+ m.shader = 9
+ #}
if mat.SR_data.shader in ['standard', 'standard_cutout', 'terrain_blend', \
'vertex_blend', 'fxglow', 'cubemap' ]: #{
row = box.row()
if (active_mat.SR_data.shader != 'invisible') and \
- (active_mat.SR_data.shader != 'boundary'):#{
+ (active_mat.SR_data.shader != 'boundary') and \
+ (active_mat.SR_data.shader != 'walking'):#{
row.prop( active_mat.SR_data, "skate_surface" )
row.prop( active_mat.SR_data, "grind_surface" )
row.prop( active_mat.SR_data, "grow_grass" )
('invisible','Invisible',''),
('boundary','Boundary',''),
('fxglow','FX Glow',''),
- ('cubemap','Cubemap','')
+ ('cubemap','Cubemap',''),
+ ('walking','Walking','')
])
surface_prop: bpy.props.EnumProperty(
k_material_flag_grindable = 0x00000008,
k_material_flag_invisible = 0x00000010,
k_material_flag_boundary = 0x00000020,
- k_material_flag_preview_visibile = 0x00000040
+ k_material_flag_preview_visibile = 0x00000040,
+ k_material_flag_walking = 0x00000080
};
#pragma pack(push,1)
v3_muls( v, newspeed, v );
}
+VG_STATIC void player_walk_custom_filter( world_instance *world,
+ rb_ct *man, int len, f32 w ){
+ for( int i=0; i<len; i++ ){
+ rb_ct *ci = &man[i];
+ if( ci->type == k_contact_type_disabled ||
+ ci->type == k_contact_type_edge )
+ continue;
+
+
+ float d1 = v3_dot( ci->co, ci->n );
+
+ for( int j=0; j<len; j++ ){
+ if( j == i )
+ continue;
+
+ rb_ct *cj = &man[j];
+ if( cj->type == k_contact_type_disabled )
+ continue;
+
+ struct world_surface *si = world_contact_surface( world, ci ),
+ *sj = world_contact_surface( world, cj );
+
+ if( (sj->info.flags & k_material_flag_walking) &&
+ !(si->info.flags & k_material_flag_walking)){
+ continue;
+ }
+
+ float d2 = v3_dot( cj->co, ci->n ),
+ d = d2-d1;
+
+ if( fabsf( d ) <= w ){
+ cj->type = k_contact_type_disabled;
+ }
+ }
+ }
+}
+
VG_STATIC void player__walk_update( player_instance *player ){
struct player_walk *w = &player->_walk;
v3_copy( player->rb.co, w->state.prev_pos );
len = rb_capsule__scene( mtx, &w->collider, NULL,
&world->rb_geo.inf.scene, manifold );
- rb_manifold_filter_coplanar( manifold, len, 0.01f );
+ player_walk_custom_filter( world, manifold, len, 0.01f );
len = rb_manifold_apply_filtered( manifold, len );
v3f surface_avg = { 0.0f, 0.0f, 0.0f };