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
0 registered members (), 18,561 guests, and 5 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
trying to implement HL2 type physics #38238
12/21/04 21:17
12/21/04 21:17
Joined: Jul 2004
Posts: 74
Inside Maya
S
Sichlid Offline OP
Junior Member
Sichlid  Offline OP
Junior Member
S

Joined: Jul 2004
Posts: 74
Inside Maya
Hi,

I have been trying to implement Half-life 2 picking up of objects
and throwing them. I have been able to do things properly to a point and now
there is a small issue which isnt allowing me to complete things.

I pick up the object and also can move around with it. But when I throw it in some random direction ( camera's direction)
the object is restored to it's original pickup position and then physics is applied to it.

I am at a loss to understand why this is happening.

Here is the code below :

sound sound_hit_metal = <hit.wav>;
var alreadylifted = 0;
var thrownow = 0;


function ball_event()
{

if(event_type == event_shoot && alreadylifted ==1)
{
beep();
return;
}

if(event_type == event_shoot && alreadylifted ==0)
{
currentphysicsobject = me;

thrownow=0;
//breakpoint;
while(thrownow==0)
{

temp.x = 100;
temp.y=0;
temp.z=0;
vec_rotate(temp,camera.pan);
vec_set(currentphysicsobject.x,you.x);
//vec_set(my.x,you.x);
vec_add(currentphysicsobject.x,temp.x);
//vec_add(me.x,temp.x);
alreadylifted=1;
wait(1);
}
//phent_addforcelocal ( my, vector(5000,0,0),target);
//snd_play(sound_hit_metal,sound_vol,0);
//alreadylifted =1;

}

//(event_type == event_shoot && alreadylifted ==1)
if(alreadylifted ==1)
{
breakpoint;
thrownow = 1;
temp.x = 10000;
temp.y = 0;
temp.z =0;
//wait(1);
vec_rotate(temp,camera.pan);
//phent_addforcelocal(me,vector(5000,0,0),me.x);
//phent_addcentralforce(currentphysicsobject,temp);
phent_addforcelocal(currentphysicsobject,temp,currentphysicsobject.x);
//snd_play(sound_hit_metal,sound_vol,0);
alreadylifted = 0;

}
}

function resetobject()
{
//vec_set(temp,my.x);
if(alreadylifted ==0)
{

return;
}
thrownow = 1 - thrownow;
wait(1);
ball_event();
//wait(1);

}
action my_ball
{
phent_settype(my, PH_RIGID, PH_BOX);
phent_setmass(my, 100, PH_BOX);
phent_setfriction(my, 30);
phent_setelasticity(my, 20, 10);
phent_setdamping(my, 30,100);
ph_setgravity( vector(0,0,-386));
my.enable_shoot = on;
my.event = ball_event;
my.shadow=on;
on_mouse_left = resetobject;

}

thanks in advance for any help

I am using WINxP and A 6.30.0


Best Regards, Sichlid
Re: trying to implement HL2 type physics [Re: Sichlid] #38239
12/23/04 16:51
12/23/04 16:51
Joined: Jul 2004
Posts: 74
Inside Maya
S
Sichlid Offline OP
Junior Member
Sichlid  Offline OP
Junior Member
S

Joined: Jul 2004
Posts: 74
Inside Maya
ok just updated the engine to A6.31.4 and things are working fine.

Afterall it was a engine bug.


Best Regards, Sichlid

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