Example scene for RigidBodyPhysics component, runnable as Xj3D application and invoked using shell script runogl
Test scene includes custom Xj3D components and elements, will not validate
Test scene under development, runogl fails http://bugzilla.xj3d.org/show_bug.cgi?id=556
X3D-Edit 3.3, https://www.web3d.org/x3d/tools/X3D-Edit
"originals/car/textures/wall-stone-001.jpg" "https://www.web3d.org/x3d/content/examples/Basic/RigidBodyPhysics/originals/car/textures/wall-stone-001.jpg"
ecmascript: function sector1(val) { if (val) { Browser.println('Physics Sector1'); sector1Enabled = true; sector2Enabled = true; sector3Enabled = false; sector4Enabled = false; sector5Enabled = false; sector6Enabled = false; sector7Enabled = false; sector8Enabled = false; sector9Enabled = false; } } function sector2(val) { if (val) { Browser.println('Physics Sector2'); sector1Enabled = true; sector2Enabled = true; sector3Enabled = true; sector4Enabled = false; sector5Enabled = false; sector6Enabled = false; sector7Enabled = false; sector8Enabled = false; sector9Enabled = false; } } function sector3(val) { if (val) { Browser.println('Physics Sector3'); sector1Enabled = false; sector2Enabled = true; sector3Enabled = true; sector4Enabled = true; sector5Enabled = false; sector6Enabled = false; sector7Enabled = false; sector8Enabled = false; sector9Enabled = false; } } function sector4(val) { if (val) { Browser.println('Physics Sector4'); sector1Enabled = false; sector2Enabled = false; sector3Enabled = true; sector4Enabled = true; sector5Enabled = true; sector6Enabled = false; sector7Enabled = false; sector8Enabled = false; sector9Enabled = false; } } function sector5(val) { if (val) { Browser.println('Physics Sector5'); sector1Enabled = false; sector2Enabled = false; sector3Enabled = false; sector4Enabled = true; sector5Enabled = true; sector6Enabled = true; sector7Enabled = false; sector8Enabled = false; sector9Enabled = false; } } function sector6(val) { if (val) { Browser.println('Physics Sector6'); sector1Enabled = false; sector2Enabled = false; sector3Enabled = false; sector4Enabled = false; sector5Enabled = true; sector6Enabled = true; sector7Enabled = true; sector8Enabled = false; sector9Enabled = false; } } function sector7(val) { if (val) { Browser.println('Physics Sector7'); sector1Enabled = false; sector2Enabled = false; sector3Enabled = false; sector4Enabled = false; sector5Enabled = false; sector6Enabled = true; sector7Enabled = true; sector8Enabled = true; sector9Enabled = false; } } function sector8(val) { if (val) { Browser.println('Physics Sector8'); sector1Enabled = false; sector2Enabled = false; sector3Enabled = false; sector4Enabled = false; sector5Enabled = false; sector6Enabled = false; sector7Enabled = true; sector8Enabled = true; sector9Enabled = true; } } function sector9(val) { if (val) { Browser.println('Physics Sector9'); sector1Enabled = true; sector2Enabled = false; sector3Enabled = false; sector4Enabled = false; sector5Enabled = false; sector6Enabled = false; sector7Enabled = false; sector8Enabled = true; sector9Enabled = true; } } function sector9(val) { if (val) { Browser.println('Physics Sector9'); sector1Enabled = true; sector2Enabled = false; sector3Enabled = false; sector4Enabled = false; sector5Enabled = false; sector6Enabled = false; sector7Enabled = false; sector8Enabled = true; sector9Enabled = true; } }
"originals/car/CarControlScript.class" "https://www.web3d.org/x3d/content/examples/Basic/RigidBodyPhysics/originals/car/CarControlScript.class"
ecmascript: var accelVar = 0; var dirVar = 0; var accelFactor = 0.1; var dirFactor = 0.5; var decayVar = 0.1; var applyDecay = false; function decay(val) { if (!applyDecay) return; if (dir >= decayVar) { dir = dir - decayVar; if (dir < -1) dir = -1; } else if (dir <= -decayVar) { dir = dir + decayVar; if (dir > 1) dir = 1; } else { dir = 0; applyDecay = false; } } function actionKeyPress(val) { applyDecay = true; if (val == 17) { accelVar = accelVar + accelFactor; if (accelVar > 1) accelVar = 1.0; accel = accelVar; } else if (val == 18) { accelVar = accelVar - accelFactor; if (accelVar < -1) accelVar = -1.0; accel = accelVar; } else if (val == 19) { dirVar = dirVar - dirFactor; if (dirVar < -1) dirVar = -1.0; dir = dirVar; } else if (val == 20) { dirVar = dirVar + dirFactor; if (dirVar > 1) dirVar = 1.0; dir = dirVar; } else { dir = 0; accel = 0; } }
ecmascript: function brakesApplied(val) { if(val) brakeLightColor.r = 1; else brakeLightColor.r = 0.1; } function reversing(val) { if(val) { reverseLightColor.r = 1; reverseLightColor.g = 1; reverseLightColor.b = 1; } else { reverseLightColor.r = 0.1; reverseLightColor.g = 0.1; reverseLightColor.b = 0.1; } } function speed(val) { speedScale.x = 1; speedScale.y = val / maxSpeed; speedScale.z = 1; speedFraction = val / maxSpeed; }
"originals/car/CameraControl.class" "https://www.web3d.org/x3d/content/examples/Basic/RigidBodyPhysics/originals/car/CameraControl.class"