2 registered members (dr_panther, 1 invisible),
643
guests, and 2
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
accurate shot
#148575
08/16/07 21:43
08/16/07 21:43
|
Joined: Mar 2006
Posts: 752 Portugal
demiGod
OP
User
|
OP
User
Joined: Mar 2006
Posts: 752
Portugal
|
Hi, i am trying to make a gun shot some balls and it works ok when the player and gun are stopped: Code:
function create_balls() { proc_kill(4); vec_for_vertex (temp.x, weapon1, 1465); ent_create (ball_mdl, temp.x, move_balls); } }
function move_balls() { var ball_speed; my.pan = camera.pan; my.tilt = camera.tilt; ball_speed.x = 50 * time_step; ball_speed.y = 0; ball_speed.z = 10 * time_step; while (my != null) { c_move (my, ball_speed, nullvector, ignore_passable); ball_speed.z -= 3 * time_step; wait (1); } }
The problem is: when the player and gun are moving, when camera.tilt its higher than zero the ball goes up and does not assume the correct tilt. Also it happens when camera.tilt is less than zero, goes too much down the ball. Whatīs the problem here? Thanks.
|
|
|
Re: accurate shot
[Re: Shadow969]
#148579
08/17/07 10:36
08/17/07 10:36
|
Joined: Mar 2006
Posts: 752 Portugal
demiGod
OP
User
|
OP
User
Joined: Mar 2006
Posts: 752
Portugal
|
Yes, its true that changing ballīs tilt will change the trajectory actually that is the problem, because ballīs tilt is allways camera tilt and works fine with player and gun stopped, i mean, the ball is created right and the movement and gravity is good, no matters what pan ot tilt camera / gun. The problem is when the player and gun are moving, if i look up the ball is trown too much high, and when look down she goes too much down. Tried using playerīs speed on ballīs movement but didnt work More ideas?
|
|
|
Re: accurate shot
[Re: demiGod]
#148580
08/17/07 12:42
08/17/07 12:42
|
Joined: Oct 2004
Posts: 1,655
testDummy
Serious User
|
Serious User
Joined: Oct 2004
Posts: 1,655
|
Hypothetical and untested... (edited) Code:
define _tm1, skill29; // world speed define _wSpeed, skill30; define _wSpeedX, skill30; define _wSpeedY, skill31; define _wSpeedZ, skill32; // relative speed define _rSpeed, skill33; define _rSpeedX, skill33; define _rSpeedY, skill34; define _rSpeedZ, skill35; define _prSpeedX, skill36; // parent speed (relative) define _pwSpeedZ, skill37; // parent speed (world)
function create_balls() { proc_kill(4); vec_for_vertex (temp, weapon1, 1465); ent_create (ball_mdl, temp, move_balls); }
function move_balls() { my.pan = camera.pan; my.tilt = camera.tilt; if (player != NULL) { my._prSpeedX = player._rSpeedX; my._pwSpeedZ = player._wSpeedZ; } while (me != null) { my._tm1 += 0.0625 * time_step; my._rSpeedX = max(0, (5 + my._prSpeedX) - my._tm1 * 0.25); //tD: note: the ball may slow down too fast my._wSpeedZ = (-5 + my._pwSpeedZ) * my._tm1; //tD: the ball may start to fall too fast if (c_move (my, my._rSpeed, my._wSpeed, ignore_passable) <= 0.01) { break; } wait (1); } }
|
|
|
Re: accurate shot
[Re: demiGod]
#148582
08/17/07 18:44
08/17/07 18:44
|
Joined: Nov 2006
Posts: 141 South Africa
quasarchangel
Member
|
Member
Joined: Nov 2006
Posts: 141
South Africa
|
Isnt it because the ball gets created inside the player/gun model while player is moveing and therefore it, the ball, cannot move properly?
God DID give us a manual on how to change this world...
|
|
|
|