Gamestudio Links
Zorro Links
Newest Posts
Zorro 2.70
by jcl. 09/29/25 09:24
optimize global parameters SOLVED
by dBc. 09/27/25 17:07
ZorroGPT
by TipmyPip. 09/27/25 10:05
assetHistory one candle shift
by jcl. 09/21/25 11:36
Plugins update
by Grant. 09/17/25 16:28
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
1 registered members (TipmyPip), 18,466 guests, and 6 spiders.
Key: Admin, Global Mod, Mod
Newest Members
krishna, DrissB, James168, Ed_Love, xtns
19168 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
how to implement a simple door??????? #145123
08/01/07 20:12
08/01/07 20:12
Joined: Jul 2005
Posts: 79
Bonn, Germany
KuleskoStudios Offline OP
Junior Member
KuleskoStudios  Offline OP
Junior Member

Joined: Jul 2005
Posts: 79
Bonn, Germany
hiho,
I'm trying to get through the physics in A7 and I already understand how it works. But nonetheless after programming some simple kickable balls I am completly stuck on a simple door.
After a lot of trial and error I got the following code:
Code:

function push_event{
if(event_type==event_impact){
vec_set(temp,my.x);
vec_sub(temp,you.x);
vec_scale(temp,50);
phent_addcentralforce(me,temp);
}
}

action gittertor{
var hingeId;
var hingeIdb;
my.passable=off;
vec_set(my.skill40,my.x);
vec_set(my.skill43,my.pan);
my.enable_impact=on;
my.event=push_event;
phent_settype(me,PH_RIGID,PH_BOX);
phent_setmass(me,30,PH_BOX);
phent_setelasticity(me,0,0);
phent_setdamping(me,10,10);
phent_setfriction(me,10);

hingeId=phcon_add(PH_HINGE,me,null);
phcon_setparams1(hingeID,vector(my.x,my.y,my.z+30),vector(0,0,1),nullvector);
phcon_setparams2(hingeID,vector(-45,45,0),nullvector,nullvector);
hingeIdb=phcon_add(PH_HINGE,me,null);
phcon_setparams1(hingeIDb,vector(my.x,my.y,my.z-30),vector(0,0,1),nullvector);
phcon_setparams2(hingeIDb,vector(-45,45,0),nullvector,nullvector);
//ph_setautodisable (0.01, 0.008, 10, 0.1);

}


But my door behaves like a pendulum. I tried to set the axis to (1,0,0) and to (0,1,0)...but there wasn't a change.


KuleskoStudios - think differently
http://kstudios.de * Tutorials ~ Games ~ Downloads ~ Resources *

Demo: Erster Prototyp für die BlackBox Adventure Game Serie
Re: how to implement a simple door??????? [Re: KuleskoStudios] #145124
08/02/07 18:35
08/02/07 18:35
Joined: Mar 2006
Posts: 752
Portugal
demiGod Offline
User
demiGod  Offline
User

Joined: Mar 2006
Posts: 752
Portugal
Well, for a simple door i would just use c_rotate and change tilt. This way you´ll have a nice door with collision detection and you can trigger events aswell.

Re: how to implement a simple door??????? [Re: demiGod] #145125
08/02/07 18:56
08/02/07 18:56
Joined: Jul 2005
Posts: 79
Bonn, Germany
KuleskoStudios Offline OP
Junior Member
KuleskoStudios  Offline OP
Junior Member

Joined: Jul 2005
Posts: 79
Bonn, Germany
i mean a simple physics door.
I know how do script a simple rotating one. I'm learning to use a7 physics. Whether a triggered or a physics door is needed, depends on the case.
By the way my door seems to work now. But it closes automatically...
So the ball is kicked back by the door itself. Oh and the event is not used for the ball. it is used to make the player, who isn't a physics entity, able to kick the ball...well and the door (just trying anything out to understand the sytem, ok).

Last edited by KuleskoStudios; 08/02/07 19:13.
Re: how to implement a simple door??????? [Re: KuleskoStudios] #145126
08/02/07 20:43
08/02/07 20:43
Joined: Mar 2006
Posts: 752
Portugal
demiGod Offline
User
demiGod  Offline
User

Joined: Mar 2006
Posts: 752
Portugal
Ahh, ok...

just in case, if you want the physics ball / entity to trigger events, you can use event_friction.

Good luck.

Re: how to implement a simple door??????? [Re: KuleskoStudios] #145127
08/05/07 17:22
08/05/07 17:22
Joined: Jan 2004
Posts: 3,023
The Netherlands
Helghast Offline
Expert
Helghast  Offline
Expert

Joined: Jan 2004
Posts: 3,023
The Netherlands
Code:
 
var LF_DOOR_ID;

action lf_door
{
phent_settype(my,PH_RIGID,PH_POLY);

ph_setgravity(vector(0,0,-800));
phent_setgroup(my,2);
phent_setmass(my,50,PH_BOX);
phent_setfriction(my,15);
phent_setelasticity(my,5,5);

LF_DOOR_ID = phcon_add(PH_HINGE, *change to hinge*, my);
phcon_setparams1(LF_DOOR_ID, my.x, vector(0,0,1), vector(0,1,0));
phcon_setparams2(LF_DOOR_ID, vector(0,70,0), nullvector, vector(0,0,0));
}



ok, this is a real old code of mine, not sure if it still works.
you'll have to see for yourself, good luck!

regards,


Formerly known as dennis_fantasy
Portfolio - http://www.designorhea.com/
Project - http://randomchance.cherrygames.org/

Moderated by  HeelX, Spirit 

Gamestudio download | 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