Gamestudio Links
Zorro Links
Newest Posts
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (dr_panther, 1 invisible), 643 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Hanky27, firatv, wandaluciaia, Mega_Rod, EternallyCurious
19051 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 2 1 2
accurate shot #148575
08/16/07 21:43
08/16/07 21:43
Joined: Mar 2006
Posts: 752
Portugal
demiGod Offline OP
User
demiGod  Offline 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: demiGod] #148576
08/16/07 22:07
08/16/07 22:07
Joined: Oct 2006
Posts: 873
S
Shadow969 Offline
User
Shadow969  Offline
User
S

Joined: Oct 2006
Posts: 873
maybe try decreasing ball's tilt, instead of changing z-speed. not sure

Re: accurate shot [Re: Shadow969] #148577
08/16/07 22:09
08/16/07 22:09
Joined: Mar 2006
Posts: 752
Portugal
demiGod Offline OP
User
demiGod  Offline OP
User

Joined: Mar 2006
Posts: 752
Portugal
But i need gravity for the ball to make a curve, dont think changing ballīs tilt will solve the problem...

Re: accurate shot [Re: demiGod] #148578
08/17/07 10:18
08/17/07 10:18
Joined: Oct 2006
Posts: 873
S
Shadow969 Offline
User
Shadow969  Offline
User
S

Joined: Oct 2006
Posts: 873
if you'll change the ball's tilt, his trajectory will change...
c_move (my, ball_speed, nullvector, ignore_passable);//you use relative movement, so changing entity's orientation will change his trajectory

Re: accurate shot [Re: Shadow969] #148579
08/17/07 10:36
08/17/07 10:36
Joined: Mar 2006
Posts: 752
Portugal
demiGod Offline OP
User
demiGod  Offline 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
T
testDummy Offline
Serious User
testDummy  Offline
Serious User
T

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: testDummy] #148581
08/17/07 18:04
08/17/07 18:04
Joined: Mar 2006
Posts: 752
Portugal
demiGod Offline OP
User
demiGod  Offline OP
User

Joined: Mar 2006
Posts: 752
Portugal
It doesnt work either...

I believe this isnt such a complicated question, any ideas?

Re: accurate shot [Re: demiGod] #148582
08/17/07 18:44
08/17/07 18:44
Joined: Nov 2006
Posts: 141
South Africa
quasarchangel Offline
Member
quasarchangel  Offline
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...
Re: accurate shot [Re: quasarchangel] #148583
08/17/07 18:56
08/17/07 18:56
Joined: Mar 2006
Posts: 752
Portugal
demiGod Offline OP
User
demiGod  Offline OP
User

Joined: Mar 2006
Posts: 752
Portugal
Hmmm, the ball is created and attached in a vertex at front of weapon pipe / barrel, but i tested before ballīs creation the gun is passable and the problem persists.

I realised that the weapons AUM worshops (58 and up) works great because the player moves slow, if increase speed it happens the same problem.

I think its necessary to consider the player speed at the moment...

Re: accurate shot [Re: demiGod] #148584
08/17/07 20:32
08/17/07 20:32
Joined: Mar 2006
Posts: 752
Portugal
demiGod Offline OP
User
demiGod  Offline OP
User

Joined: Mar 2006
Posts: 752
Portugal
Here is a little vid where we can see the problem that occours when player is moving:


SHOT PROBLEM HERE

Page 1 of 2 1 2

Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

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