0
Unity Bug

Issue of WheelCollider flying.

ohbado 3 years ago updated by Lazlo Bonin (Lead Developer) 2 years ago 13

Hello.
I found a mysterious movement of Chronos at Unity 2017.1.
If you control a car with WheelCollider with Chronos, the car will fly in the sky.

You can confirm by the following procedure.

1. Set up a car with WheelCollider, Rigidbody, BoxCollider (car body) set on Unity 2017.1.
2. Set the Chronos Timeline in the car.
3. Slow down car time with Chronos (eg 0.1).

I think that Chronos is not responsive to the upward force of WheelCollider's suspension.
Can you present a solution?

Chronos Version:
2.4.11
Unity Version:
2017.1

I uploaded a video.
I can also upload the reproduction project.
Now you can check the magical movement of the car.
I am waiting for your early reply!

https://www.dropbox.com/s/1zx9lak3s9qgjqp/ChronosBug.mp4?dl=0

Pending Review

Hm, it seems you're right, the suspension force doesn't appear to be scaled down like other forces. 

Looking into the component integration for this collider, I see that it's powered by a JointSpring. Supporting joints has been a long standing feature request, but it's very complex. I think I can fix this issue without implementing joints, but I'll have to look into it.

Thanks for the reply.
I understood that the task is complicated. But I believe that you can cope with your technical skills.
Chronos will be a better asset.

+1
Fixed (Unreleased)

Hi ohbado,

I've included the base system for affecting wheel colliders in the next version of Chronos.

However, I can't figure out the math. There is too little documentation on how the suspension springs actually affect the physics of the wheel for me to figure out how to scale them using the time scale.

If you want to try to figure it out, the next version will include a file called Source/Timelines/WheelColliderTimeline.cs. In this file, you will find the following lines commented out at the end:

//suspensionSpring.spring = spring * timeScale;
//suspensionSpring.damper = damper * timeScale;
//suspensionSpring.targetPosition = targetPosition * timeScale;

You can uncomment them to have the time scale affect these parameters. If you ever figure out the right combination of math operations (which parameters to affect, multiply or divide, etc.), please let me know so I can include it in the official version.

I use the following script for testing the exact bounce, and apply it to two cars: one at normal time scale, and one slowed down. In theory, the slowed down car should have the exact same max Y as the normal one, which would mean the math is right.

using UnityEngine;
public class TestCar : MonoBehaviour
{
    private float maxY;
    private bool bounced;
    
    void OnTriggerEnter(Collider other)
    {
        bounced = true;
    }
    void Update ()
    {
        if (bounced && transform.position.y > maxY)
        {
            maxY = transform.position.y;
        }
        if (Input.GetKeyDown(KeyCode.Space))
        {
            Debug.Log(name + ": " + maxY + "\n");
        }
    }
}

Thanks for the reply.

I appreciate your quick fix.
I will try it as soon as the next version is released.
I will report it if I find a problem.
Thank you.


Hi.

I installed Chronos 2.4.12.
However, it seems that the this issue is not solved.

Please watch the video below.

https://www.dropbox.com/s/8m4b52ryuxn14wd/ChronosBug2.mp4?dl=0

Can you present a solution?

Hi ohbado,

Please re-read my last comment. I have created the base architecture for it, but I cannot figure out the proper math. I told you where in the source you can play with the calculations to try to figure a decent solution for your game though.

Thank you for the reply.

I understood as follows.
You prepared only the interface for Chronos to support WheelCollider.
I need to make code by myself using that interface.
Is this correct?

OK.

I understood that, but it felt a non-perfect answer for Chronos.


I found a mathematical expression on the NVIDIA site.

http://docs.nvidia.com/gameworks/content/gameworkslibrary/physx/guide/Manual/Vehicles.html


Unity Physics is the same as PhysX as you know.
You will be able to perfectly support WheelCollider in Chronos.
Is it possible for you?

Unfortunately, even with this documentation page, there is no clear information how time would affect the provided parameters in Unity. I would need help from either a Unity developer or a physicist to know exactly.

I know it's a non-perfect answer, but it's honestly the best I can do for now!