1 registered members (monarch),
1,259
guests, and 5
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Re: Beim Sprung friert die cam ein
[Re: Ich_bin_Batman]
#337404
08/10/10 18:48
08/10/10 18:48
|
Joined: Dec 2008
Posts: 222
janerwac13
OP
Member
|
OP
Member
Joined: Dec 2008
Posts: 222
|
function Kamera() { while(me != NULL) { camera.x = player.x; camera.y = player.y; camera.z = player.z; 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; wait(1); } }
action ball() { VECTOR ball_speed; ENTITY* ball; var rot_angle = 0; var rot_height = 0; VECTOR offset; var jumptimer = -1.5; my.skill1=0; 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; } if(my.skill1>2 && key_space) { my.skill1=0; phent_addvelcentral(me,vector(0,0,1000*time_step));
} 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(my.z<-850) { ent_remove(my); game_load("level",1); return; } wait (1); } }
|
|
|
Re: Beim Sprung friert die cam ein
[Re: janerwac13]
#337408
08/10/10 18:54
08/10/10 18:54
|
Joined: May 2010
Posts: 48
Ich_bin_Batman
Newbie
|
Newbie
Joined: May 2010
Posts: 48
|
function Kamera()
{
while(me != NULL)
{
var rot_angle = 0;
var rot_height = 0;
camera.x = player.x;
camera.y = player.y;
camera.z = player.z;
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;
wait(1);
}
}
action ball()
{
VECTOR ball_speed;
ENTITY* ball;
VECTOR offset;
var jumptimer = -1.5;
my.skill1=0;
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
kamera();
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;
}
if(my.skill1>2 && key_space)
{
my.skill1=0;
phent_addvelcentral(me,vector(0,0,1000*time_step));
}
phent_addtorqueglobal (my, ball_speed); // add a torque (an angular force) to the ball
if(my.z<-850)
{
ent_remove(my);
game_load("level",1);
return;
}
wait (1);
}
}
Versuchs mal so
Last edited by Ich_bin_Batman; 08/10/10 18:57.
|
|
|
Re: Beim Sprung friert die cam ein
[Re: Ich_bin_Batman]
#337409
08/10/10 18:56
08/10/10 18:56
|
Joined: Dec 2008
Posts: 222
janerwac13
OP
Member
|
OP
Member
Joined: Dec 2008
Posts: 222
|
|
|
|
Re: Beim Sprung friert die cam ein
[Re: Ich_bin_Batman]
#337411
08/10/10 18:59
08/10/10 18:59
|
Joined: Feb 2010
Posts: 482 in deinem Kopf
Otter
Senior Member
|
Senior Member
Joined: Feb 2010
Posts: 482
in deinem Kopf
|
die kamera findet den player warscheinlich nicht weil er noch nicht definiert wurde (oder hab ichs übersehen?): player = me;
Be my UBB-Buddy, without any reason!
|
|
|
Moderated by mk_1, Perro, rayp, Realspawn, Rei_Ayanami, rvL_eXile, Spirit, Superku, Tobias, TSG_Torsten, VeT
|