1 registered members (AndrewAMD),
1,248
guests, and 6
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Re: Mouse, aim
[Re: rtsgamer706]
#358779
02/13/11 12:45
02/13/11 12:45
|
Joined: Feb 2010
Posts: 886
Random
User
|
User
Joined: Feb 2010
Posts: 886
|
Like this; function mouse_aim() { proc_mode=PROC_LATE; VECTOR weaponOffset; while(1) { if(mouse_right == 1)// hold it to aim. { camera.arc = 50; // zoom alittlebit //set position //////////////////////////////// vec_set (weaponOffset.x, vector (?, ?, ?)); vec_rotate (weaponOffset.x, vector (camera.pan, camera.tilt, 0)); vec_add (weaponOffset.x, camera.x); vec_set (my.x, weaponOffset.x); my.pan = camera.pan; my.tilt = camera.tilt; wait(1); //end of setting the position //////////////////////////////// } else //When your not pressing mouse right. { camera.arc = 80; vec_set(my.x,weaponOffset); vec_rotate(my.x,camera.pan); vec_add(my.x,camera.x); vec_set(my.pan,camera.pan); my.pan = camera.pan; my.tilt = camera.tilt; wait(1); } } } It`s tested and it works. You just must play with the numbers to set the right position.
|
|
|
Re: Mouse, aim
[Re: rtsgamer706]
#358793
02/13/11 13:32
02/13/11 13:32
|
Joined: Oct 2009
Posts: 149 Germany
muffel
Member
|
Member
Joined: Oct 2009
Posts: 149
Germany
|
with this code you get the nearest position on the terrain under your cursor. this position is stored in the mouse3d_vec vector
vec_set(temp,mouse_dir3d);
vec_scale(temp,1000); // set a range
vec_add(temp,mouse_pos3d);
c_trace(mouse_pos3d,temp,IGNORE_MODELS|IGNORE_SPRITES);
vec_set( mouse3d_vec , target );
the code is tested put it in the mainloop declare temp as a local vector and mouse3d_vec as a global vector muffel
|
|
|
Re: Mouse, aim
[Re: muffel]
#358795
02/13/11 13:37
02/13/11 13:37
|
Joined: Dec 2009
Posts: 361
rtsgamer706
OP
Senior Member
|
OP
Senior Member
Joined: Dec 2009
Posts: 361
|
VECTOR mouse3d_vec;
action b_gun() { // set(my,PASSABLE); VECTOR temp; while(my) { my.tilt = clamp(0, my.tilt, 0); vec_for_vertex(me.x, basic, 365); vec_to_angle(my.pan,mouse_dir3d); vec_set(temp,mouse_dir3d); vec_scale(temp,1000); // set a range vec_add(temp,mouse_pos3d); c_trace(mouse_pos3d,temp,IGNORE_MODELS|IGNORE_SPRITES); vec_set( mouse3d_vec , target ); wait(1); } }
This is what that action currently looks like, it has not changed my problem, (Turret still aims up and down) what did i do wrong? thanks rtsgamer706
|
|
|
Moderated by mk_1, Perro, rayp, Realspawn, Rei_Ayanami, rvL_eXile, Spirit, Superku, Tobias, TSG_Torsten, VeT
|