0 registered members (),
1,429
guests, and 8
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
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
OP
Junior Member
|
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.
|
|
|
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
OP
Junior Member
|
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]
#145127
08/05/07 17:22
08/05/07 17:22
|
Joined: Jan 2004
Posts: 3,023 The Netherlands
Helghast
Expert
|
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,
|
|
|
|