Gamestudio Links
Zorro Links
Newest Posts
ZorroGPT
by TipmyPip. 02/23/26 21:52
WFO Training with parallel cores Zorro64
by Martin_HH. 02/23/26 15:29
Camera always moves upwards?
by clonman. 02/21/26 09:29
Zorro version 3.0 prerelease!
by TipmyPip. 02/20/26 13:22
Sam Foster Sound | Experienced Game Composer for Hire
by titanicpiano14. 02/19/26 13:22
AUM Magazine
Latest Screens
Dorifto samurai
Shadow 2
Rocker`s Revenge
Stug 3 Stormartillery
Who's Online Now
1 registered members (AndrewAMD), 6,385 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
alx, ApprenticeInMuc, PatrickH90, USER0328, Sfrdragon
19199 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 2 1 2
Silly question about players PAN #348991
12/02/10 17:20
12/02/10 17:20
Joined: May 2009
Posts: 5,377
Caucasus
3run Offline OP
Senior Expert
3run  Offline OP
Senior Expert

Joined: May 2009
Posts: 5,377
Caucasus
Its really simple I guess and shame upon me for asking such silly questions...
But how can I turn player's PAN with mouse_force X and Y? So when I make circle with mouse player must turn around for 360 digres.


Looking for free stuff?? Take a look here: http://badcom.at.ua
Support me on: https://boosty.to/3rung
Re: Silly question about players PAN [Re: 3run] #348993
12/02/10 17:52
12/02/10 17:52
Joined: Feb 2010
Posts: 886
Random Offline
User
Random  Offline
User

Joined: Feb 2010
Posts: 886
3run I think you already made that.
Look at the codes in youre webside.
But do you meen it like this?;

action move_pan_with_mouse_guy()
{
player = my;
set (my, INVISIBLE);

vec_set (camera.x, player.x);
camera.z += 35;
camera.pan -= 6 * mouse_force.x * time_step;
player.pan = camera.pan;

wait (1);
}
}


Red is the colure youre looking for grin

Random



Re: Silly question about players PAN [Re: Random] #348995
12/02/10 18:04
12/02/10 18:04
Joined: May 2009
Posts: 5,377
Caucasus
3run Offline OP
Senior Expert
3run  Offline OP
Senior Expert

Joined: May 2009
Posts: 5,377
Caucasus
Dude grin
That way, players PAN will change only when you move mouse to the left and right ^^
And I need to be able to turn it by 'mouse_force.x' together with 'mouse_force.y' (up and down).
So as I said when I move mouse in circle player will turn around for 360 digress.
I use ISOMETRIC flag on camera (so it's TOP VIEW).
Camera has it's own non turning PAN.
Only pan that need to be changed is PLAYERS PAN.
And with only 'mouse_force.x' it will be really uncomfortable.
Any ideas how to make player turn around with mouse?
I though about making it look at the cursor (with using of 'mouse_mode'), that way it will be a bit better I guess, but I don't need to have a cursor on screen...


Looking for free stuff?? Take a look here: http://badcom.at.ua
Support me on: https://boosty.to/3rung
Re: Silly question about players PAN [Re: 3run] #349017
12/03/10 05:29
12/03/10 05:29
Joined: May 2009
Posts: 5,377
Caucasus
3run Offline OP
Senior Expert
3run  Offline OP
Senior Expert

Joined: May 2009
Posts: 5,377
Caucasus
Any ideas? Is this so hard to solve??


Looking for free stuff?? Take a look here: http://badcom.at.ua
Support me on: https://boosty.to/3rung
Re: Silly question about players PAN [Re: 3run] #349022
12/03/10 08:06
12/03/10 08:06
Joined: Feb 2010
Posts: 320
TANA/Madagascar
3dgs_snake Offline
Senior Member
3dgs_snake  Offline
Senior Member

Joined: Feb 2010
Posts: 320
TANA/Madagascar
Hi!

I know that it is not what you really want tongue , but I think it does what you want to do (here, I use mouse_pos, not mouse_force blush, If you want to use mouse_force, you need to do more calculations, perhaps you need to store the last mouse pos and do the calculations with the curent mouse pos, add or substract angles depending on mouse pos - I think you get the Idea ). Bellow is the code

Code:
#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 = 4 ;
	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 += 20 ;
	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 ;
		
		wait(1);
	}
}



Best regards.

Last edited by 3dgs_snake; 12/03/10 08:14. Reason: Added mouse_pointer = 0 to hide the mouse cursor
Re: Silly question about players PAN [Re: 3dgs_snake] #349030
12/03/10 10:53
12/03/10 10:53
Joined: May 2009
Posts: 5,377
Caucasus
3run Offline OP
Senior Expert
3run  Offline OP
Senior Expert

Joined: May 2009
Posts: 5,377
Caucasus
How can I make mouse cursor stay on fixed distance from player? That way it will be more comfortable to turn around I guess.


Looking for free stuff?? Take a look here: http://badcom.at.ua
Support me on: https://boosty.to/3rung
Re: Silly question about players PAN [Re: 3run] #349040
12/03/10 12:17
12/03/10 12:17
Joined: Feb 2010
Posts: 320
TANA/Madagascar
3dgs_snake Offline
Senior Member
3dgs_snake  Offline
Senior Member

Joined: Feb 2010
Posts: 320
TANA/Madagascar
I tried to normalize the transformed coordinates bya a radius amount
Code:
vec_sub ( &vec_mouse, ent_player.x ) ;
vec_normalize( &vec_mouse, radius ) ;



but frown that doesn't seem to work.

Re: Silly question about players PAN [Re: 3dgs_snake] #349041
12/03/10 12:36
12/03/10 12:36
Joined: Nov 2007
Posts: 2,568
Germany, BW, Stuttgart
MasterQ32 Offline
Expert
MasterQ32  Offline
Expert

Joined: Nov 2007
Posts: 2,568
Germany, BW, Stuttgart
your code will work if you use the right pointer grin
you need to use mouse_pos to set the correct pointer!


Visit my site: www.masterq32.de
Re: Silly question about players PAN [Re: 3dgs_snake] #349042
12/03/10 12:41
12/03/10 12:41
Joined: May 2009
Posts: 5,377
Caucasus
3run Offline OP
Senior Expert
3run  Offline OP
Senior Expert

Joined: May 2009
Posts: 5,377
Caucasus
Don't mind that silly example that I've posted grin

Last edited by 3run; 12/03/10 13:21. Reason: Shit happens

Looking for free stuff?? Take a look here: http://badcom.at.ua
Support me on: https://boosty.to/3rung
Re: Silly question about players PAN [Re: 3run] #349043
12/03/10 13:18
12/03/10 13:18
Joined: Feb 2010
Posts: 320
TANA/Madagascar
3dgs_snake Offline
Senior Member
3dgs_snake  Offline
Senior Member

Joined: Feb 2010
Posts: 320
TANA/Madagascar
grin I think you found it! At least, it is better than my previous code. Perhaps smoothing the rotation will make it look beter.

Code:
#include <acknex.h>
#include <default.c>
#include <camera.c>

// Ray radius
var ray_radius = 20 ;

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

VECTOR vec_mouse;
VECTOR temp;

void main()
{
	video_mode = 4;
	mouse_mode = 4;
	mouse_pointer = 0;
	level_load("");
	ENTITY *ent_player = ent_create("cube.mdl",nullvector,NULL);
	camera.tilt = -90 ;
	set(camera,ISOMETRIC);
	vec_set(camera.x,ent_player.x);
	camera.z += 20;
	camera.arc = 10 ;
	
	while(1)
	{
		vec_set(&vec_mouse,mouse_pos);
		vec_for_screen(&vec_mouse,camera);
		vec_diff(temp,vec_mouse.x,ent_player.x);		
		vec_normalize(temp,100);	
		vec_add(temp,ent_player.x);
		vec_sub(&vec_mouse,ent_player.x) ;
		ent_player.pan = atan2v(vec_mouse.y,vec_mouse.x);
		wait(1);
	}
}



Page 1 of 2 1 2

Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

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