Gamestudio Links
Zorro Links
Newest Posts
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
4 registered members (AndrewAMD, ozgur, AbrahamR, wdlmaster), 849 guests, and 7 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Hanky27, firatv, wandaluciaia, Mega_Rod, EternallyCurious
19051 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Deform 1 model #351608
12/27/10 13:54
12/27/10 13:54
Joined: Apr 2010
Posts: 23
G
GieskeBon Offline OP
Newbie
GieskeBon  Offline OP
Newbie
G

Joined: Apr 2010
Posts: 23
Hi all,

I have a question about deforming just 1 model. If you look at my code below, I create 6 times the same model on different places. Now, I only want to deform the first model. But the problem is that all 6 of them deform. Is there a solution for this problem or do I have to create 6 different models?



Code:
////////////////////////////////////////////////////////////////////

#include <acknex.h>
#include <default.c>

////////////////////////////////////////////////////////////////////


var vertexnumber = 1;
var displayz;

ENTITY* plate;
ENTITY* plate2;
ENTITY* plate3;
ENTITY* plate4;
ENTITY* plate5;
ENTITY* plate6;

PANEL* info =
{
	digits (30, 10, "Vertex Number: %.0f", *, 1,vertexnumber);
	digits (30, 30, "Display.z: %.0f", *, 1, displayz);
	flags = SHOW;
}


function main()
{
	
	video_mode = 9; // 1280x1024
//	video_screen = 1; // start in full screen mode
	
	
	level_load("");
//	level_load("small.hmp");
	mouse_mode = 4;
	
	plate   = ent_create ("Plate128x128.mdl", vector(  0,  0, -30), NULL);
	plate2  = ent_create ("Plate128x128.mdl", vector(128,  0, -30), NULL);
	plate3  = ent_create ("Plate128x128.mdl", vector(128,128, -30), NULL);
	plate4  = ent_create ("Plate128x128.mdl", vector(128,256, -30), NULL);
	plate5  = ent_create ("Plate128x128.mdl", vector(256,256, -30), NULL);
	plate6  = ent_create ("Plate128x128.mdl", vector(512,128, -30), NULL);

	while(1)
		{
				
			if (key_1)
				{
				CONTACT* contact1 = ent_getvertex(plate,NULL,vertexnumber);
				contact1.z -= 2;  
      			        contact1.v = NULL;
      		                ent_setvertex(plate,contact1,vertexnumber);
      			        displayz = contact1.z;    
      			        wait(-0.5); 	
				}
			
			if (key_2)
				{
				CONTACT* contact1 = ent_getvertex(plate,NULL,vertexnumber);
			        contact1.z += 2;  
      			        contact1.v = NULL;
      			        ent_setvertex(plate,contact1,vertexnumber);
      			displayz = contact1.z;    
      			wait(-0.5);	
				}	
		
			
			if (key_8)
				{
				vertexnumber -= 1;
				if (vertexnumber <= 0)
				    {
				    vertexnumber = 1;
				     }
				}
			
			if (key_9)
				{
				vertexnumber += 1;
				if (vertexnumber >= 26)
				   {
			           vertexnumber = 25;
				   }
				}
		
			wait(1);
		}
	
}



Re: Deform 1 model [Re: GieskeBon] #351609
12/27/10 14:00
12/27/10 14:00
Joined: Feb 2008
Posts: 3,232
Australia
EvilSOB Offline
Expert
EvilSOB  Offline
Expert

Joined: Feb 2008
Posts: 3,232
Australia
check the manual under "ent_clone", should do the trick...


"There is no fate but what WE make." - CEO Cyberdyne Systems Corp.
A8.30.5 Commercial
Re: Deform 1 model [Re: EvilSOB] #351615
12/27/10 14:23
12/27/10 14:23
Joined: Apr 2010
Posts: 23
G
GieskeBon Offline OP
Newbie
GieskeBon  Offline OP
Newbie
G

Joined: Apr 2010
Posts: 23
Thanks for the quick reply EvilSOB! Now I'm going to try to make it work.

Re: Deform 1 model [Re: GieskeBon] #351622
12/27/10 14:46
12/27/10 14:46
Joined: Feb 2008
Posts: 3,232
Australia
EvilSOB Offline
Expert
EvilSOB  Offline
Expert

Joined: Feb 2008
Posts: 3,232
Australia
No problems!

BTW, for the sake of efficiency, try to only use ent_clone on the entities that
get changed, otherwise you are just wasting resources, and therefore CPU...


"There is no fate but what WE make." - CEO Cyberdyne Systems Corp.
A8.30.5 Commercial
Re: Deform 1 model [Re: EvilSOB] #351629
12/27/10 15:24
12/27/10 15:24
Joined: Apr 2010
Posts: 23
G
GieskeBon Offline OP
Newbie
GieskeBon  Offline OP
Newbie
G

Joined: Apr 2010
Posts: 23
When I use the example from the manual, it won't work. The model from the ent_clone() will also disappear.

Can you help?



Code:
ENTITY* plate7;
BMAP* NewBmap;



if (key_5)
				{
				ent_clone(plate);
				ent_setskin(plate,NewBmap,1);
				ent_setmesh(plate,plate7,0,0);	
				}



Re: Deform 1 model [Re: GieskeBon] #351630
12/27/10 15:51
12/27/10 15:51
Joined: Feb 2008
Posts: 3,232
Australia
EvilSOB Offline
Expert
EvilSOB  Offline
Expert

Joined: Feb 2008
Posts: 3,232
Australia
You could test by using
if(plate7) { ent_setmesh(plate,plate7,0,0); } instead.
I suspect 'plate' is vanishing because 'plate7' is empty,
and so the mesh of 'plate' gets replaced with nothing...

BUT ?!?! What you are doing there is BAD!
It will clone the entity every frame if the key_5 is held...

Go back to your original code, as you posted at the top of this thread,
and insert this code AFTER the ent_create's have been done, but BEFORE the while(1) loop starts...
Code:
ent_clone(plate);	ent_clone(plate2);
	ent_clone(plate3);	ent_clone(plate4);
	ent_clone(plate5);	ent_clone(plate6);




"There is no fate but what WE make." - CEO Cyberdyne Systems Corp.
A8.30.5 Commercial
Re: Deform 1 model [Re: EvilSOB] #351633
12/27/10 16:04
12/27/10 16:04
Joined: Apr 2010
Posts: 23
G
GieskeBon Offline OP
Newbie
GieskeBon  Offline OP
Newbie
G

Joined: Apr 2010
Posts: 23
Thanks again. Going to take another look at it.


About the key_5 clone....I know. I always use buttons for testing, but then the post will be to long laugh


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