Posted By: jumpman
A way to reset a model's vertices after vec_to_mesh - 10/04/11 00:26
is there a way to reset a model's vertices after performing a vec_to_mesh?
var vertices_stored[20][2000][4]; function store_model_vertices() { if(vertices_store_slot <= vertices_stored_max) { vertices_store_slot += 1; vertices_stored_last = vertices_store_slot; vertices_max = ent_status(my, 0); vertex_counter = 0; while(vertex_counter < vertices_max)//save all vertices in an array to get them for resetting the model { vec_for_mesh(temp, me, vertex_counter); vertices_stored[vertices_store_slot][vertex_counter][0] = vertex_counter; vertices_stored[vertices_store_slot][vertex_counter][1] = temp.x; vertices_stored[vertices_store_slot][vertex_counter][2] = temp.y; vertices_stored[vertices_store_slot][vertex_counter][3] = temp.z; vertex_counter += 1; } vertex_counter = 0; } } function reset_model_vertices() { if(vertices_store_slot < vertices_stored_last) { vertices_store_slot += 1; vertices_max = ent_status(my, 0); vertex_counter = 0; while(vertex_counter < vertices_max) { temp.x = vertices_stored[vertices_store_slot][vertex_counter][1]; temp.y = vertices_stored[vertices_store_slot][vertex_counter][2]; temp.z = vertices_stored[vertices_store_slot][vertex_counter][3]; vec_to_mesh(temp, me, vertex_counter); vertex_counter += 1; } vertex_counter = 0; ent_fixnormals(my,0);//recalculate the normal after moving the vertices c_updatehull(me,1);//recalculate the collision } }
// lite_c ent_morph(player, player.type); // c_script (or my ATTEMPTS s CScript anyway) ent_morph(player, str_for_entfile(NULL, player)); or STRING* temp_name = str_create("#256"); str_for_entfile(temp_name, player)); ent_morph(player, temp_name);