Hello all. I've seen many Questions about this, they all say it might get fixed in unity 3.
But no... It's not, not even in unity 4. And I'm searching good ol' google for solutions.
But to no avail. I can't find nothing, they all (that have them question/problem) talk about it being in unity 3. Well I'm in unity 4, and It still has problems :(
Now the problem is that when i move forward, It seems to slightly. Ever so slightly, drift to the left. And I'm not any way sure of how to fix said problem... And also the 'WheelCollider' setting the mass higher seems to make matters worse.
If anyone has Ideas to what can be done to fixed this. Let me know :) I'm in need of a proper functioning wheels for my racing game :) Thanks in Advanced!
↧
Question! Why does the 'WheelCollider' Component act funny?
↧
Car is moving backword with Up Arrow Key [Solved]
Hi EveryOne. I am facing a little problem here. My car is just moving reverse with Up Arrow key. And there is no issue in Input Manager. I have already checked that. And Code is also fine. Seems there is a problem with my car Physics. Anyone have any idea why this is happenning?
I have attached a screenshot of my project hierarchy too. ![![![alt text][1]][1]][1]
[1]: /storage/temp/33962-screenshot_1.png
↧
↧
Calculating degrees between object and raycast hit
Hey.
Im having some issues concerning my approach to this problem.
Here is the case:
I have a object (a car) this has wheel colliders. Now I want to control this car with rayCast (RTS Game) So when I select the car I and i click at a point at the map I would like it to go there steering with setting the steerangle to the calculation. I have got the car to move, but the calculation of the angle between the car and rayCast hit has got me stuck... Anybody any good ideas?
↧
WheelCollider.steerAngle match GameObject rotation
How would I get a GameObject to match the steerAngle of a wheel collider.
↧
Car speed physics problem, accelerates and turns out of controll
Hi for ease of explaining, I have made a video showing what I mean: https://www.youtube.com/watch?v=He1Id0Q3H7M
Basically, once I start playing the game, everything is fine, but after a few minutes the physics seems to get out of whack. What that means exactly I can't say except that when the car accelerates unusually fast, sometimes when I apply brake torque the car still accelerates! Sometimes it turns for no reason as well... the ground plane is completely flat, I have readouts that you can watch in the video, I have max torque and max steering angle you can watch as I play the scene and ultimately see an example of what I mean in the video linked above.
I have here a GIST of the CarControl.cs doing all the calculations for the car. https://gist.github.com/victorbstan/e5903829576eaf6ce5e3
↧
↧
C# WheelHit.force display wheel suspensions on meshes
I've been looking though alot of post and questions about wheel colliders and car scripts. But most examples are in JS. As well, I have not been able to find a valid up-to-date example of using C# and WheelHit.force to calculate how to move separate wheel meshes in order to mimmic suspensions of the wheel colliders. Is there an example out there? Thanks!
↧
Why Physics perfomance cost get huge when static geometry is added ?
Hi everybody!
I have a problem I can't solve using the Profiler.
Even if I did all the possible optimizations in Unity (texture atlas,batching,culling,lightmapping...), I think I have missed something because **Physics.Simulate still takes more than 30.0ms to be calculated, even if I only have 15 rigidbodies active each frame** (6 cars, 8NPCs, and the player).
**When I delete all the static geometry, Physics.Simulate takes only 3.0ms to be calculated** (my static geometry is a complex city, but there are no mesh colliders on the roads).
I don't understand **how geometry can have so much influence on Physics.Simulate ?** Am I missing something else ? What should I do ? (I am targeting mobile platforms, and because of this, my game only works on iPhone 5S and higher...)
Thank you for your help.
PS: if you want to see what the static geometry is like, here a preview of the game : https://www.youtube.com/watch?v=vOH0LxtQD-g&feature=youtu.be&t=29s
↧
Unity crashing on collision and editing wheel collider properties
Hi, I have created a test terrain for vehicles to use in a game, but whenever the car lands anywhere but the bottom it force closes with no warning, I've tried all the things I could to fix it, but was unable to do so. What are my options?
Also, how would I edit a wheel collider to add a bounce to it.
I don't want to sacrifice the mesh collider for a box collider as that will cause more issues for me in the future
↧
Anti-roll bar doesn't work
I'm making a racing game that has trucks as vehicles. For the truck movement, I'm using WheelColliders. After some testing, I found out that after a certain speed (~60km/h), turning made the truck flip to the side and hit the ground.
I found an Anti-Roll script and applied it to the truck, but the truck still flips but after a higher speed (~90km/h) and its physics seem a bit unstable.
Hhow can I prevent the truck from flipping like that? Here are the scripts I'm using:
Truck movement script:
using UnityEngine;
using UnityEngine.UI;
using System.Collections;
public class WheelTest : MonoBehaviour {
public WheelCollider WheelFL;
public WheelCollider WheelFR;
public WheelCollider WheelRL;
public WheelCollider WheelRR;
public Text txt;
public float speed;
public AudioSource EngineSound;
public GameObject COM;
public float steerMax = 8f;
public float motorMax = 30f;
public float brakeMax = 60f;
public float steer = 0f;
public float motor = 0f;
public float brake = 0f;
// Use this for initialization
void Start ()
{
COM.transform.position = rigidbody.centerOfMass;
}
void Update () {
int speedDisp = Mathf.RoundToInt(speed);
txt.text = speedDisp + "km/h";
EngineSound.volume = 0.5f + speed/50;
EngineSound.pitch = 0.75f + speed/75;
}
// Update is called once per frame
void FixedUpdate ()
{
steer = Mathf.Clamp(Input.GetAxis("Horizontal"), -1, 1);
motor = Mathf.Clamp(Input.GetAxis("Vertical"), 0, 1);
brake = Mathf.Clamp(Input.GetAxis("Vertical"), -1, 0) * -1;
speed = transform.InverseTransformDirection(rigidbody.velocity).z * 3.6f;
WheelRL.motorTorque = motorMax * motor;
WheelRR.motorTorque = motorMax * motor;
WheelRL.brakeTorque = brakeMax * brake;
WheelRR.brakeTorque = brakeMax * brake;
WheelFL.steerAngle = steerMax * steer;
WheelFR.steerAngle = steerMax * steer;
}
}
Anti-Roll Bar:
#pragma strict
var WheelL : WheelCollider;
var WheelR : WheelCollider;
var AntiRoll = 5000.0;
function FixedUpdate ()
{
var hit : WheelHit;
var travelL = 1.0;
var travelR = 1.0;
var groundedL = WheelL.GetGroundHit(hit);
if (groundedL)
travelL = (-WheelL.transform.InverseTransformPoint(hit.point).y - WheelL.radius) / WheelL.suspensionDistance;
var groundedR = WheelR.GetGroundHit(hit);
if (groundedR)
travelR = (-WheelR.transform.InverseTransformPoint(hit.point).y - WheelR.radius) / WheelR.suspensionDistance;
var antiRollForce = (travelL - travelR) * AntiRoll;
if (groundedL)
rigidbody.AddForceAtPosition(WheelL.transform.up * -antiRollForce,
WheelL.transform.position);
if (groundedR)
rigidbody.AddForceAtPosition(WheelR.transform.up * antiRollForce,
WheelR.transform.position);
}
↧
↧
When add joints to wheelcollider then it is not collide with other collider
When I add wheelcollider to empty game object and also add any joint then it is not collider with terrain collider . And I create car and wheel with sprite. Two wheels sprite and two empty game object with wheelcollider are Child of car sprite. And we can add hings joint to both wheels sprite child and in this case car stay on terrain collider .But when I am adding any joint to wheelcollider then the car is not stay on terrain collider . Anyone help !
Thanks in advance!
↧
Unity5 WheelCollider UI not showing????
Hello. I just been using Unity5 and the WheelCollider component gui is gone... any one know what happended???? thanks
↧
WheelCollider is weirdly affected by Solver iteration count
I wanted to see how changing the solver iteration count (SIC form here-on-in), only for it to make the wheel collider I'm using for the wheels of my vehicle to overly react to the same amount of torque. Specifically, higher iteration count makes the wheels go faster.
public WheelCollider[] WheelColliders;
void FixedUpdate()
{
SetWheelTorqueForward( inputM.GetAxis("Vertical") * enginePower * Time.fixedDeltaTime );
}
void SetWheelTorqueForward(float f)
{
foreach( WheelCollider wc in WheelColliders )
wc.motorTorque = f;
}
I am asking which of the following is true:
Am I misusing the torque on the WheelCollider?
Am I misinterpreting the SIC, because from my understanding it should not make the vehicle faster and this is actually WAD?
Is this a bug concerning the WheelCollider when changing SIC (since it can be generally assumed the SIC stays unchanged in-game)?
↧
WheelCollider Bug in Unity 5?
Hi,
I tried to make a wheelcollider attached to "A" Gameobject. "A" gameobject's scale is 1, 1, 1. I've added Rigidbody component to A gameobject. Then created empty new gameobject. Attached WheelCollider component to this new gameobject and parented to "A" gameobject. Now, if you rotate your WheelCollider object, object's scale is changing by one direction. Also if you change wheelcollider's position, "Force App Point Distance" will not move correctly. Also adding basic torque to the wheels are not behaving realistic. Is there any documentation for Unity 5 WheelColliders?
↧
↧
Unity 5 GameObject SetActive Bug with WheelCollider
So here we go again. Another Unity 5 bug.
1 - Deactivate wheelcollider attached to your vehicle.
2 - Deactivate main vehicle gameobject.
3 - Activate main gameobject.
Tadaa, disabled wheelcolliders is still there. And editor says they are disabled currently.
4 - Deactivate main gameobject, Unity crashes...
↧
unity 5 wheel collider problem
hello everybody!ı m use unity 5.ı add wheel collider in the game object but ı dont see wheel collider .I radius the size but does not appear![alt text][1]
[1]: /storage/temp/41983-adsız.jpg
↧
Bicycle Functionality using wheel coliders
how do i get the functioning of a bicycle like when the bicycle's speed is slow then it must be harder to balance the bicycle and cyclist falls off the cycle. I am using wheel collider for the tires. Is there any property in wheel collider through which it can be achieved. Any good tutorial or articles would be great.
Thank you
↧
[unity 5]WheelCollider positioning problem
Hi,
First, sorry for my english, i'm french.
I have a problem with wheelcollider about it's position.
I create a Cube with rigidbody, and after i create an empty object with wheelcollider.
Whan i try to move the wheelcollider to put it to it's good place, the circle which represents the wheelcollider don't totally follow the gizmo and mass center. To resume, gizmo, mass center and the stripe which represents the suspension move faster than the wheelcollider in the editor.
I give you an image to representes my problem :
![alt text][1]
[1]: /storage/temp/42591-bug-unity.png
Can you help me please :)
Thanks
↧
↧
Unity 5 wheel collider issue (incredible force generated by suspension regardless of spring or damper values)
Our motorcycle is using 2 wheel colliders. Whenever the bike comes down hard on its back tire, the back tire is launched into the air (see the two videos below).
https://www.youtube.com/watch?v=IeiMuzK0Otg
https://www.youtube.com/watch?v=gtu7pIQerks
I would expect this to happen if the rear wheel collider's suspension had a high spring value, but this happens regardless of the suspension's spring or spring damper values. We've tried combinations of spring and damper values from 5-500,000 and we get the same result regardless.
The only thing that seems to affect this crazy upward suspension force is the rpm of the rear wheel, but without a high rpm, the bikes couldn't move quickly, so that doesn't help much.
PLEASE HELP ME!!! THIS WASN'T AN ISSUE IN UNITY 4!!!!
↧
Unity 5 Wheel Colliders
I know that Unity 5 Wheel Colliders are much good than old Wheel Colliders, but much more unstable than old Wheel Colliders too.
If your main rigidbody size is not equal to 1, 1, 1, your wheel colliders will be placed at wrong places.
If your vehicle's collider is mesh collider, your wheel colliders will be crooked sometimes.
Unity's documentation about wheel colliders are outdated (Still).
Wheels will slip at the beginning of applying torque (Sometimes).
WheelColliders get stucked when vehicle speed is 0. Just apply angular force by AddRelativeTorque to the vehicle while speed at 0 (Sometimes).
Default wheel collider settings are fine, but you have to be careful about mass value. E.g. if your vehicle mass is 1500, then your wheelcolliders mass must be at 100 - 150. Otherwise, wheel will bornout and will reach over rpms.
Is there a any detailed information about new wheel colliders?
Thanks
↧
Setting Rigidbody Velocity for Jump Unity 5
Hi,
I have a basic vehicle with a rigidbody and four wheelcolliders. I want the vehicle to jump and I have always been setting the 'up' velocity directly to make the jump predictable. This has always worked in Unity 4, but since upgrading if you keep jumping in rapid succession the jump is very unstable. I have been outputting the rigidbody velocity to console after the jump and I am not getting the result I have set it too. Does anyone have any ideas what has changed in version 5 to cause this? I susspect it might have something to do with the wheelcolliders. I'm struggling to get them to perform the same as unity 4.
Thanks
Here is the jump code.
public void Jump(float jumpForce, bool isChangingLanes = false)
{
if (!IsGrounded())
return;
if (!IsHandcarOnJumpableSurface())
return;
_isGoingToJump = true;
_isChangingLanes = isChangingLanes;
var velocity = _rigidbody.velocity;
Debug.Log(string.Format("Pre Jump Velocity: {0}", _transform.InverseTransformDirection(velocity)));
PrepareHandcarForJump(velocity);
velocity += Vector3.up * jumpForce;
_rigidbody.velocity = velocity;
Debug.Log(string.Format("Post Jump Velocity: {0}", _transform.InverseTransformDirection(_rigidbody.velocity)));
}
private void PrepareHandcarForJump(Vector3 velocity)
{
velocity.y = 0;
var rotation = _transform.rotation.eulerAngles;
_transform.rotation = Quaternion.Euler(new Vector3(0f, rotation.y, 0f));
_rigidbody.angularVelocity = Vector3.zero;
}
↧