Gamestudio Links
Zorro Links
Newest Posts
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
Change chart colours
by 7th_zorro. 05/11/24 09:25
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (AndrewAMD, 1 invisible), 1,395 guests, and 12 spiders.
Key: Admin, Global Mod, Mod
Newest Members
AemStones, LucasJoshua, Baklazhan, Hanky27, firatv
19055 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Orbit Camera #337135
08/08/10 18:48
08/08/10 18:48
Joined: Dec 2008
Posts: 222
janerwac13 Offline OP
Member
janerwac13  Offline OP
Member

Joined: Dec 2008
Posts: 222
Ich möchte gerne ein Camera die man mit der Muas um den Spieler rotieren lassen kann auch noch oben und unten.
Der code aus AUM 93 hat leider nbicht gefuntzt.

DAs ist der Player aus meinem Spiel:
Quote:
action ball()
{
VECTOR ball_speed;
var soundtrack_handle;
ENTITY* ball;
ball = my;

ph_setgravity (vector(0, 0, -386)); // set the gravity
phent_settype (my, PH_RIGID, PH_SPHERE); // set the physics entity type
phent_setmass (my, 3, PH_SPHERE); // and its mass
phent_setfriction (my, 80); // set the friction
phent_setdamping (my, 40, 40); // set the damping
phent_setelasticity (my, 50, 20); // set the elasticity
while (1)
{
ball_speed.x = 25 * (key_cur - key_cul); // move the ball using the cursor keys
ball_speed.y = 25 * (key_cuu - key_cud); // 25 sets the x / y movement speeds
ball_speed.z = 0; // no need to move on the vertical axis
if (key_p)
{
freeze_mode = 1;
set(pause_pan,VISIBLE);
mouse_mode = 2;
}
phent_addtorqueglobal (my, ball_speed); // add a torque (an angular force) to the ball
camera.x = my.x - 300; // keep the camera 300 quants behind the ball
camera.y = my.y; // using the same y with the ball
camera.z = my.z + 100; // and place it at z = 1000 quants
camera.tilt = -10;
wait (1);
}
}


Last edited by janerwac13; 08/09/10 14:00.
Re: Orbit Camera [Re: janerwac13] #337144
08/08/10 21:33
08/08/10 21:33
Joined: Nov 2007
Posts: 2,568
Germany, BW, Stuttgart
MasterQ32 Offline
Expert
MasterQ32  Offline
Expert

Joined: Nov 2007
Posts: 2,568
Germany, BW, Stuttgart
probier mal so was hier:
Code:
...
rot_angle += mickey.x * 4;
rot_height = clamp(rot_height + mickey.y * 2,0,45);
VECTOR offset;
vec_set(offset,vector(-300,0,100));
vec_rotate(offset,vector(rot_angle,rot_height,0));
vec_set(camera.x,my.x);
vec_add(camera.x,offset);
camera.pan = rot_angle;
camera.tilt = -rot_height;
...



kurze erklärung:
rot_angle:
eine var, die angibt, von welcher Position auf der xy-ebene

rot_height
eine var, die die höhe angibt begrenzt von 0° bis 45° (änderbar)

offset:
das camera-offset

...
camera.pan = rot_angle;
camera.tilt = -rot_height;
...
Die Camera schaut immer auf den Ball

Note:
Der Code is frei, ohne getestet zu sein, sollte aber im Prinzip gehen


Visit my site: www.masterq32.de
Re: Orbit Camera [Re: MasterQ32] #337200
08/09/10 13:28
08/09/10 13:28
Joined: Dec 2008
Posts: 222
janerwac13 Offline OP
Member
janerwac13  Offline OP
Member

Joined: Dec 2008
Posts: 222
funtzt net ! frown
meinst dz rot_amgle stat rot_height ?

Last edited by janerwac13; 08/09/10 13:58.
Re: Orbit Camera [Re: janerwac13] #337205
08/09/10 14:01
08/09/10 14:01
Joined: Dec 2008
Posts: 222
janerwac13 Offline OP
Member
janerwac13  Offline OP
Member

