Gamestudio Links
Zorro Links
Newest Posts
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
1 registered members (7th_zorro), 1,390 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Hanky27, firatv, wandaluciaia, Mega_Rod, EternallyCurious
19051 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