Gamestudio Links
Zorro Links
Newest Posts
Newbie Questions
by fairtrader. 12/05/23 10:32
Zorro Trader GPT
by TipmyPip. 12/04/23 11:34
Square root rule
by Smallz. 12/02/23 09:15
RTest not found error
by TipmyPip. 12/01/23 21:43
neural function for Python to [Train]
by TipmyPip. 12/01/23 14:47
Xor Memory Problem.
by TipmyPip. 11/28/23 14:23
Training with command line parameters
by TipmyPip. 11/26/23 08:42
Combine USD & BTC Pairs In Asset Loop
by TipmyPip. 11/26/23 08:30
AUM Magazine
Latest Screens
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Tactics of World War I
Who's Online Now
6 registered members (AndrewAMD, alibaba, fairtrader, ozgur, TipmyPip, Quad), 604 guests, and 1 spider.
Key: Admin, Global Mod, Mod
Newest Members
fairtrader, hus, Vurtis, Harry5, KelvinC
19019 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 2 of 3 1 2 3
Re: problem with target... [Re: tompo] #121262
04/19/07 18:07
04/19/07 18:07
Joined: Feb 2006
Posts: 2,185
mpdeveloper_B Offline OP
Expert
mpdeveloper_B  Offline OP
Expert

Joined: Feb 2006
Posts: 2,185
the camera is from a third person view, i want to trace from the middle of the camera to straight ahead, then it should turn the player's bullets to point in that way, in other words, to get the bullet to hit in the center of the crosshair, in the world, here's an example:






- aka Manslayer101
Re: problem with target... [Re: mpdeveloper_B] #121263
04/19/07 18:17
04/19/07 18:17
Joined: Mar 2007
Posts: 776
Poor village - Poland ;)
tompo Offline
User
tompo  Offline
User

Joined: Mar 2007
Posts: 776
Poor village - Poland ;)
Try this:
Code:
 
function target_fun
{
target_ent = me;
my.invisible = off;
my.passable = off;
while(1)
{
temp.x = MOUSE_POS.x;
temp.y = MOUSE_POS.y;
temp.z = 800; //aiming distance
vec_for_screen(temp,CAMERA);
vec_set(my.x, temp);
trace_mode = IGNORE_ME + IGNORE_PASSABLE + IGNORE_SPRITES + scan_texture;
result = trace (camera.pos, my.pos);
if(result == 0) || (you == player) {vec_set(my.x,temp);}
else {vec_set(my.x, target); }
wait(1);
}
}




Never say never.
Re: problem with target... [Re: tompo] #121264
04/19/07 18:25
04/19/07 18:25
Joined: Feb 2006
Posts: 2,185
mpdeveloper_B Offline OP
Expert
mpdeveloper_B  Offline OP
Expert

Joined: Feb 2006
Posts: 2,185
i got an extremely odd result from this:

note: scaled the images down, the brown particle effects are where the bullets are hitting








they seem to be colliding with each other in midair, and floating into unknown space

Last edited by Manslayer101; 04/19/07 18:27.

- aka Manslayer101
Re: problem with target... [Re: mpdeveloper_B] #121265
04/19/07 18:35
04/19/07 18:35
Joined: Mar 2007
Posts: 776
Poor village - Poland ;)
tompo Offline
User
tompo  Offline
User

Joined: Mar 2007
Posts: 776
Poor village - Poland ;)
3 questions...
1. all this robo model is the player entity?
2. have you assigned MOUSE_POS.X = POINTER.X; MOUSE_POS.Y = POINTER.Y; in some while loop?
3. You are sure that this crosshair is in mouse_pos?

This upper code you have to attach to invisible entity like cube or something.

And at the end of this upper code you should add something like:
if(mouse_left ===1){ent_create("bullet_hole.bmp",my.x,bullet_function);}


Never say never.
Re: problem with target... [Re: tompo] #121266
04/19/07 18:43
04/19/07 18:43
Joined: Feb 2006
Posts: 2,185
mpdeveloper_B Offline OP
Expert
mpdeveloper_B  Offline OP
Expert