Joined: Dec 2008
Posts: 222
[quote]action ball()
{
VECTOR ball_speed;
var soundtrack_handle;
VECTOR kick_speed;
ENTITY* ball;
SOUND* ball_wav = "ball.wav";
ball = my;
var rot_angle = mickey.x * 4;
var rot_height = clamp(rot_angle + mickey.y * 2,0,45);
VECTOR offset;
var jumptimer = -1.5;
ph_setgravity (vector(0, 0, -500)); // set the gravity
phent_settype (my, PH_RIGID, PH_SPHERE); // set the physics entity type
phent_setmass (my, 3, PH_SPHERE); // and its mass
phent_setfriction (my, 80); // set the friction
phent_setdamping (my, 40, 40); // set the damping
phent_setelasticity (my, 50, 20); // set the elasticity
while (1)
{
ball_speed.x = 40 * (key_d - key_a); // move the ball using the cursor keys
ball_speed.y = 40 * (key_w - key_s); // 25 sets the x / y movement speeds
ball_speed.z = 0; // no need to move on the vertical axis
if (key_p)
{
freeze_mode = 1;
set(pause_pan,VISIBLE);
mouse_mode = 2;
}
phent_addtorqueglobal (my, ball_speed); // add a torque (an angular force) to the ball
vec_set(offset,vector(-300,0,100));
vec_rotate(offset,vector(rot_angle,rot_height,0));
vec_set(camera.x,my.x);
vec_add(camera.x,offset);
camera.pan = rot_angle;
camera.tilt = -rot_height;


if (key_space)
{
phent_addvelcentral(my,vector(0,0,1000*time_step));
wait(-1); // Wartet bis man wieder springen darf

}
wait (1);
}
}
[quote]

Re: Orbit Camera [Re: janerwac13] #337207
08/09/10 14:10
08/09/10 14:10
Joined: Nov 2007
Posts: 2,568
Germany, BW, Stuttgart
MasterQ32 Offline
Expert
MasterQ32  Offline
Expert

Joined: Nov 2007
Posts: 2,568
Germany, BW, Stuttgart
ne, du hast mich falsch verstanden
mein code geht, du musst die beiden zeilen in der schleife lassen:
Code:
rot_angle += mickey.x * 4;
rot_height = clamp(rot_height + mickey.y * 2,0,45);



du must die variablen nur mit null deklarieren:
Code:
action ball()
{
VECTOR ball_speed;
var soundtrack_handle;
VECTOR kick_speed;
ENTITY* ball;
SOUND* ball_wav = "ball.wav";
ball = my;
var rot_angle = 0;
var rot_height = 12;
VECTOR offset;
var jumptimer = -1.5;
ph_setgravity (vector(0, 0, -500)); // set the gravity
phent_settype (my, PH_RIGID, PH_SPHERE); // set the physics entity type
phent_setmass (my, 3, PH_SPHERE); // and its mass
phent_setfriction (my, 80); // set the friction
phent_setdamping (my, 40, 40); // set the damping
phent_setelasticity (my, 50, 20); // set the elasticity
while (1)
{
ball_speed.x = 40 * (key_d - key_a); // move the ball using the cursor keys
ball_speed.y = 40 * (key_w - key_s); // 25 sets the x / y movement speeds
ball_speed.z = 0; // no need to move on the vertical axis
if (key_p)
{
freeze_mode = 1;
set(pause_pan,VISIBLE);
mouse_mode = 2;
}
phent_addtorqueglobal (my, ball_speed); // add a torque (an angular force) to the ball

rot_angle += mickey.x * 4;
rot_height = clamp(rot_height + mickey.y * 2,0,45);

vec_set(offset,vector(-300,0,100));
vec_rotate(offset,vector(rot_angle,rot_height,0));
vec_set(camera.x,my.x);
vec_add(camera.x,offset);
camera.pan = rot_angle;
camera.tilt = -rot_height;


if (key_space)
{
phent_addvelcentral(my,vector(0,0,1000*time_step));
wait(-1); // Wartet bis man wieder springen darf

}
wait (1);
}
}




