Saori Yoshimoto work notes since 2018

Wednesday, September 4, 2019

[VEX] pcopen exsample..

int handle = pcopen(0,"P", @P, chf('cohesion_radius'), chi('max_point')); vector avg_P = pcfilter(handle,"P"); vector dir = normalize(avg_P - @P); v@force += dir * chf('cohesion_strength'); v@dir_co = dir; pcclose(handle);


--------------------------------------------------

int handle = pcopen(0, "P", @P, obs_radius_max, chi('maxpoints')); if (pcnumfound(handle) != 0){ if(i@key_anim_leader == 0){ vector obs_volgrad = volumegradient(1, 0, @P); //get_vol_pos vector obs_volsmp = volumesample(1, 0, @P); vector avg_P = pcfilter(handle, "P"); vector avg_N = pcfilter(handle, "N"); vector dir = avg_N; float dist = length(avg_P - @P); if(obs_volsmp<0){ float obs_dotP = dot(normalize(v@v), normalize(obs_volgrad)); //rock_N_chk if( obs_dotP < 0){ v@force += dir * fish_speedmax * 0.8; }; }; float obs_strength = fit(dist, obs_radius_min, obs_radius_max, 0, 1); //get_vol_sampling f@obs_force_strength = fit01(chramp('obs_increase_force',obs_strength), obs_strangth_min, obs_strangth_max*2); v@force += dir * f@obs_force_strength; v@dir_obs = dir * f@obs_force_strength; }else{@Cd = {0,0,0};}; };

--------------------------------------------------

float avo_radius = f@fishes_avo_radius; float avo_strength = f@fishes_avo_strength; int handle = pcopen(0, "P", @P, avo_radius, 2); float str_avo = 0; if(pcnumfound(handle) == 2){ if(i@key_anim_leader == 0){ vector near_P = pcimportbyidxv(handle,"P",1); vector dir = normalize(@P - near_P); float len_avo = length(@P - near_P); if(len_avo < avo_radius){ float str_avo = avo_strength * chramp('length_strength',fit(len_avo, 0, avo_radius, 1, 0)); v@force += dir * str_avo; //----check value----// f@dir_len_avo = str_avo; v@dir_avo = dir * str_avo; }; }; }; pcclose(handle);

No comments:

Post a Comment