Gamestudio Links
Zorro Links
Newest Posts
AlpacaZorroPlugin v1.3.0 Released
by kzhao. 05/22/24 13:41
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
Change chart colours
by 7th_zorro. 05/11/24 09:25
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (AndrewAMD, alibaba), 1,426 guests, and 9 spiders.
Key: Admin, Global Mod, Mod
Newest Members
AemStones, LucasJoshua, Baklazhan, Hanky27, firatv
19055 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 2 of 2 1 2
Re: Mouse, aim [Re: rtsgamer706] #358796
02/13/11 13:40
02/13/11 13:40
Joined: Oct 2009
Posts: 149
Germany
M
muffel Offline
Member
muffel  Offline
Member
M

Joined: Oct 2009
Posts: 149
Germany
The turret has to aim to mouse3d_vec
after turning you have to do the clamping
Code:
action b_gun()
{
  // set(my,PASSABLE);
  VECTOR temp;
  while(my)
  {
    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 );

    vec_diff( temp , me.x , mouse3d_vec );// may need to exchange me.x and mouse3d_vec
    vec_to_angle( my.pan , temp );

    my.tilt = clamp(0, my.tilt, 0);
    wait(1);
  }
}


muffel

Last edited by muffel; 02/13/11 13:44.
Re: Mouse, aim [Re: muffel] #359192
02/16/11 01:10
02/16/11 01:10
Joined: Dec 2009
Posts: 361
R
rtsgamer706 Offline OP
Senior Member
rtsgamer706  Offline OP
Senior Member
R

Joined: Dec 2009
Posts: 361
It works! It works! It works!
kinda...
I had to take out the following lines:

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 );

vec_diff( temp , me.x , mouse3d_vec );// may need to exchange me.x and mouse3d_vec
vec_to_angle( my.pan , temp );

but once I removed them it worked!
The gun always looks at my mouse!
Thank you so much for the help!
rtsgamer706

Page 2 of 2 1 2

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