Gamestudio Links
Zorro Links
Newest Posts
AlpacaZorroPlugin v1.3.0 Released
by kzhao. 05/22/24 13:41
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
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
1 registered members (AndrewAMD), 1,486 guests, and 10 spiders.
Key: Admin, Global Mod, Mod
Newest Members
AemStones, LucasJoshua, Baklazhan, Hanky27, firatv
19055 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
[C-Script/Physics] Double models in Physics? #204161
04/27/08 10:56
04/27/08 10:56
Joined: Aug 2006
Posts: 96
Netherlands
P
Polypfreak1987 Offline OP
Junior Member
Polypfreak1987  Offline OP
Junior Member
P

Joined: Aug 2006
Posts: 96
Netherlands
Hallo everybody.

I have a big problem. When I test my model, the physics-model wich is attached seems to be twice. Here is a screenshot to see what I mean.


As you can see the model where I am talking about is not good. You see 2 of the same models inside each other but in a different direction. How can I set it to 1 model with the right code?

I am using C-Script Physics. And this is the code so far I got it:

 Code:
var earthGravity[3] = 0,0,-368;

...

action gondel01 {
	gondel001 = my;
	my.passable = on;
	
	my.scale_x = 0.5;
	my.scale_y = 0.5;
	my.scale_z = 0.5;
	
	//Physics on
	phent_settype(my,PH_RIGID,PH_BOX);
	//Set a weight
	phent_setmass(my,50,PH_BOX);
	//Set a friction
	phent_setfriction(my,100);
	//Set a damping
	phent_setdamping(my,10,10);
	//Set a gravity
	ph_setgravity(earthGravity);
	
	gondel1 = phcon_add(PH_HINGE,my,kruis01);
	phcon_setparams1(gondel1,my.x,vector(0,0,1),nullvector);
	phcon_setparams2(gondel1,vector(-360,360,0),nullvector,nullvector);
	
	while(my) {		
		vec_for_vertex(temp,kruis01,875);
		
		phent_addvelcentral(my,vector(temp.pan*time_step,temp.tilt*time_step,temp.roll*time_step));
		
		my.x = temp.x;
		my.y = temp.y;
		my.z = temp.z;
		
		wait(1);
	}
}

I hope you can help me, I am struggling with this code for months.

Re: [C-Script/Physics] Double models in Physics? [Re: Polypfreak1987] #204162
04/27/08 11:25
04/27/08 11:25
Joined: Oct 2002
Posts: 799
Germany->Bavaria->Nuremberg
C
Christian__A Offline
User
Christian__A  Offline
User
C

Joined: Oct 2002
Posts: 799
Germany->Bavaria->Nuremberg
Are you sure that you have placed only 1 entity in your level?


MfG, Christian__A. Visit my Site: www.chris-a.de


Re: [C-Script/Physics] Double models in Physics? [Re: Christian__A] #204173
04/27/08 14:13
04/27/08 14:13
Joined: Aug 2006
Posts: 96
Netherlands
P
Polypfreak1987 Offline OP
Junior Member
Polypfreak1987  Offline OP
Junior Member
P

Joined: Aug 2006
Posts: 96
Netherlands
Yes I am sure.

Here is te complete code. I hope you can find what I do wrong.

 Code:
// Power_Monster.wdl
// .WMB inladen
string level_str = <Power_Monster.WMB>;


var speed;
var speed_molen;
var video_mode = 7;
var video_depth = 32;
var earthGravity[3] = 0,0,-368;
var gondel1;


entity* kruis01;
entity* ondermolen1;
entity* arm01;
entity* gondel001;

// Hoofdfunctie
function main()
{
	//laad het level
	level_load(level_str);
}

action gondel01 {
	gondel001 = my;
	my.passable = on;
	
	my.scale_x = 0.5;
	my.scale_y = 0.5;
	my.scale_z = 0.5;
	
	//Physics on
	phent_settype(my,PH_RIGID,PH_BOX);
	//Set a weight
	phent_setmass(my,50,PH_BOX);
	//Set a friction
	phent_setfriction(my,100);
	//Set a damping
	phent_setdamping(my,10,10);
	//Set a gravity
	ph_setgravity(earthGravity);
	
	gondel1 = phcon_add(PH_HINGE,my,kruis01);
	phcon_setparams1(gondel1,my.x,vector(0,0,1),nullvector);
	phcon_setparams2(gondel1,vector(-360,360,0),nullvector,nullvector);
	
	while(my) {		
		vec_for_vertex(temp,kruis01,875);
		
		phent_addvelcentral(my,vector(temp.pan*time_step,temp.tilt*time_step,temp.roll*time_step));
		
		my.x = temp.x;
		my.y = temp.y;
		my.z = temp.z;
		
		wait(1);
	}
}

action kruis {
	kruis01 = my;
	my.passable = on;
	
	my.scale_x = 0.25;
	my.scale_y = 0.25;
	my.scale_z = 0.25;
	
	//Gondel erop zetten, hier dus alleen ent_create
	vec_for_vertex(temp,my,875);
	ent_create("gondel.mdl",temp,gondel01);
	
	
	while(my)
	{
		vec_for_vertex(temp,arm01,124);
		
		my.x = temp.x;
		my.y = temp.y;
		my.z = temp.z;
		
		my.pan += speed;
		if(key_w == 1) {
			if(speed < 0.5) {
				speed += 0.025*time_step;
			}
		}
		if(key_s == 1) {
			if(speed > 0) {
				speed -= 0.025*time_step;
			}
		}
 		wait(1);
 	}
}

action arm1 {
	arm01 = my;
	my.passable = on;
	my.scale_x = 1.7;
	my.scale_y = 1.7;
	my.scale_z = 1.7;
	
	vec_for_vertex(temp,my,124);
	ent_create("kruis.mdl",temp,kruis);
	
	while(my) {
		vec_for_vertex(temp,ondermolen1,91);
		my.pan = ondermolen1.pan;
		my.x = ondermolen1.x;
		my.y = ondermolen1.y;
		my.z = ondermolen1.z+5;
		
		wait(1);
	}
}

action ondermolen {
	my.passable = on;
	ondermolen1 = my;
	
	vec_for_vertex(temp,my,91);
	ent_create("arm01.mdl",temp,arm1);
	
	while(my)
	{
		my.pan -= speed_molen;
		if(key_q == 1) {
			if(speed_molen < 0.3) {
				speed_molen += 0.025*time_step;
			}
		}
		if(key_a == 1) {
			if(speed_molen > 0) {
				speed_molen -= 0.025*time_step;
			}
		}
 		wait(1);
 	}
}

There are 5 arms with the name arm01.mdl till arm05.mdl, also for the "gondel"-entity (so gondel01.mdl till gondel05.mdl). But first I am going to test 1 arm and one gondela. There is also a cross ("kruis"). I have one "kruis" model named kruis.mdl. Do you think I neeed to do it like kruis01.mdl till kruis05.mdl?


Moderated by  HeelX, Spirit 

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