Grappling Hook?

Posted By: WizRealm

Grappling Hook? - 10/10/04 00:29

I'm trying to create a grappling hook for my physic player (a ball) and I'm stuck..

Code:
 
//Customize tags

//Section: Controls
//Entry: Move Right Key Code
Var Move_Right=77;
//Entry: Move Left Key Code
Var Move_Left=75;
//Entry: Shoot Spike Key Code
Var Shoot_Spike=29;
//End-----------

action actplayer
{
var hingeID;
phent_settype(my, ph_rigid, ph_sphere);
phent_setmass(my, 1, ph_sphere);
phent_setelasticity(my, 61, 0);
phent_setfriction (my, 6);
my.skill1=my.y;
my.skill2=my.pan;
my.skill3=my.roll;
my.skill4=my.tilt;

while(1)
{
my.y=my.skill1;
my.pan=my.skill2;
my.roll=my.skill3;
my.tilt=my.skill4;

if(key_pressed(Move_Left))
{
phent_addforcelocal(my,vector(-50,0,0),nullvector);
}

if(key_pressed(Move_Right))
{
phent_addforcelocal(my,vector(50,0,0),nullvector);
}

if(key_pressed(Shoot_Spike))
{
var axis[3]=1,0,1;
var anchor[3];
//Get ceiling height
temp=trace(my.x,vector(my.x,my.y,my.z+10));
vec_set(anchor,target.x);
//--------------------
hingeID=phcon_add(PH_HINGE,my,0);
phcon_setparams1(hingeID,anchor,axis,nullvector);
}

wait(1);
}
}



This is for my gameinaday entry so I need help soon... The player will move correcty until I try to use the "grappling hook" ability.. any ideas?

A6 Com 6.30.0
Posted By: William

Re: Grappling Hook? - 10/10/04 05:12

You cannot directly set x,y,z,pan,tilt,roll to an entity set in the physics engine. If you want to change these paremeters, you would have to temporary disable the entity from the physics engine, then re-enable it once your done. Example:

phent_enable (my,0); //temporary disable
vec_set(my.x, temp.x);
my.tilt += 180;
my.pan += 180;
phent_enable (my,1); //enable
Posted By: WizRealm

Re: Grappling Hook? - 10/10/04 05:26

Edit: ( Nevermind )

Thanks for the help
© 2024 lite-C Forums