Search Unity

Question CarController - GravityScale(?),FBX(?),

Discussion in 'Physics' started by Kriovulkan, Nov 13, 2023.

  1. Kriovulkan

    Kriovulkan

    Joined:
    Aug 24, 2023
    Posts:
    6
    Hello =)

    I am trying to make a car game.
    The code actually seems to work fine, don´t get any errors from the console, but my car falls incredibly slowly, and also driving goes very slow.

    I watched some other videos, and tried to change objectMass, objectScale, and gravityScale. Ingreasing the last one helped for the falling issue, but driving is still very slow. I guess it has to do with some physic settings, or with the exported FBX i made for the car (I made my own car in Blender).


    Does someone have any suggestion?
    Thank you
     
  2. codebiscuits

    codebiscuits

    Joined:
    Jun 16, 2020
    Posts:
    91
    Is your car a similar size to a real-world car? E.g., compare to a GameObject>3D Object>Cube.
    Does it have a similar mass to a real-world car?
    I'm not sure you can use the Transform.localScale of an object with a Rigidbody on it without it affecting the physics (should be OK to change the scale of a child object that just has a mesh in it). Maybe you can, I can't remember, sorry:) I just, don't, all of my Rigidbody components have scale of 1,1,1:)
    If all of the sizes and masses are correct, I don't think you should need to do anything with gravityScale, everything should behave nicely with default physics settings.
     
  3. Kriovulkan

    Kriovulkan

    Joined:
    Aug 24, 2023
    Posts:
    6
    hi, so I noticed right now a very strange thing: the scale of the child objects of my rigidbody component have a huge scale value. I exported them as an FBX from Blender. Maybe that´s the problem. I will check if I can re-export them in another way, and let you knoe. Thank you
     

    Attached Files:

  4. codebiscuits

    codebiscuits

    Joined:
    Jun 16, 2020
    Posts:
    91
    Exporting from Blender is a nightmare:)
    There's maybe an elegant way to do it without add-ons now, but I've been using this for ages:
    https://github.com/EdyJ/blender-to-unity-fbx-exporter/
    It fixes all the scale and rotation issues exporting from Blender to Unity.
    I'm not sure if you end up with tiny rotations here and there: I usually do work on my .blend file, then export to fbx (so I'm not round-tripping it); not sure if this is necessary.
    I don't know how familiar you are with Blender, so apologies if you eat and breathe Blender (I'm barely competent with it) I usually apply the scales (and rotations where appropriate) so everything kindof is what it is (Object>Apply... menu in Blender).
     
  5. Kriovulkan

    Kriovulkan

    Joined:
    Aug 24, 2023
    Posts:
    6
    i like blender, and got pretty much used to model stuff with it;) but I am also not an expert, I just use it
    I exported everything again and it is now scaled at 2.5 by Unity-default. It is a little bit better but still going very slow.
    Thank you for the link:)