When the car is stationary, it’s almost impossible to turn. At normal-fast speeds it steers just fine.
I know the value for ‘turn amount’ is set very low, but it’s perfect for when the car is at higher speeds
################################################## Steering
def Steering( vehicleID, controller):
# set turn amount
turn = 0.05
# get steering sensors
steerLeft = controller.sensors["Left"] # sensor named "Left"
steerRight = controller.sensors["Right"] # sensor named "Right"
# turn left
if steerLeft.positive == True:
turn = turn
# turn right
elif steerRight.positive == True:
turn = -turn
# go straight
else:
turn = 0.0
# steer with front tires only
vehicleID.setSteeringValue(turn,0)
vehicleID.setSteeringValue(turn,1)
###############################################
Didn’t paste the entire script, but is there something missing here?
Or does this problem have nothing to do with steering? Could it be the model?
That doesn’t sound like a problem. In fact, it makes perfect sense.
It probably adjusts the steering value at the rate of the movement value. That’s how I set up my vehicles.
You should check through the rest of the script, see if there’s a value somewhere that matches turning to movement, and change it.
Insert the first line near the beginning of the code and replace the value you have for turn_speed with the value shown (will only work if the car object itself has the script).
I updated the script to use a division because it will mean higher values for low speed.
Not right at the beginning, but anywhere after the line that says something like myObject = myController.owner
If you still don’t get it, then I advise you hop onto http://www.tutorialsforblender3d.com/ and study how Python is used in the many pieces of example code found there throughout its API documentation (that was what got me to really start getting Python).
You got the first part right, but the second part is not indented property (convert your whitespace to tabs, make sure the option ‘tabs as spaces’ is disabled, and then line up the second line of the ‘if’ statement and hit Tab).
after looking at your second peice of code. Is anything scaled down? Your turning variable is not going to take affect unless your car is moving greater than 1(bu) m/s . So you may not be going fast enough for it to kick in. Do you have an else:turn = this. If not, the console should be kicking out an error till your rise above a speed of 1. adjust the speed in the if to a lower amount, Like .01(you could even do 0, so that if you are moving at all the turn is adjusted, else i think it will kick out an error till you at least move in some direction), so that it always is working. Once your sure that it is indeed working. Adjust the denomintator in Ace’s fraction. And just in case ace wasnt clear. I think hes saying you should use a good tab, instead of one space.
Alright, so I lowered the value, and have tried indenting.
Kept getting an error in the console in regards to the turn = abs (Speed Y/10).
Figured I have to indent it, not sure to where exactly. Hitting TAB once didn’t work.
Accidentally closed Blender and tried it again. Got an error from the other one now.
Just to make it a whole lot easier, which letter/number should be lined up with what?
if abs(speedY) > 1:
turn_amount = abs(SpeedY/10)
I’d have to check your code but I still bet you anything because your using turn before it gets defined. Turn does not get defined until your speed goes above 1. So your trying to use turn from the start, and It hasnt got established yet, because your speed has not increased above 1 yet. its trying to use something that does not exist.
You could try a little fix by going:
It could be that or it could be that if your car is sitting still, its trying to divide a speed of zero . You can’t do that either
It probably wont get you the desired effect. But you can see if it kills the error. Also, you are using turn and turn_amount. Are those 2 seperate variables? hard to tell, I see your original code used turn, but now you have turn_amount. I cant really tell whats going on.
I had been using that same script. When I originally got it, I think the turn was set to 0.3. I have done a lot of tweaking on it but my turn is still close at 0.2. I tested your 0.05 and it barely turned unless I was going fast. I should mention that you might want to adjust the mass of your car. I found that 400 works well for me on a 90 Eagle Talon and the gas power is boosted up to 1600. It gets me an accurate stock 1/4 mile time.
Problem is setting it to anything past 0.08 is too fast.
Could very well be because the cars are too small. They’re about 4x2 when lining them up to the default grid.
I have tried using different masses, though I didn’t notice if they affected anything other than ramming power. I currently have it set to 200…
I think what I might do is find a way to make sure the player is always in motion. Like if you come to a dead stop, or are turned around, you get set back on the track in the proper direction with a rolling start. That way no one will notice the steering problem, and it won’t break the sense of speed and fluidity.
That’s what I’m really going for, here. An unrealistic, exhilarating racing game with brutal crashes and lots of jumps.
i’m not sure if size would be a factor as long as the mass is correct. are you steering with the front wheels? too much power will lift the front wheels and cause you to understeer. its possible that when you get going at a decent speed, the weight comes back down on the front wheels and gives you control back. there is a lot of stuff going on with all the suspension and drivetrain configurations.
Oh, that’s right, it’s a tutorialsforblender3d script, isn’t it?
The big issue with those scripts is that the indenting is very rickety. Any edit you make can destroy the script solely because of the indenting. I don’t understand why or how and I’m not going to try to, but that’s just my experience. =P
Now, I just have to ask, what /exactly/ is the problem here? Because as far as I’m aware, the car is supposed to have a slower turn rate at slower speeds…
It is, I took out the header in the script above ^
I have the script set up to another car in some other file, I’ll try and hook it up to this one and see what happens!
EDIT: Found the script, and it works incredibly well!
The brakes and e-brake both work, and though the steering is still screwed up, it’s not as bad.
The car’s acceleration and braking are a lot quicker now too