Problem with rotation of collider and child colliders [Long]

I am using Unity 2.6 Pro, but I think this is an issue that appears on all versions.

The problem occurs while using a somewhat complex game object (wheeled vehicle) that contains two scaled/translated box colliders to represent part of its body. It seems as if when the vehicle moves, and in particular turns, the box colliders that represent its body do not rotate properly with respect to another game object collider that has been attached to the vehicle through a script.

Let me explain the setup a bit more. I have a vehicle that uses wheel colliders to move around. It is a ‘straddle carrier’ used in container port operations. The vehicle can drive over a container box and pick it up. A picture of it is shown in the first attachment (this is a simplified version to demonstrate the problem). I am using two box colliders (also shown in 1st attachment) to represent the body of the vehicle - these are the colliders on the left and right side of it.

The flat floating box in the middle of the vehicle is meant to represent a grabber, it used to grab objects laying on the ground - think of it as a magnet of sorts - and it is part of the vehicle. I have written a script to drive the vehicle with torque/steer/brake on the wheel colliders and also move the grabber up and down. So far so good.

The grabber has two small colliders tagged as ‘Trigger’, one on the front of it and one on the back of the grabber. When the grabber is placed on top of a box laying on the ground, both colliders send events indicating it is lined up and can be picked up. The box on the ground has a collider and rigid body. The ‘pick-up’ is done by first setting the rigidbody of the box to ‘Kinematic’, then parenting it to the grabber game object, which itself is a child of the overall vehicle.

So far so good. After grabbing the object, I can raise/lower the grabber and the box is now attached to the grabber and goes up/down with the grabber.

The problem occurs when driving the vehicle with the object attached, in particular when the vehicle turns, while the box is raised enough to be at the same height with the colliders on the side of the vehicle; depending on the speed, the vehicle will either stop (if slow) or jump/fly uncontrollably (if going fast). I am pretty sure that what is happening is that either the collider of newly attached box or the side colliders do not rotate properly and the carried box is forced into the side colliders creating the failure. I can confirm this because if I raise the box above the level of the colliders, I can drive around with no problem, but if the box is at an elevation that overlaps the side colliders, the problem occurs when the vehicle turns more than 20-30 degrees from the original orientation.

Also, if I raise the box and turn, then try to lower the box, the vehicle does crazy things as the box is lowered to the level of the side colliders.

The vehicle game object structure is like this
Vehicle
…GO_Body
…geometry meshes here
…GO_ColliderHolder
…GO_Left ← this contains the left collider
…GO_Right ← this contains the right collider
…GO_
…GO_CatchColliders
…GO_FrontCatch ← this contains the front
…GO_RearCatch ← this contains the rear trigger

When the external box is picked up, it is made a child of GO_GrabberNode - the Inspector confirms that the box shows up under the GO_GrabberNode with its rigidbody set to kinematic.

We have tried numerous permutation so see if the problem can be solved - the baseline has all the GO_ with a transform of (0,0,0) and using the collider scaling/rotation to place them where they belong. We also tried to have the colliders set to unity and use the parent game object to scale place them - result is always the same.

Any suggestions would be appreciated - the second attachment is the script(s) used; If necessary, I can put the whole thing on a web site, although it is pretty rought, as it is meant to demonstrate the problem.

I can think of various ways to avoid the problem by eliminating the colliders but I am looking for a solution that addresses the problem, not bypasses it.

253319–9115–$driveveh_161.js (2.14 KB)
253319--9116--$q_p1_168.jpg

bump.

Unity, I have submitted a bug report as well and have been patiently waiting for almost two months. Now with Unity3 coming out and a new physics engine, I am really interested if any of these issues would be affected.

A wheel collider will tend to jump suddenly if it comes abruptly into contact with another collider. One way to fix this might be to place colliders (spheres, say) around the wheel colliders, but set the objects’ layer to Ignore Raycast. This should ensure other colliders don’t impinge on the wheel rays.

Andeee - thanks for the followup but I am 99.99% certain that this is not the problem. As the message explains, the ‘body’ colliders hit the collider that is attached dynamically; the wheel colliders have nothing to do with it.

Since posting this, i have run into exactly the same problem in several other cases, some of which don’t even include wheel colliders.

Problem still persists…

try turning off the collisions on the picked up object once it has been picked up.

try turning off the collisions on the picked up object once it has been picked up.

try turning off the collisions on the picked up object once it has been picked up.