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
4 registered members (AndrewAMD, TipmyPip, NewbieZorro, Grant), 14,196 guests, and 5 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
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 | 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