Gamestudio Links
Zorro Links
Newest Posts
Help with plotting multiple ZigZag
by degenerate_762. 04/30/24 23:23
M1 Oversampling
by 11honza11. 04/30/24 08:16
Trading Journey
by howardR. 04/28/24 09:55
Zorro Trader GPT
by TipmyPip. 04/27/24 13:50
Data from CSV not parsed correctly
by jcl. 04/26/24 11:18
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
5 registered members (SBGuy, dr_panther, Ayumi, Quad, AndrewAMD), 920 guests, and 1 spider.
Key: Admin, Global Mod, Mod
Newest Members
firatv, wandaluciaia, Mega_Rod, EternallyCurious, howardR
19050 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
A way to reset a model's vertices after vec_to_mesh #384498
10/04/11 00:26
10/04/11 00:26
Joined: Apr 2002
Posts: 1,246
ny
jumpman Offline OP
Serious User
jumpman  Offline OP
Serious User

Joined: Apr 2002
Posts: 1,246
ny
is there a way to reset a model's vertices after performing a vec_to_mesh?

Re: A way to reset a model's vertices after vec_to_mesh [Re: jumpman] #384500
10/04/11 00:47
10/04/11 00:47
Joined: Feb 2008
Posts: 3,232
Australia
EvilSOB Offline
Expert
EvilSOB  Offline
Expert

Joined: Feb 2008
Posts: 3,232
Australia
Read up on ent_purge(ENTITY*). But I dunno if its CScript or lite-c only.

Be cautious and read up on it, it affects textures and decals too...

best of luck.


"There is no fate but what WE make." - CEO Cyberdyne Systems Corp.
A8.30.5 Commercial
Re: A way to reset a model's vertices after vec_to_mesh [Re: EvilSOB] #384501
10/04/11 03:05
10/04/11 03:05
Joined: Apr 2002
Posts: 1,246
ny
jumpman Offline OP
Serious User
jumpman  Offline OP
Serious User

Joined: Apr 2002
Posts: 1,246
ny
hey evilsob, from what I saw in the manual, ent_purge removes the entity from memory :(, definitely not just resetting mesh. Thank you though. I dont think there is a way to do this frown

Re: A way to reset a model's vertices after vec_to_mesh [Re: jumpman] #384502
10/04/11 04:31
10/04/11 04:31
Joined: Feb 2008
Posts: 3,232
Australia
EvilSOB Offline
Expert
EvilSOB  Offline
Expert

Joined: Feb 2008
Posts: 3,232
Australia
ent_purge is DIFFERENT from ent_remove.

It only unloads the mesh and the texture and the decals.

Next time it appears on-screen, both mesh and texture are
reloaded from the MDL file in cache, thereby resetting them.


"There is no fate but what WE make." - CEO Cyberdyne Systems Corp.
A8.30.5 Commercial
Re: A way to reset a model's vertices after vec_to_mesh [Re: EvilSOB] #384508
10/04/11 06:47
10/04/11 06:47
Joined: Aug 2008
Posts: 482
B
bart_the_13th Offline
Senior Member
bart_the_13th  Offline
Senior Member
B

Joined: Aug 2008
Posts: 482
Wouldn't animating the model reset the mesh? I never used mesh transform before.
Using ent_purge may do the trick, but maybe you can also store the original mesh vertex position into an array before you do any transformation and use it to restore it back?

Re: A way to reset a model's vertices after vec_to_mesh [Re: bart_the_13th] #384564
10/04/11 22:05
10/04/11 22:05
Joined: Apr 2002
Posts: 1,246
ny
jumpman Offline OP
Serious User
jumpman  Offline OP
Serious User

Joined: Apr 2002
Posts: 1,246
ny
hey everyone thanks for taking a look! The effect im looking for is very simple cloth noise/movement when the wind is blowing. The vertices are moving slightly to simulate cloth in the wind.

The tricky part however is that the character models are made with bones, which cannot be combined with vertex animation, so that rules out animating the mesh as suggested by Barth_the_13th.

Ent_purge, unless I am doing it wrong, didnt seem to reset the mesh. I ran the vertex movement script until the model looked wrinkly enough. turned the camera away so that no part of it was in view, ent_purged on keystroke, returned to look at the model and the model held the same vertex displacement.

Re: A way to reset a model's vertices after vec_to_mesh [Re: jumpman] #384568
10/04/11 22:09
10/04/11 22:09
Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Superku Offline
Senior Expert
Superku  Offline
Senior Expert

Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
There's a function called ent_reload, it increases the memory usage, though.


"Falls das Resultat nicht einfach nur dermassen gut aussieht, sollten Sie nochmal von vorn anfangen..." - Manual

Check out my new game: Pogostuck: Rage With Your Friends
Re: A way to reset a model's vertices after vec_to_mesh [Re: bart_the_13th] #384570
10/04/11 22:30
10/04/11 22:30
Joined: Sep 2003
Posts: 5,900
Bielefeld, Germany
Pappenheimer Offline
Senior Expert
Pappenheimer  Offline
Senior Expert

Joined: Sep 2003
Posts: 5,900
Bielefeld, Germany
Originally Posted By: bart_the_13th
[...]store the original mesh vertex position into an array before you do any transformation and use it to restore it back?

That's what I do - within A8, but it shouldn't make a difference in A6.

Something like the following:
Code:
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
	}
}



Re: A way to reset a model's vertices after vec_to_mesh [Re: Pappenheimer] #384598
10/05/11 09:41
10/05/11 09:41
Joined: Feb 2008
Posts: 3,232
Australia
EvilSOB Offline
Expert
EvilSOB  Offline
Expert

Joined: Feb 2008
Posts: 3,232
Australia
OK, so ent-purge was a bust. Sounds like you tested it sufficiently to me.

Next idea... NO idea on memory usage or effect on bones/animation ...
Code:
// 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);




"There is no fate but what WE make." - CEO Cyberdyne Systems Corp.
A8.30.5 Commercial

Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1