|
2 registered members (TipmyPip, izorro),
556
guests, and 2
spiders. |
|
Key:
Admin,
Global Mod,
Mod
|
|
|
collision problem after 6.40.5 update
#80690
07/08/06 10:26
07/08/06 10:26
|
Joined: Mar 2006
Posts: 752 Portugal
demiGod
OP
User
|
OP
User
Joined: Mar 2006
Posts: 752
Portugal
|
I´m sorry but i posted this problem in the Physics forum yesterday, but nobody gives some help, so i ask here because i´m stucked right here in my project: I had this code with version 6.31.4 comm for the ball and the physics was very good and realistic, including collision against models, maps and blocks (geometry). Code:
PHENT_SETTYPE(MY,PH_rigid,PH_sphere); PHENT_SETMASS(MY,0.2,PH_sphere); PHENT_SETFRICTION(MY,75); PHENT_SETELASTICITY(MY,75,25); PHENT_SETDAMPING(MY,50,75); PH_SETGRAVITY(VECTOR(0,0,-386));
However, after the update 6.40.5, even recompiling the maps and the whole level, now the physics is very unstable, the friction and rotation of the ball its not normal, seems to glide on the ground (blocks and sprites). Sometimes the ball bounces against models, maps and blocks, and sometimes (almost all the time and with more speed), the ball stays close to the model for some time, but rotating on the collision point, and then go back like she was bouncing. I´ve tested with a new level just with a hollow block and a ball with de code above. It seems to have a delay on the collision response. Please, how can i solve this problem (diferent solution than downgrade the engine)? Thanks in advance.
|
|
|
Re: collision problem after 6.40.5 update
[Re: demiGod]
#80691
07/10/06 09:42
07/10/06 09:42
|
Joined: Jul 2000
Posts: 27,967 Frankfurt
jcl

Chief Engineer
|

Chief Engineer
Joined: Jul 2000
Posts: 27,967
Frankfurt
|
Maybe one of your settings is not good. The ball example in the manual uses the following settings:
phent_settype(eBall,_VAR(PH_RIGID),_VAR(PH_SPHERE)); phent_setmass(eBall,_VAR(1.0),_VAR(PH_SPHERE)); phent_setfriction(eBall,_VAR(90.0)); phent_setelasticity(eBall,_VAR(75.0),_VAR(100.0)); phent_setdamping(eBall,_VAR(30.0),_VAR(5.0)); ph_setgravity(_vec(0,0,-500));
(the "_VAR" is for C++ only).
|
|
|
Re: collision problem after 6.40.5 update
[Re: demiGod]
#80694
07/12/06 23:56
07/12/06 23:56
|
Joined: Sep 2003
Posts: 3,236 San Diego, CA
Marco_Grubert
Expert
|
Expert
Joined: Sep 2003
Posts: 3,236
San Diego, CA
|
Quote:
However, after the update 6.40.5, even recompiling the maps and the whole level, now the physics is very unstable, the friction and rotation of the ball its not normal, seems to glide on the ground (blocks and sprites).
The collision detection in 6.40.5 is actually more stable than what is available in 6.31.4, however, forces may have a larger effect than before. When applying lots of force you can push a phent into solids where it will start spinning. The solution then is to lower your forces. If that is not an option try increasing the ERP/CFM values for contacts so that the entity gets pushed out of solids more quickly, cf. ph_setcontacts()
If you have your level & script for download I can take a look to see where the problem lies.
Last edited by Marco_Grubert; 07/13/06 21:07.
|
|
|
Re: collision problem after 6.40.5 update
[Re: Marco_Grubert]
#80695
07/14/06 00:06
07/14/06 00:06
|
Joined: Mar 2006
Posts: 752 Portugal
demiGod
OP
User
|
OP
User
Joined: Mar 2006
Posts: 752
Portugal
|
Hi, Marco I tested your recomendations but the problem persists. So, like you said, i give the link to a simple level test with a hollow cube, a ball and the code for you to examine. testPhysicsBall Thanks in advance for spending time trying to help me.
|
|
|
Re: collision problem after 6.40.5 update
[Re: demiGod]
#80697
07/16/06 10:22
07/16/06 10:22
|
Joined: Jul 2000
Posts: 27,967 Frankfurt
jcl

Chief Engineer
|

Chief Engineer
Joined: Jul 2000
Posts: 27,967
Frankfurt
|
Your level behaves normally here, but this is just chance. I believe that your code won't work properly. For instance: Code:
function applyBallForce() { phent_addcentralforce (ball, ballForce.x); //phent_addforceglobal(ball,ballForce.x,vector(-1000,1000,0)); //phent_addforcelocal(ball,ballForce.x,vector(-1000,1000,-1000)); }
on_f = applyBallForce(); This accelerates the ball in a random way because speed is the product of acceleration and time. But you do not know how long a frame lasts, so your ball gets a random speed, and thus can theoretically end up in a wall despite I haven't observed this with your level. See the ball example in the manual. Also, your on_f line is not correct - do not use () when assigning a function. For giving a ball a kick, use addvelcentral. Applying forces is for accelerating during a certain time, like through the rocket engine of a spaceship. For a kick, apply a velocity, like: phent_addvelcentral(Ball,vector(100,100,100));
|
|
|
Re: collision problem after 6.40.5 update
[Re: jcl]
#80698
07/17/06 15:24
07/17/06 15:24
|
Joined: Mar 2006
Posts: 752 Portugal
demiGod
OP
User
|
OP
User
Joined: Mar 2006
Posts: 752
Portugal
|
Hello jcl, thank you for your reply. I´ve done tests with phent_addvelcentral even with the ball example in the manual, but the problem its the same. Now, and before eventually close this thread, i ask you just to see the level i made, wich is similar to the other one, but this time uses the 6.40 manual ball example. Because i have problems with monitor refresh rate, using time_smooth=0, fps_max=60, fps_min=20, fps_lock=on, and ph_fps_max_lock=fps_max, the ball doesnt even bounces on the ground, when applying a gravity force more than vector(0,0,-421). Less than this value the ball bounces. BTW, in statistics panel why SRV(time for entity updates and fps_max idling) its so high = 22? I am sorry for this mess, but i need to be sure that the problem its my work environment or an engine issue. However, in 6.31.4 version i havent saw this problem. Thanks in advance. testPhysicsBall_changed and _cd
|
|
|
Re: collision problem after 6.40.5 update
[Re: demiGod]
#80699
07/17/06 17:18
07/17/06 17:18
|
Joined: Feb 2003
Posts: 6,818 Minot, North Dakota, USA
ulillillia
Senior Expert
|
Senior Expert
Joined: Feb 2003
Posts: 6,818
Minot, North Dakota, USA
|
There's a bug with fps_max. Setting fps_max to 60 causes the frame rate to not go any higher than 32 fps. You're not the only one getting this. At least a dozen other users are (myself included).
"You level up the fastest and easiest if you do things at your own level and no higher or lower" - useful tip
My 2D game - release on Jun 13th; My tutorials
|
|
|
|