|
Car Physics Demo Script Problems
#36481
11/18/04 19:08
11/18/04 19:08
|
Joined: Sep 2004
Posts: 40
iprogramgames2
OP
Newbie
|
OP
Newbie
Joined: Sep 2004
Posts: 40
|
I have several problems with the demo SCRIPT (not the compiled demo):
I must make this clear. I have played the compiled demo and it runs great. I expected the same from compiling the script but this is not the case.
1. Am I the only person that had to change the scripts to get the car demo to work? I really appreciate the free (for pro users) script but it doesn't work as is. Certain functions required a vector and had values set to 0 (zero). I had to change these to nullvector.
2. Am I the only person that is having problems with the car breaking (stopping) when I try to accelerate? This happens with the keyboard and joystick. I have narrowed it down to this piece of code located within the SpeedControl() function located within physics_car.wdl:
// if we drive in one direction and want to change direction, apply brakes // (angSpeed>0 checks if rear wheel is turning forward // direction<0 checks if user hits reverse key if ((angSpeed>5 && direction<0) || (angSpeed<-5 && direction>0)) { targetSpeed=0; // brake // press brakes quarter down when rolling at high speed if (abs(angSpeed)>0.25*maxAngSpeed) { phcon_setmotor(wheelRL, nullvector, vector(angSpeed*0.5, 0.5*maxTorqueBrake,0), nullvector); phcon_setmotor(wheelRR, nullvector, vector(angSpeed*0.5, 0.5*maxTorqueBrake,0), nullvector); if (abs(angSpeed)>0.50*maxAngSpeed) { EventBrake(); // braking sound } }
Why in the world is this code automatically breaking for me with that EventBrake(); call?
Someone please give me some good code.
|
|
|
Re: Car Physics Demo Script Problems
[Re: iprogramgames2]
#36482
11/18/04 21:39
11/18/04 21:39
|
Joined: Oct 2003
Posts: 1,550 United Kingdom
indiGLOW
Serious User
|
Serious User
Joined: Oct 2003
Posts: 1,550
United Kingdom
|
Why dont you create a debug panel to display all the variables, maybe the equation is always true? At least this way you might spot the problem. Im no expert, but I can't see anything wrong with the script
The Art of Conversation is dead : Discuss
|
|
|
Re: Car Physics Demo Script Problems
[Re: iprogramgames2]
#36485
11/19/04 06:02
11/19/04 06:02
|
Joined: Sep 2003
Posts: 3,236 San Diego, CA
Marco_Grubert
Expert
|
Expert
Joined: Sep 2003
Posts: 3,236
San Diego, CA
|
Quote:
1. Am I the only person that had to change the scripts to get the car demo to work? I really appreciate the free (for pro users) script but it doesn't work as is. Certain functions required a vector and had values set to 0 (zero). I had to change these to nullvector.
Not with more recent versions, phFunctions support 0 for nullvector.
Quote:
2. Am I the only person that is having problems with the car breaking (stopping) when I try to accelerate?
Unplug your joysticks to make sure it's not stopping the car.
If anyone else encounters this problem please confirm. I just tested it with 6.31.3 and there was a problem with a panel definition but everything else worked fine.
|
|
|
|