|
2 registered members (TipmyPip, izorro),
556
guests, and 2
spiders. |
|
Key:
Admin,
Global Mod,
Mod
|
|
|
i`m confused, again lol
#145802
08/04/07 18:11
08/04/07 18:11
|
Joined: Nov 2005
Posts: 1,007
jigalypuff
OP
Serious User
|
OP
Serious User
Joined: Nov 2005
Posts: 1,007
|
i`m trying to get a model to scale on it`s x axis (a phaser thing lol), i have it all working sorta but i noticed that the phaser mesh passes through the enemy mesh (it still causes damage though) however i want it to well not pass through the enemy as it looks a bit silly haveing it poke out the other side. here is what i tried without success. declared an entity* enemy;
then in the phaser function i put my.scale_x = enemy.x; ///should only scale out as far as the enemy my.scale_y = 0.2; my.scale_z = 0.2;
but it still passes through the enemy, any thoughts on the best way to solve this problem? thanks for any advice.
Why does everyone like dolphins?
Never trust a species which smiles all the time!
|
|
|
Re: i`m confused, again lol
[Re: demiGod]
#145804
08/04/07 18:39
08/04/07 18:39
|
Joined: Nov 2005
Posts: 1,007
jigalypuff
OP
Serious User
|
OP
Serious User
Joined: Nov 2005
Posts: 1,007
|
ok now bear in mind i`m a bit dense here lol, this is what i just did Code:
var distance;///assume this should be a var
///added this to the beam weapon so it would scake to the enemy distance = vec_dist(my.x, enemy.x ); my.scale_x = distance / 0.1; my.scale_y = 0.2; my.scale_z = 0.2
sadly does not work, the beam still passes through the enemy, i forgot to add in the first post, in the enemy function i have enemy = my; just in case thats important.
Why does everyone like dolphins?
Never trust a species which smiles all the time!
|
|
|
Re: i`m confused, again lol
[Re: jigalypuff]
#145805
08/04/07 18:45
08/04/07 18:45
|
Joined: Mar 2006
Posts: 752 Portugal
demiGod
User
|
User
Joined: Mar 2006
Posts: 752
Portugal
|
Sorry, actually is
my.scale_x = distance * 0.1;
However you probably will need to make some kind of trace, if the phaser fails the enemy it should continue, if hits the target should stop.
Last edited by demiGod; 08/04/07 18:53.
|
|
|
Re: i`m confused, again lol
[Re: demiGod]
#145806
08/04/07 19:16
08/04/07 19:16
|
Joined: Nov 2005
Posts: 1,007
jigalypuff
OP
Serious User
|
OP
Serious User
Joined: Nov 2005
Posts: 1,007
|
still no joy i`m afraid, here is what i have tried, but it still passes through the enemy, one of the reasons i need it to stop is because i want to add in an energy drain code, so the beam stays with the enemy until the charge has run down, once i get this passing through thig sorted i `ll be trying that lol. i think i got it the way you said. Code:
var phaser_speed; var distance; var ship; function beam_weapons { wait(1); c_setminmax(me); snd_play(beam_wav, 100, 0); distance = vec_dist(my.x, enemy ); my.scale_x = distance * 0.1; my.scale_y = 0.2; my.scale_z = 0.2; my.passable = off; my.oriented = on; my.flare = on; my.bright = on; my.ambient = 100; my.pan = player.pan;//--->player.pan and tilt set to camera my.tilt = player.tilt; my.enable_entity = on; my.enable_block = on; my.enable_impact = on; my.polygon = on; phaser_speed.x = 50 * time; phaser_speed.y = 0; phaser_speed.z = 0; while (my != null) { if (my.roll > 150) { my.passable = off; } my.roll += 25 * time; c_move(my,vector(phaser_speed*time,0,0),nullvector,ignore_passable + ignore_you);/// my._frameCt += 1; if (my._frameCt >= 20) { break; } wait(1); } if (me != null) { ent_remove(me); } }
Why does everyone like dolphins?
Never trust a species which smiles all the time!
|
|
|
Re: i`m confused, again lol
[Re: demiGod]
#145808
08/04/07 19:33
08/04/07 19:33
|
Joined: Nov 2005
Posts: 1,007
jigalypuff
OP
Serious User
|
OP
Serious User
Joined: Nov 2005
Posts: 1,007
|
well here is the whole code for the beam weapon, by put it in a loop do you mean like a while(1) kinda thingy? Code:
function c_phaser { vec_for_vertex(temp,player,3894); ent_create (fphaser_mdl, temp, beam_weapons); }
var phaser_speed; var distance; var ship; function beam_weapons { wait(1); c_setminmax(me); snd_play(beam_wav, 100, 0); distance = vec_dist(my.x, enemy ); my.scale_x = distance * 0.1; my.scale_y = 0.2; my.scale_z = 0.2; my.passable = off; my.oriented = on; my.flare = on; my.bright = on; my.ambient = 100; my.pan = player.pan;//--->player.pan and tilt set to camera my.tilt = player.tilt; my.enable_entity = on; my.enable_block = on; my.enable_impact = on; my.polygon = on; phaser_speed.x = 50 * time; phaser_speed.y = 0; phaser_speed.z = 0; while (my != null) { if (my.roll > 150) { my.passable = off; } my.roll += 25 * time; c_move(my,vector(phaser_speed*time,0,0),nullvector,ignore_passable + ignore_you);/// my._frameCt += 1; if (my._frameCt >= 20) { break; } wait(1); } if (me != null) { ent_remove(me); } }
on_mouse_left = c_phaser;
Why does everyone like dolphins?
Never trust a species which smiles all the time!
|
|
|
Re: i`m confused, again lol
[Re: demiGod]
#145811
08/04/07 20:26
08/04/07 20:26
|
Joined: Nov 2005
Posts: 1,007
jigalypuff
OP
Serious User
|
OP
Serious User
Joined: Nov 2005
Posts: 1,007
|
ok tried that, but now the beam will not follow my pan or angle, it just goes in a straight line, also it no longer vanishs, just stays there on the screen, and still passes through the enemy. here is the code, i reckon i have put something the wrong way around. Code:
function c_phaser { vec_for_vertex(temp,player,3894); ent_create (fphaser_mdl, temp, beam_weapons); }
var phaser_speed; var distance; var ship; function beam_weapons { wait(1); c_setminmax(me); snd_play(beam_wav, 100, 0); while (my != null) { distance = vec_dist(my.x, enemy ); my.scale_x = distance * 0.01; my.scale_y = 0.2; my.scale_z = 0.2; wait(1); }
my.passable = off; my.oriented = on; my.flare = on; my.bright = on; my.ambient = 100; my.pan = player.pan;//--->player.pan and tilt set to camera my.tilt = player.tilt; my.enable_entity = on; my.enable_block = on; my.enable_impact = on; my.polygon = on; phaser_speed.x = 50 * time; phaser_speed.y = 0; phaser_speed.z = 0; while (my != null) { if (my.roll > 150) { my.passable = off; } my.roll += 25 * time; c_move(my,vector(phaser_speed*time,0,0),nullvector,ignore_passable + ignore_you);/// my._frameCt += 1; if (my._frameCt >= 20) { break; } wait(1); } if (me != null) { ent_remove(me); } }
Why does everyone like dolphins?
Never trust a species which smiles all the time!
|
|
|
|