Changeset View
Changeset View
Standalone View
Standalone View
source/blender/physics/intern/BPH_mass_spring.cpp
| Context not available. | |||||
| s->flags |= CLOTH_SPRING_FLAG_NEEDED; | s->flags |= CLOTH_SPRING_FLAG_NEEDED; | ||||
| // current_position = xold + t * (newposition - xold) | // current_position = xold + t * (newposition - xold) | ||||
| interp_v3_v3v3(goal_x, verts[s->ij].xold, verts[s->ij].xconst, time); | /* divide by time_multiplier to prevent goal vertices' delta locations from being multiplied */ | ||||
| interp_v3_v3v3(goal_x, verts[s->ij].xold, verts[s->ij].xconst, time / parms->time_multiplier); | |||||
| sub_v3_v3v3(goal_v, verts[s->ij].xconst, verts[s->ij].xold); // distance covered over dt==1 | sub_v3_v3v3(goal_v, verts[s->ij].xconst, verts[s->ij].xold); // distance covered over dt==1 | ||||
| scaling = parms->goalspring + s->stiffness * fabsf(parms->max_struct - parms->goalspring); | scaling = parms->goalspring + s->stiffness * fabsf(parms->max_struct - parms->goalspring); | ||||
| Context not available. | |||||
| float v[3]; | float v[3]; | ||||
| sub_v3_v3v3(v, verts[i].xconst, verts[i].xold); | sub_v3_v3v3(v, verts[i].xconst, verts[i].xold); | ||||
| // mul_v3_fl(v, clmd->sim_parms->stepsPerFrame); | // mul_v3_fl(v, clmd->sim_parms->stepsPerFrame); | ||||
| /* divide by time_multiplier to prevent constrained velocities from being multiplied */ | |||||
| mul_v3_fl(v, 1.0f / clmd->sim_parms->time_multiplier); | |||||
| BPH_mass_spring_set_velocity(id, i, v); | BPH_mass_spring_set_velocity(id, i, v); | ||||
| } | } | ||||
| } | } | ||||
| Context not available. | |||||
| if (clmd->sim_parms->flags & CLOTH_SIMSETTINGS_FLAG_GOAL) { | if (clmd->sim_parms->flags & CLOTH_SIMSETTINGS_FLAG_GOAL) { | ||||
| if (verts[i].flags & CLOTH_VERT_FLAG_PINNED) { | if (verts[i].flags & CLOTH_VERT_FLAG_PINNED) { | ||||
| float x[3]; | float x[3]; | ||||
| interp_v3_v3v3(x, verts[i].xold, verts[i].xconst, step + dt); | /* divide by time_multiplier to prevent pinned vertices' delta locations from being multiplied */ | ||||
| interp_v3_v3v3(x, verts[i].xold, verts[i].xconst, (step + dt) / clmd->sim_parms->time_multiplier); | |||||
| BPH_mass_spring_set_position(id, i, x); | BPH_mass_spring_set_position(id, i, x); | ||||
| } | } | ||||
| } | } | ||||
| Context not available. | |||||