Gamestudio Links
Zorro Links
Newest Posts
Zorro 2.70
by jcl. 09/29/25 09:24
optimize global parameters SOLVED
by dBc. 09/27/25 17:07
ZorroGPT
by TipmyPip. 09/27/25 10:05
assetHistory one candle shift
by jcl. 09/21/25 11:36
Plugins update
by Grant. 09/17/25 16:28
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
1 registered members (TipmyPip), 18,466 guests, and 6 spiders.
Key: Admin, Global Mod, Mod
Newest Members
krishna, DrissB, James168, Ed_Love, xtns
19168 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Anet entity question #290237
09/17/09 19:46
09/17/09 19:46
Joined: Jan 2005
Posts: 267
the Netherlands
Paulo Offline OP
Member
Paulo  Offline OP
Member

Joined: Jan 2005
Posts: 267
the Netherlands
Hi,

Ive set up a server/client and a client. The server/client and the client both can shoot bullets. Ive managed to create bullets at the position of the entity/player that is shooting but, i just cant get the bullets to follow the right direction. The direction on the view of the entity that is shooting is correct but, on the view of the other entity the bullet is following a different path. Maybe (just throwing up an idea) i have to send the .pan .tilt etc of the bullet to the entities?

Just to make things a little more clearer:
- There is a server and f.e. 2 clients
- Client1 fires a bullet at client 2
- The bullet is created at the pos of client 1 and travels in the direction client 1 is facing ( the .pan )
- The bullet is created at the position of client1 in the view of client2 but is not follow the right direction.


The code: ( ive only posted the pieces of code that mather imo )

function create_player()
{ enet_ent_create(_str("cbabe.mdl"),creating_pos,_str("move_player"));
}

function move_player()
{
while(enet_ent_globpointer(my) == -1) {wait(1);} //wait until the entity gets a global pointer
players[enet_ent_creator(enet_ent_globpointer(my))] = my; //saves the entity into the players array
cl_id = enet_get_clientid();

on_mouse_left = shootWeapon;
}

function move_bullet()
{
//set(my,INVISIBLE);

while(1)
{
c_move(my, vector(3, 0, 0), nullvector, GLIDE);
wait(1);
}
}

function shootWeapon()
{
ENTITY* bullet;
while(mouse_left == ON)
{
if(players[cl_id] != NULL)
{
vec_set(temp,vector(10,0,29));
vec_rotate(temp,vector(players[cl_id].pan,players[cl_id].tilt,players[cl_id].roll));
vec_add(temp,players[cl_id].x);

bullet = enet_ent_create(_str("Bullet.mdl"),temp,_str("move_bullet"));
bullet.pan = players[cl_id].pan;
bullet.tilt = players[cl_id].tilt;
}
wait(-1);
}
}
I hope some understands my problem and can help me out.

Thanks


The more you have.. the more you can lose...
Dont tell em all you know.....
Re: Anet entity question [Re: Paulo] #290330
09/18/09 14:01
09/18/09 14:01
Joined: Jan 2005
Posts: 267
the Netherlands
Paulo Offline OP
Member
Paulo  Offline OP
Member

Joined: Jan 2005
Posts: 267
the Netherlands
right, i solved this ( after 2 days :s ) by adding just a couple of lines.
I forgot to send the angle of the bullet to all the players with enet_send_angle.



Last edited by Paulo; 09/18/09 14:04.

The more you have.. the more you can lose...
Dont tell em all you know.....

Moderated by  HeelX, Spirit 

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