Jump to content


Photo

Click and drag to make camera strafe or elevate.


  • Please log in to reply
No replies to this topic

#1 briantrlov

briantrlov

    GMC Member

  • GMC Member
  • 610 posts

Posted 05 May 2012 - 10:35 PM

okay, i am trying to make a bone creator thats not important, what is an efficient way to click and drag the mouse to make the camera go left, right, up, or down.

The code i use for figuring out the click and drag, this works fine if i make horizontal, and vertical x, and z. But as soon as the camera direction changes it goes diagonal not left.

End_Step
if(mouse_check_button_pressed(mb_left))
{
//X , Y Start
xs = window_mouse_get_x()*.4;
ys = window_mouse_get_y()*.4;
}
if(mouse_check_button(mb_left))
{
//X , Y End
xe= window_mouse_get_x()*.4;
ye= window_mouse_get_y()*.4; 
//Translate Camera
[i]horizontal[/i] -= xs-xe;
[i]vertical[/i] -= ys-ye;
//Reset
xs = xe;
ys = ye;        
}

I don't know if this is of use but this is my code for drawing.

Draw_Event
// SET CAMERA PROJECTION
  // FROM CAMERA X,Y,Z
   xf=x+lengthdir_x(cam_dis,cam_dir);
   yf=y+lengthdir_y(cam_dis,cam_dir);
   zf=cam_zdir
  // TO PLAYER X,Y,Z
   xt=x;
   yt=y;
   zt=z; 
  d3d_set_projection(xf,yf,zf,  xt,yt,zt,   0,0,1);
 // SET COLOR AND TRANSPARENCY
  draw_set_alpha(1);
  draw_set_color(c_white);

If i am not being clear please let me know i will just post an example to show you exactly whats wrong.
  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users