|
2 registered members (TipmyPip, 1 invisible),
18,699
guests, and 8
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Re: Am I missing anything important?
[Re: JRAV]
#30388
07/14/04 06:25
07/14/04 06:25
|
Joined: Mar 2003
Posts: 5,377 USofA
fastlane69
Senior Expert
|
Senior Expert
Joined: Mar 2003
Posts: 5,377
USofA
|
Quote:
while (my.z > -150) {wait (1);} // the ball has approached the floor
Here is what I think is happening. I'm afraid it has nothing to do with the enabling commands as Nard suggested. This grouping feature is entirely optional and not necessary for using the PE:
a) You have a mass of 1. Don't try to model your world on a 1kg = 1 on the physics engine. 1 is a very low number which means that even the smallest of forces will upset it. On top of this, I suspect you are using a small model for the cube (less than 10 quants), thus few contact points.
Advice: Increase Mass and Model size. Don't use real world numbers as a guide, but rather how it looks and feels to you. Use Game REquirements, not actual Physics numbers to guide your selection.
b) Here's where I think the problem is:
Quote:
ACTION PhysikCube {
phent_settype(my, ph_rigid, ph_sphere); // enable physics for this ball phent_setmass(my, 1, ph_sphere); // the ball has 1kg (2 lbs) and behaves like a sphere phent_setfriction(my, 30); // friction phent_setelasticity(my, 30, 0); // bounce a little temp.x = 0; temp.y = 0; temp.z = -380; // earth gravity factor, g = 9.81 m/s2 ph_SetGravity(temp); // set gravity while (my.z > -150) {wait (1);} // the ball has approached the floor sleep (3); // give it 3 more seconds phent_setelasticity(my, 0, 0); // stop bouncing sleep (3); // give it 3 more seconds phent_settype(my, 0, ph_sphere); // now stop the ball
}
I have this gut feeling this line is the problem. It may be that you are starting at z= -200 for example, thus leaving you stuck in that loop. It may be that you are starting at LESS than -150, thus forcing you to blow though that line without even checking the loop. Or it could be something else, but that line distrubs me.
Advice: 1) You can use the minimumSpeed feature of phent_setelasticity to do what I think you want to do, which is stop the ball after a few bounces.
2)Eliminate the line in red and actually set up functions to control your ball in your action. It will make it easier to see what you want to do and figure out WHERE the problem is. For example:
Action ball { ball_init();//initiallize everything, from gravity to elasticity here. wait(1); //I like to take a small break after every initialization...just to be sure.  while (1) { if( (my.z <50)&&(my.z>-50) ) //is we are less than 50 quants off the gound, but above -50 { stop_ball(); //Here is where you would reset the PE parameters to efffect the kind of stopping you want
} wait (1); }
Don't know if this is a specific solution, but check it out! 
|
|
|
|
|
|