Visit my site: www.masterq32.de
Re: Orbit Camera [Re: MasterQ32] #337212
08/09/10 14:36
08/09/10 14:36
Joined: Dec 2008
Posts: 222
janerwac13 Offline OP
Member
janerwac13  Offline OP
Member

Joined: Dec 2008
Posts: 222
Cool ! Danke !
und sorry für das missverständnis !

Re: Orbit Camera [Re: janerwac13] #337213
08/09/10 14:41
08/09/10 14:41
Joined: Dec 2008
Posts: 222
janerwac13 Offline OP
Member
janerwac13  Offline OP
Member

Joined: Dec 2008
Posts: 222
Nun ist nun ein problem auf gefallen !

Last edited by janerwac13; 08/09/10 14:44.
Re: Orbit Camera [Re: janerwac13] #337215
08/09/10 14:47
08/09/10 14:47
Joined: Dec 2008
Posts: 222
janerwac13 Offline OP
Member
janerwac13  Offline OP
Member

Joined: Dec 2008
Posts: 222
Nun wenn ich die kamera drehe ist nun hinten vorne und umgekeht !
Ich messe mich an dem Xbox Arcade game Marble Blast was ich parallel laufen hab um meins mit diesem zuvergleichen.
Dort ist es so egal wo hin ich die cam dreh vorne bleibt vorn also wenn ich die cam nach hinten dreh ist dort von der tastertur trotz dem vorne.
ich hoffe ihr versteht was ich meine und nun muss ich das irgendwie ergänzen.
ich hoffe ihr helft mir da bei auch ! wink

Re: Orbit Camera [Re: janerwac13] #337243
08/09/10 17:51
08/09/10 17:51
Joined: Nov 2007
Posts: 2,568
Germany, BW, Stuttgart
MasterQ32 Offline
Expert
MasterQ32  Offline
Expert

Joined: Nov 2007
Posts: 2,568
Germany, BW, Stuttgart
Code:
action ball()
{
VECTOR ball_speed;
var soundtrack_handle;
VECTOR kick_speed;
ENTITY* ball;
SOUND* ball_wav = "ball.wav";
ball = my;
var rot_angle = 0;
var rot_height = 12;
VECTOR offset;
var jumptimer = -1.5;
ph_setgravity (vector(0, 0, -500)); // set the gravity
phent_settype (my, PH_RIGID, PH_SPHERE); // set the physics entity type
phent_setmass (my, 3, PH_SPHERE); // and its mass
phent_setfriction (my, 80); // set the friction
phent_setdamping (my, 40, 40); // set the damping
phent_setelasticity (my, 50, 20); // set the elasticity
while (1)
{
ball_speed.x = 40 * (key_d - key_a); // move the ball using the cursor keys
ball_speed.y = 40 * (key_w - key_s); // 25 sets the x / y movement speeds
ball_speed.z = 0; // no need to move on the vertical axis
vec_rotate(ball_speed,vector(camera.pan,0,0)); //Die Zeile rotiert deinen Bewegungsvektor mit der Kamera
if (key_p)
{
freeze_mode = 1;
set(pause_pan,VISIBLE);
mouse_mode = 2;
}
phent_addtorqueglobal (my, ball_speed); // add a torque (an angular force) to the ball

rot_angle += mickey.x * 4;
rot_height = clamp(rot_height + mickey.y * 2,0,45);

vec_set(offset,vector(-300,0,100));
vec_rotate(offset,vector(rot_angle,rot_height,0));
vec_set(camera.x,my.x);
vec_add(camera.x,offset);
camera.pan = rot_angle;
camera.tilt = -rot_height;


if (key_space)
{
phent_addvelcentral(my,vector(0,0,1000*time_step));
wait(-1); // Wartet bis man wieder springen darf

}
wait (1);
}
}




Visit my site: www.masterq32.de
Re: Orbit Camera [Re: MasterQ32] #337245
08/09/10 18:03
08/09/10 18:03
Joined: Dec 2008
Posts: 222
janerwac13 Offline OP
Member
janerwac13  Offline OP
Member

Joined: Dec 2008
Posts: 222
Danke ! einfach nur Danke !


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