Joined: Feb 2006
Posts: 2,185
1. yes
2. yes
3. no

the reason i was trying to trace from the camera to a point in the world that would be straight ahead of the camera was so that i wouldn't have to make the crosshair relative to the pointer, it was to prevent doing that, instead i wanted to trace straight ahead, and have the bullet turn to the target position, so it would perfectly hit in the center of the screen in the 3d world, like most 3rd person shooters


- aka Manslayer101
Re: problem with target... [Re: tompo] #121267
04/19/07 18:55
04/19/07 18:55
Joined: Mar 2007
Posts: 776
Poor village - Poland ;)
tompo Offline
User
tompo  Offline
User

Joined: Mar 2007
Posts: 776
Poor village - Poland ;)
If you want that crosshair be always in the middle and shots also...
change mouse_pos.x and y to this:

Code:
 
temp.x = screen_size.x /2;
temp.y = screen_size.y /2;



but you have to attach this function to invisible entity and then inside this loop call function like:
Code:
 
ent_create("buulet.bmp",my.x,bullet_function);



Last edited by tompo; 04/19/07 18:58.

Never say never.
Re: problem with target... [Re: tompo] #121268
04/19/07 19:45
04/19/07 19:45
Joined: Feb 2006
Posts: 2,185
mpdeveloper_B Offline OP
Expert
mpdeveloper_B  Offline OP
Expert

Joined: Feb 2006
Posts: 2,185
the crosshair isn't the problem, it's where it should be, the firing code should have nothing to do with the crosshair, just the camera and the target location, the code i previously posted had worked just fine with version 3, but as soon as i updated to version 5 it does something completely different. the demo of our game PreVa has the code in it, it's located in the Showcase I forum if you need a reference for what i mean, you'll see that it worked fine in the demo (which was published with version 3)

code is located in the hov_mecha_guns.wdl, in case you download the demo

Last edited by Manslayer101; 04/19/07 19:46.

- aka Manslayer101
Re: problem with target... [Re: mpdeveloper_B] #121269
04/19/07 20:13
04/19/07 20:13
Joined: Mar 2007
Posts: 776
Poor village - Poland ;)
tompo Offline
User
tompo  Offline
User

Joined: Mar 2007
Posts: 776
Poor village - Poland ;)
I've seen tech demo at your page and...
but the croisshair is just a bitmap on screen like panel and never be inside the game. so ij You have trace from camera to far away you have to put something (entity or virtual) inside dephfield to be able to trace from this target to player or put this crosshair like a sprite inside the game but then this crosshair will change his size.
With function vec_for_screen(temp,CAMERA); you put this target inside the game at temp distance or traced if hit something. Then fire from player.pos (gun) to target.pos.
Isn't it what you want to?


Never say never.
Re: problem with target... [Re: tompo] #121270
04/19/07 21:44
04/19/07 21:44
Joined: Feb 2006
Posts: 2,185
mpdeveloper_B Offline OP
Expert
mpdeveloper_B  Offline OP
Expert

Joined: Feb 2006
Posts: 2,185
but if you put an entity at the camera's position, it's just the same as tracing from the camera itself, i just want to make a function that turns a bullet the same as a 3rd person shooter


- aka Manslayer101
Re: problem with target... [Re: mpdeveloper_B] #121271
04/19/07 22:13
04/19/07 22:13
Joined: Mar 2007
Posts: 776
Poor village - Poland ;)
tompo Offline
User
tompo  Offline
User

Joined: Mar 2007
Posts: 776
Poor village - Poland ;)
you don't put entity at the camera's position! That's the point! By function vec_for_screen(temp,CAMERA); You put this entity front of camera, in the middle of the view but temp.z ahead to the camera! And then you trace from middle of camera and camera's position, to middle of camera but f.e. 800 quants ahead position!
I've used the same in my space shooter game but with mouse_pos. If you want that mouse pointer (crosshair) will be always in the middle change mouse_pos to scree_size/2 as I said.


Never say never.
Page 2 of 3 1 2 3

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