Posted By: Trev101524
HL2 physics - 09/05/05 06:06
this really isnt a technical question at all. anyways, would it be possible to recreate physics as seen in half-life 2 using gamestudios physics engine?
Quote:
Yup, I'd love to see a demo as well! And source code!! :-)
Will it only involve picking up and throwing objects or will it include blowing a can halfway across the level using a well placed grenade?
function gravGunMain(){
var myTemp;
sfxBuzz = ent_playloop(gravEnt,gravBuzz,600); //start buzzing noise at gravEnt
sfxElectroHumm = snd_loop(electroHumm,25,0); //start underlying electric humm
while(effectCount < 6){
ent_create("magma_tirc.bmp",gravEnt.x,gravFx); //create effects
effectCount += 1;
}
while(gravSwitch == 1){
phent_setdamping(gravEnt,90,30); //set linear damping high to help control
//- slam gravEnt to ground
if(mouse_right){
if(myTemp == 0){
myTemp = 1;
phent_addvelcentral(gravEnt,vector(0,0,-1500));
// phent_addvellocal(gravEnt,vector(1000,0,0),vector(0,0,0));
}
}
else{ //return to hover position
myTemp = 0;
}
gravPointEnt.z = max(-350,min(gravPointEnt.z,-200)); //lock z range of gravPointEnt
//- set and adjust final movement vector
vec_lerp(gravForce,gravPointEnt.x,gravEnt.x,0.5);
vec_sub(gravForce,gravEnt.x);
//- add physics force to gravEnt
phent_addvelcentral(gravEnt,gravForce);
wait(1);
}
snd_stop(sfxBuzz); //stop buzzing
snd_stop(sfxElectroHumm); //stop humming
phent_setdamping(gravEnt,10,30); //return to low damping for better free flight
}