Gamestudio Links
Zorro Links
Newest Posts
Zorro Beta 2.61: PyTorch
by jcl. 06/10/24 14:42
New FXCM FIX Plugin
by flink. 06/04/24 07:30
AlpacaZorroPlugin v1.3.0 Released
by kzhao. 05/22/24 13:41
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
3 registered members (AndrewAMD, VoroneTZ, 1 invisible), 1,578 guests, and 7 spiders.
Key: Admin, Global Mod, Mod
Newest Members
AemStones, LucasJoshua, Baklazhan, Hanky27, firatv
19058 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,107
Germany
rayp Offline

X
rayp  Offline

X

Joined: Jul 2008
Posts: 2,107
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 | 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