QuirkyCort / gears

Generic Educational Robotics Simulator
Other
65 stars 41 forks source link

Custom Model physics #111

Closed mrfabroa closed 2 years ago

mrfabroa commented 2 years ago

When I include a custom model in my World (via github link), it appears that they physics options are not working. If I make something fixed, I can drive right through the object. If I make it movable, the object falls right through the World when the world loads.

Here is my world .json file. Did I do something wrong?

{
  "worldName": "custom",
  "options": {
    "imageURL": "textures/maps/custom.png",
    "groundType": "box",
    "length": 100,
    "width": 100,
    "uScale": 1,
    "vScale": 1,
    "imageScale": 1,
    "timer": "none",
    "timerDuration": 60,
    "timerEnd": "continue",
    "wall": true,
    "wallHeight": 7.7,
    "wallThickness": 4.5,
    "wallColor": "#1A1A1A",
    "groundFriction": 1,
    "wallFriction": 0.1,
    "groundRestitution": 0,
    "wallRestitution": 0.1,
    "restartAnimationOnRun": false,
    "objects": [
      {
        "type": "model",
        "position": [
          24.709303259750545,
          -2.6149013931727296,
          10.5
        ],
        "rotationMode": "degrees",
        "rotation": [
          0,
          0,
          0
        ],
        "animationMode": "none",
        "animationKeys": [],
        "size": [
          10,
          10,
          10
        ],
        "modelURL": "https://raw.githubusercontent.com/SACHSTech/tijcpt-gearsbothost-mr-fabroa-solo/main/Models/Chair.glb",
        "modelScale": 0.5,
        "modelAnimation": "None",
        "color": "#80E680",
        "imageType": "sphere",
        "imageURL": "",
        "uScale": 1,
        "vScale": 1,
        "physicsOptions": "fixed",
        "magnetic": false,
        "laserDetection": null,
        "ultrasonicDetection": null,
        "receiveShadows": false,
        "castShadows": true,
        "isPickable": true
      }
    ],
    "startPos": "center",
    "startPosXYZStr": "",
    "startRotStr": "",
    "startPosXYZ": null,
    "startRot": null,
    "arenaStartPosXYZ": null,
    "arenaStartRot": null
  }
}
QuirkyCort commented 2 years ago

It's a bug on my end. Should be fine now.

Recently, I had to make an urgent upgrade of the Babylon JS library from 4.1 to 4.2. This is because of a critical bug in 4.1 that caused severe rendering issue on the latest version of Chrome. Apparently, Babylon JS 4.2 has some differences in how it handled GLTF models and physics, and that resulted in the problem.