2 registered members (VoroneTZ, TipmyPip),
1,333
guests, and 0
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Timing problem
#253493
02/25/09 00:48
02/25/09 00:48
|
Joined: Mar 2008
Posts: 104
theDust
OP
Member
|
OP
Member
Joined: Mar 2008
Posts: 104
|
Hellooo, I've made a little test arrangement: You let a physical object, let's say a ball, jump with the space-key. When the ball is hitting the ground and space is pressed a force, i use phent_addvelcentral(ENTITY*,VECTOR* speed), will move the object. No problem so far. You keep pressing space. Now you see, the jumps doesn't have a constant height. Sometimes the ball jumps right in the moment when he has touched the ground. And sometimes he sticks to the ground a few millisecs and makes a jump half of the height as the jump before. The ball doesn't move and doesn't rotate, its only jumping. You can clearly see, something at the timing goes wrong I've set fps_max = 60 and when i raise the "ph_fps_max_lock" the collision-detection gets a bit better, but its far from good. Any idea ?
|
|
|
Re: Timing problem
[Re: zwecklos]
#253548
02/25/09 11:47
02/25/09 11:47
|
Joined: Mar 2008
Posts: 104
theDust
OP
Member
|
OP
Member
Joined: Mar 2008
Posts: 104
|
Thx ! But later the object should jump across the world, with nonlinear jumps --> calculating the time of 1 jump would only work with linear jumps, always at the same position. When the object is moving around while jumping its harder to spot that the timing is wrong, but it is wrong Yes, c-trace is a nice thing, i use it already. Sooo, a GS-master is needed !
Last edited by theDust; 02/25/09 11:48.
|
|
|
Re: Timing problem
[Re: Quad]
#253553
02/25/09 12:40
02/25/09 12:40
|
Joined: Mar 2008
Posts: 104
theDust
OP
Member
|
OP
Member
Joined: Mar 2008
Posts: 104
|
Here the code : #include <acknex.h>
#include <default.c>
ENTITY* pointer;
VECTOR global;
VECTOR check;
VECTOR jump;
var checkj = 0;
function main()
{
video_screen = 2;
video_mode = 8;
mouse_mode = 1;
fps_max = 60;
wait(-1);
level_load ("level1.wmb");
ph_setgravity (vector(0, 0, -700));
}
action playerj()
{
pointer = my;
my.emask |= (ENABLE_BLOCK | ENABLE_ENTITY);
phent_settype (pointer, PH_RIGID, PH_SPHERE);
phent_setmass (pointer, 1, PH_SPHERE);
phent_setfriction (pointer, 500);
phent_setdamping (pointer, 50, 50);
phent_setelasticity (pointer, 0, 0);
jump.x = 0; jump.y = 0; jump.z = 150;
while (1) {
global.x = my.x ;
global.y = my.y ;
global.z = my.z ;
check.x = my.x;
check.y = my.y;
check.z = my.z-23; //the height of the ball/2
checkj = c_trace(global,check,USE_BOX);
if(key_space && checkj != 0)
{
phent_addvelcentral(pointer,jump);
}
wait (1);
}
} And here the whole project, jump with space : http://www.file-upload.net/download-1482643/testjump.rar.htmlBe a bit patient, sometimes the weird timing needs a few jumps to get visible
Last edited by theDust; 02/25/09 12:41.
|
|
|
Moderated by mk_1, Perro, rayp, Realspawn, Rei_Ayanami, rvL_eXile, Spirit, Superku, Tobias, TSG_Torsten, VeT
|