- Home /
wheel script raycast
Hello..
I'm using the wheel script from the Unity Car tutorial. when I build the game the car wont move. it says "Scene::raycastClosestShape: The maximum distance must be greater than zero!"
than I clicked the error and it says the problem is in the Wheel.cs in line 268
here is the line 286 from the Wheel script
bool onGround = Physics.Raycast( pos, -up, out hit, suspensionTravel + radius);
does anyone know how to fix this.
Thank you
this problem came to me with Unity 4.0 don't know why
I expect that '`suspensionTravel + radius`' is less than or equal to 0.0. $$anonymous$$ake sure that radius is positive number. If the variable is public, make sure to check the value in the inspector. if 'suspensionTravel' can be a negative value make sure it cannot be greater than radius. Note the problem might have been there in Unity 3.x and just not detected.
thx for response Robertbu! :) yea its a really good idea, as a red what you said I thought that this was my problem. but still not,,, I checked if the SuspensionTravel is higher then Radius but it was not, the suspensionTravel value was smaller then the Radius. don't know still...
Answer by thieum · Oct 22, 2013 at 05:17 PM
I've just read another post on the same topic and apparently you have to remove one of the two "wheel" scripts from your folder: one is js and the other is c#. Conflict lies there with 4.x.
thx for quick Response Thieum!! :)
yes I wish that would be the case with me too,,, I checked all the scripts and I have only 1,,, don't know yet what else the problem could be.
Well, I use this script series a lot, but still with Unity 3.5 I improved it in different aspects, but I can't get how the Pacelka tire calcultation is made. I also comment out this little block in the FixedUpdate:
if (onGround && hit.collider.isTrigger)
{
Since you can now decide if raycast detect triggers from general settings. If you want to check my own use: link text
yea I don't get were in the script RayCastHit goes wrong,,, I even tryed it with adding wheelCollider to it but that only keeps the cars wheels from sinking into the terrain,,, Nice game btw! love the scene! ;)
Your answer
Follow this Question
Related Questions
Get RaycastHit Local Coords (C#) 1 Answer
How to place an object in the direction of a raycast 1 Answer
Click to move script help 1 Answer