Gamestudio Links
Zorro Links
Newest Posts
Help with plotting multiple ZigZag
by degenerate_762. 04/30/24 23:23
M1 Oversampling
by 11honza11. 04/30/24 08:16
Trading Journey
by howardR. 04/28/24 09:55
Zorro Trader GPT
by TipmyPip. 04/27/24 13:50
Data from CSV not parsed correctly
by jcl. 04/26/24 11:18
Why Zorro supports up to 72 cores?
by jcl. 04/26/24 11:09
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
4 registered members (AndrewAMD, 7th_zorro, VoroneTZ, Quad), 901 guests, and 0 spiders.
Key: Admin, Global Mod, Mod
Newest Members
firatv, wandaluciaia, Mega_Rod, EternallyCurious, howardR
19050 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 3 of 3 1 2 3
Re: HL2 physics [Re: MagZu] #54235
03/11/06 18:50
03/11/06 18:50
Joined: Oct 2004
Posts: 4,134
Netherlands
Joozey Offline
Expert
Joozey  Offline
Expert

Joined: Oct 2004
Posts: 4,134
Netherlands
0_o
Bump?
Say at least something useful when digging up an old threat.


Click and join the 3dgs irc community!
Room: #3dgs
Re: HL2 physics [Re: Joozey] #54236
03/12/06 03:27
03/12/06 03:27
Joined: Nov 2002
Posts: 601
Indy
poke_smot Offline
User
poke_smot  Offline
User

Joined: Nov 2002
Posts: 601
Indy
I made a gravity type of thing for one of my games.
You used a "gravlifter" to move crates and slam them into the ground, smashing rats.

Anyway heres the relevent function
Code:

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
}



gravPointEnt is an invisible entity that is controled with the mouse, this entity marks where the gravEnt should be.
gravEnt is the entity affected by gravity.
gravSwitch is the toggle, == 1 gravity gun is on, == 0 freeflight


Making guns illegal will save as many lives as making murder illegal.
Page 3 of 3 1 2 3

Moderated by  HeelX, Spirit 

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