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
2 registered members (AndrewAMD, TipmyPip), 13,353 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
3d #406920
09/02/12 00:43
09/02/12 00:43
Joined: Dec 2008
Posts: 83
Buenos Aires, Argentina
F
Funeral Offline OP
Junior Member
Funeral  Offline OP
Junior Member
F

Joined: Dec 2008
Posts: 83
Buenos Aires, Argentina
making 3d plataform game like super mario 64 and when i rotate the pan angle of the camera the x and y axis changes the direction the players walks.before the player walked towards but if i rotate the camera 180º not it walks backward when i press "joy_force.x"

Re: 3d [Re: Funeral] #406921
09/02/12 01:25
09/02/12 01:25
Joined: Jul 2008
Posts: 2,110
Germany
rayp Offline

X
rayp  Offline

X

Joined: Jul 2008
Posts: 2,110
Germany
if you not turn the pan into direction u wanna walk into u need to use absolute vectors not relative.
But i think u have a logic error. in a 3rd person platformer you normally turn the player then setting camera angles to player angles.

or do it like that way
Code:
VECTOR dist;
if(key_w) dist.x =  2;
if(key_s) dist.x = -2;
c_move(me, vector(dist.x*time_step,.......



To "feed" c_move with absoulte use the second vector in c_move instruction.

greets


Acknex umgibt uns...zwischen Dir, mir, dem Stein dort...
"Hey Griswold ... where u gonna put a tree that big ?"
1998 i married my loved wife ... Sheeva from Mortal Kombat, not Evil-Lyn as might have been expected
rayp.flags |= UNTOUCHABLE;
Re: 3d [Re: rayp] #406923
09/02/12 03:59
09/02/12 03:59
Joined: Dec 2008
Posts: 83
Buenos Aires, Argentina
F
Funeral Offline OP
Junior Member
Funeral  Offline OP
Junior Member
F

Joined: Dec 2008
Posts: 83
Buenos Aires, Argentina
the probem persist because when i rotate the pan camera the axis also rotates with the camera and i want the x axis is always looking forward the screen.if i press key w the playes walks forward but if i rotate the camera 90º then it walks to the right when i press w and so on.so how can i keep the x and y axis at its original position independient of camera angle?

Re: 3d [Re: Funeral] #406929
09/02/12 07:57
09/02/12 07:57
Joined: Jun 2009
Posts: 2,210
Bavaria, Germany
Kartoffel Offline
Expert
Kartoffel  Offline
Expert

Joined: Jun 2009
Posts: 2,210
Bavaria, Germany
Do this before using c_move:

vec_rotate(movement_vector, vector(camera.pan, 0, 0)); wink

the x-axis of the movement vector is now always pointing in the same direction as the camera

Last edited by Kartoffel; 09/02/12 08:01.

POTATO-MAN saves the day! - Random
Re: 3d [Re: Kartoffel] #406951
09/03/12 02:01
09/03/12 02:01
Joined: Dec 2008
Posts: 83
Buenos Aires, Argentina
F
Funeral Offline OP
Junior Member
Funeral  Offline OP
Junior Member
F

Joined: Dec 2008
Posts: 83
Buenos Aires, Argentina
this the movement and camera code, how do i add this intruction you gave me? i tried putting temp in the movement_vector place but it didnt work. code:

var distance, angle;
VECTOR temp;
distance = 400;
angle =0;
while(me)
{
if(player)
{
camera.x = player.x-distance*cos(angle);
camera.y = player.y-distance*sin(angle);
camera.z = player.z+100;

vec_set(temp,player.x);
vec_sub(temp,camera.x);
vec_to_angle(camera.pan,temp);
vec_set(camera.tilt,player-300);
}
c_move(me,nullvector,vector(joy_force.x * 7 * time_step, joy_force.y * 7 * time_step, 0 ), GLIDE);

Re: 3d [Re: Funeral] #406966
09/03/12 12:41
09/03/12 12:41
Joined: Jun 2009
Posts: 2,210
Bavaria, Germany
Kartoffel Offline
Expert
Kartoffel  Offline
Expert

Joined: Jun 2009
Posts: 2,210
Bavaria, Germany
to post some code use [code] at the beginning and [/code] at the end wink

and it'll look like this: (much easier to read)
Code:
var distance, angle;
VECTOR temp;
distance = 400;
angle =0;

VECTOR move_vec; // NEW | the movement vector

while(me)
{
	if(player)
	{
		camera.x = player.x-distance*cos(angle);
		camera.y = player.y-distance*sin(angle);
		camera.z = player.z+100;
		
		vec_set(temp,player.x);
		vec_sub(temp,camera.x);
		vec_to_angle(camera.pan,temp);
		vec_set(camera.tilt,player-300);
	}
	
	vec_set(move_vec, vector(joy_force.x * 7 * time_step, joy_force.y * 7 * time_step, 0)); // NEW
	
	vec_rotate(move_vec, vector(camera.pan, 0, 0)); // NEW
	
	c_move(me, nullvector, move_vec, GLIDE); // CHANGED
}



I marked new lines with // NEW at the end and changed lines with // CHANGED

It's actually really simple:

you moved your player with this:
c_move(me, nullvector, vector(joy_force.x * 7 * time_step, joy_force.y * 7 * time_step, 0), GLIDE);


I just created a new vector called move_vec, which is set to your previous movement vector (the blue one above) every frame by doing this:

vec_set(move_vec, vector(joy_force.x * 7 * time_step, joy_force.y * 7 * time_step, 0));


After this I rotate this vector with the camera's pan-angle:
vec_rotate(move_vec, vector(camera.pan, 0, 0));

And then move the player:
c_move(me, nullvector, move_vec, GLIDE);

Last edited by Kartoffel; 09/03/12 12:46.

POTATO-MAN saves the day! - Random
Re: 3d [Re: Kartoffel] #407000
09/03/12 23:25
09/03/12 23:25
Joined: Dec 2008
Posts: 83
Buenos Aires, Argentina
F
Funeral Offline OP
Junior Member
Funeral  Offline OP
Junior Member
F

Joined: Dec 2008
Posts: 83
Buenos Aires, Argentina
problem solved!! thank you so much!! grin


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