|
|
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
User
|
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
OP
Expert
|
OP
Expert
Joined: Feb 2006
Posts: 2,185
|
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
User
|
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
OP
Expert
|
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
User
|
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
OP
Expert
|
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
User
|
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
OP
Expert
|
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
User
|
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.
|
|
|
|