Gamestudio Links
Zorro Links
Newest Posts
Trading Journey
by M_D. 04/26/24 20:22
Help with plotting multiple ZigZag
by M_D. 04/26/24 20:03
Data from CSV not parsed correctly
by jcl. 04/26/24 11:18
M1 Oversampling
by jcl. 04/26/24 11:12
Why Zorro supports up to 72 cores?
by jcl. 04/26/24 11:09
Eigenwerbung
by jcl. 04/26/24 11:08
MT5 bridge not working on MT5 v. 5 build 4160
by EternallyCurious. 04/25/24 20:49
Zorro FIX plugin - Experimental
by flink. 04/21/24 07:12
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
0 registered members (), 819 guests, and 3 spiders.
Key: Admin, Global Mod, Mod
Newest Members
wandaluciaia, Mega_Rod, EternallyCurious, howardR, 11honza11
19049 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Jumping ball, bad timing #253872
02/27/09 13:13
02/27/09 13:13
Joined: Mar 2008
Posts: 104
theDust Offline OP
Member
theDust  Offline OP
Member

Joined: Mar 2008
Posts: 104
Hello again. My goal is a ball that should always jump in the same way. At my testlevel the ball is only jumping, no other movement, so its easier to see the problem. When the ball is jumping continuously you see that sometimes the ball is jumping right in the moment when he has touched the ground. But sometimes he sticks to the ground a few millisecs and makes a jump half of the height as the jump before.

Here the whole project (keep pressing space to jump, maybe wait a little bit at the beginning until the ball doesn't rotate any more):
http://www.file-upload.net/download-1487600/testjump.rar.html
Here the code:
Code:
#include <acknex.h>
#include <default.c>

ENTITY* pointer;
VECTOR jump;

function main() 
{
   video_screen = 2;
   video_mode = 8;	
   mouse_mode = 1;	
   fps_max = 60;  
   wait(-1);
   ph_fps_max_lock = 120;	
   level_load ("level1.wmb"); 
   ph_setgravity (vector(0, 0, -700));   
} 


function coll() {
	
   jump.x = 0; jump.y = 0; jump.z = 500;  
	
   if(key_space )
   {     
      phent_addvelcentral(pointer,jump);
   }
    
}

action playerj() 
{
  pointer = my;
  my.emask |= (ENABLE_BLOCK | ENABLE_ENTITY); 
  my.event = coll;
  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);
}


When I raise the ph_fps_max_lock it gets a bit better, but the problem remains. So, help would be great.

Re: Jumping ball, bad timing [Re: theDust] #253922
02/27/09 18:40
02/27/09 18:40
Joined: Jan 2008
Posts: 1,580
Blade280891 Offline
Serious User
Blade280891  Offline
Serious User

Joined: Jan 2008
Posts: 1,580
Random guess; is that because it is using physics ?


My Avatar Randomness V2

"Someone get me to the doctor, and someone call the nurse
And someone buy me roses, and someone burned the church"
Re: Jumping ball, bad timing [Re: Blade280891] #253924
02/27/09 19:01
02/27/09 19:01
Joined: Mar 2008
Posts: 104
theDust Offline OP
Member
theDust  Offline OP
Member

Joined: Mar 2008
Posts: 104
Most probably yes. Or something with the collisionsystem. Or something inbetween.

Re: Jumping ball, bad timing [Re: theDust] #254147
03/01/09 12:51
03/01/09 12:51
Joined: Mar 2008
Posts: 104
theDust Offline OP
Member
theDust  Offline OP
Member

Joined: Mar 2008
Posts: 104
After intense research, no answers and hours of experimenting, I can assume that the physics from gamestudio are not able to let a object jump properly(!).

Or maybe: Im not able to let a object jump properly. So please, let's fill this ridiculous knowledge gap wink

PS: And no, I can't try to use newton, because I can't update my A7-version, because I can't download the update, because someone has ruined my adsl and downloading 1 mb needs 2 hours (and costs 2 €)

Last edited by theDust; 03/01/09 12:52.
Re: Jumping ball, bad timing [Re: theDust] #254181
03/01/09 16:34
03/01/09 16:34
Joined: Sep 2003
Posts: 929
Spirit Offline

Moderator
Spirit  Offline

Moderator

Joined: Sep 2003
Posts: 929
I think, the problem is what youre doing here:

function coll() {

jump.x = 0; jump.y = 0; jump.z = 500;

if(key_space )
{
phent_addvelcentral(pointer,jump);
}

}

I think this is an odd mix of physics and script. Youre using an event and adding your own velocity by code, why? I think jumping should better be controlled by physics, elasticity and so on. Have you tried it with physics?


Re: Jumping ball, bad timing [Re: Spirit] #254197
03/01/09 17:44
03/01/09 17:44
Joined: Mar 2008
Posts: 104
theDust Offline OP
Member
theDust  Offline OP
Member

Joined: Mar 2008
Posts: 104
But when space is pressed I want to add a force additional to the elasticity of the object. In the test the elasticity is set to null, cause you can better see the irregular jumps. Hmmm, maybe I should simply raise the elasticity when space is pressed.
Thx for the mental input smile

Re: Jumping ball, bad timing [Re: theDust] #254261
03/02/09 07:07
03/02/09 07:07
Joined: Jul 2000
Posts: 27,986
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,986
Frankfurt
When you want to apply external force by pressing a key, phent_addvelcentral is correct. But it's not correct for "adjusting" the elasticity of physics objects. Mixing physics and non-physics won't work.

There's a workshop and a simple demo for kicking a ball.




Moderated by  HeelX, Spirit 

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