|
2 registered members (3run, AndrewAMD),
667
guests, and 1
spider. |
|
Key:
Admin,
Global Mod,
Mod
|
|
|
Re: Silly question about players PAN
[Re: 3run]
#349047
12/03/10 13:44
12/03/10 13:44
|
Joined: Feb 2010
Posts: 320 TANA/Madagascar
3dgs_snake
Senior Member
|
Senior Member
Joined: Feb 2010
Posts: 320
TANA/Madagascar
|
Yes, I think so, but I also think that it needs some tweaking to really look good  . Best regards.
|
|
|
Re: Silly question about players PAN
[Re: 3run]
#349063
12/03/10 17:24
12/03/10 17:24
|
Joined: May 2009
Posts: 5,367 Caucasus
3run
OP
Senior Expert
|
OP
Senior Expert
Joined: May 2009
Posts: 5,367
Caucasus
|
Shit...This didn't work as it needs to...  I'm asking you for help guys, cause other ways I'm gonna suicide!!! I'm going crazy with this thing!!! How can I turn players pan with mouse from ISOMETRIC view (when camera is on the top of the player) ??? I need turning to be comfortable!!! So player will aim easily!! Here is the picture, how it looks like: Cameras PAN is always equals to ZERO and I need player to turn his PAN and AIM around!!! I really need your help guys!!! Thank you all.
|
|
|
Re: Silly question about players PAN
[Re: 3run]
#349064
12/03/10 17:51
12/03/10 17:51
|
Joined: Dec 2008
Posts: 605 47°19'02.40" N 8°32'54.67" E...
hopfel
User
|
User
Joined: Dec 2008
Posts: 605
47°19'02.40" N 8°32'54.67" E...
|
I made a little code a few months ago:
VECTOR vec1;
ANGLE ang1;
while(1)
{
vec_set(vec1,vector(mouse_pos.x,mouse_pos.y,10000));
vec_for_screen(vec1,camera);
my.skill1=c_trace(camera.x,vec1.x,IGNORE_SPRITES + IGNORE_MODELS);
vec_to_angle(ang1,vector(vec1.x-camera.x,vec1.y-camera.y,vec1.z-camera.z));
my.x=camera.x-(-my.skill1)*cos(ang1.tilt)*cos(ang1.pan);
my.y=camera.y-(-my.skill1)*cos(ang1.tilt)*sin(ang1.pan);
my.z=camera.z-(-my.skill1)*sin(ang1.tilt);
wait(1);
}
The my-Pointer has the position of the mouse on your level. Now you can let your player look on it. (with Trigonometry or sth. like this) Hope, I didn't forget to copy something from my script. That was it, what you was looking for, right? Best wishes, Hopfel
Hilf mir, dir zu helfen!
|
|
|
Re: Silly question about players PAN
[Re: hopfel]
#349067
12/03/10 18:33
12/03/10 18:33
|
Joined: May 2009
Posts: 5,367 Caucasus
3run
OP
Senior Expert
|
OP
Senior Expert
Joined: May 2009
Posts: 5,367
Caucasus
|
Player will rotate to the mouse cursor this way, am I right? If so, I've already done that, but isn't what I'm looking for, that way its not comfortable for player turn around and aim... Please guys, I need some good solution for this! I'm going crazy  Thank you hopfel.
|
|
|
Re: Silly question about players PAN
[Re: 3run]
#350288
12/15/10 07:50
12/15/10 07:50
|
Joined: Dec 2008
Posts: 528 Wagga, Australia
the_mehmaster
User
|
User
Joined: Dec 2008
Posts: 528
Wagga, Australia
|
I need turning to be comfortable!!! So player will aim easily!! I don't really understand what you mean by this.. But you could always use 'smooth()'
#include <acknex.h>
#include <default.c>
#include <camera.c>
FONT *fnt_arial = "Arial#14" ;
var force_x = 0 ;
var force_y = 0 ;
PANEL *pan_mouseForce =
{
digits ( 0, 0, "mouse_force.x = %0.2f", fnt_arial, 1, force_x ) ;
digits ( 0, 10, "mouse_force.y = %0.2f", fnt_arial, 1, force_y ) ;
flags = SHOW ;
}
void main()
{
video_mode = 11 ;
video_screen = 2;
mouse_mode = 4 ;
mouse_pointer = 0 ;
// Load level
level_load ( "" ) ;
ENTITY *ent_player = ent_create ( "cube.mdl", nullvector, NULL ) ;
camera.tilt = -90 ;
camera.flags |= ISOMETRIC ;
vec_set (camera.x, ent_player.x) ;
camera.z += 400 ;
camera.arc = 10 ;
VECTOR vec_mouse ;
while(1)
{
// Transform mouse coordinates to screeen coordinates
vec_set ( &vec_mouse, mouse_pos ) ;
vec_for_screen ( &vec_mouse, camera ) ;
// Transform coordinates to entity coordinates
vec_sub ( &vec_mouse, ent_player.x ) ;
// Calculate rotation angle from mouse position, centered to the player
ent_player.pan = atan2v(vec_mouse.y, vec_mouse.x);
// Debug
force_x = mouse_pos.x ;
force_y = mouse_pos.y ;
smooth(ent_player.pan, 0.99);
wait(1);
}
}
If that's not what you want.. What do you mean by 'comfortable'?
|
|
|
Re: Silly question about players PAN
[Re: 3run]
#351775
12/28/10 14:24
12/28/10 14:24
|
Joined: May 2009
Posts: 5,367 Caucasus
3run
OP
Senior Expert
|
OP
Senior Expert
Joined: May 2009
Posts: 5,367
Caucasus
|
Cause if was really hard for me to explain, I decided to show you the video example of what I meant. Here it is: Lord Of the Ring Gameplay The only difference is, that I need to turn player around with mouse, not with keys, and BTW how can I turn him exactly like in the video with WASD keys? I tried to use vec_to_angle and make player turn to walking direction, but looks weird. Thank you.
|
|
|
|