Experiment Config JSON - GameLabGraz/Maroon GitHub Wiki
An experiment config for some supported experiments can be stored as a JSON string. You can create your own JSON experiment configurations e.g. to send them to be loaded in a WebGL build of Maroon.
The configurations for different experiments might differ from each other significantly. Each JSON config should start with the appropriate $type
field to allow Unity to parse the JSON correctly, e.g.
"$type": "Maroon.Physics.Optics.Manager.OpticsParameters, Maroon.Experiments.OpticsSimulations, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null",
Otherwise, you can omit optional fields. Below you can find documentation on how to assemble a JSON config string yourself and where to find examples.
3D Motion Simulation
The 3D Motion Simulation experiment configuration allows you to choose one of the predefined backgrounds, change the function parameters, DeltaT, etc.
Example:
{
"$type": "Maroon.Physics.ThreeDimensionalMotion.ThreeDimensionalMotionParameters, Maroon.Experiments.3DMotionSimulation, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null",
"Background" : "ExperimentRoom",
"Particle" : "Particle",
"FX" : "-x",
"FY" : "0",
"FZ" : "0",
"M" : "1",
"T0" : "0",
"DeltaT" : "0.05",
"Steps" : "500",
"X" : "0",
"Y" : "0",
"Z" : "0",
"Vx" : "1",
"Vy" : "0",
"Vz" : "0"
}
Further examples for the 3D Motion Simulation configurations can be found in the .json files here: https://github.com/GameLabGraz/Maroon/tree/develop/unity/Assets/StreamingAssets/Config/3DMotionSimulation.
Optics
The Optics simulation experiment configuration allows you to change the ray thickness, the camera presets, and add so-called table objects such as light sources, apertures, lenses, etc. Beware that these table objects have many parameters, thus the configuration string might become quite long.
Example:
{
"$type": "Maroon.Physics.Optics.Manager.OpticsParameters, Maroon.Experiments.OpticsSimulations, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null",
"presetNameTranslationKey": "Focal Length",
"rayThickness": 1.2,
"cameraSettingBaseView": {
"$type": "Maroon.Physics.Optics.Camera.CameraSetting, Maroon.Experiments.OpticsSimulations, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null",
"Position": {
"$type": "Maroon.Utils.SerializableVector3, Maroon.ReusableScripts.Utils, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null",
"x": -0.065,
"y": 2.6,
"z": 1.0
},
"RotationQuaternion": {
"$type": "Maroon.Utils.SerializableQuaternion, Maroon.ReusableScripts.Utils, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null",
"x": 0.4422887,
"y": 0.0,
"z": 0.0,
"w": 0.896872759
},
"Rotation": {
"$type": "Maroon.Utils.SerializableVector3, Maroon.ReusableScripts.Utils, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null",
"x": 52.5000038,
"y": 0.0,
"z": 0.0
},
"FOV": 36.0
},
"cameraSettingTopView": {
"$type": "Maroon.Physics.Optics.Camera.CameraSetting, Maroon.Experiments.OpticsSimulations, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null",
"Position": {
"$type": "Maroon.Utils.SerializableVector3, Maroon.ReusableScripts.Utils, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null",
"x": -0.06,
"y": 3.0,
"z": 2.1
},
"RotationQuaternion": {
"$type": "Maroon.Utils.SerializableQuaternion, Maroon.ReusableScripts.Utils, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null",
"x": 0.707106769,
"y": 0.0,
"z": 0.0,
"w": 0.707106769
},
"Rotation": {
"$type": "Maroon.Utils.SerializableVector3, Maroon.ReusableScripts.Utils, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null",
"x": 90.0,
"y": 0.0,
"z": 0.0
},
"FOV": 36.0
},
"tableObjectParameters": {
"$type": "System.Collections.Generic.List`1[Maroon.Physics.Optics.TableObject.TableObjectParameters, Maroon.Experiments.OpticsSimulations, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null](/GameLabGraz/Maroon/wiki/Maroon.Physics.Optics.TableObject.TableObjectParameters,-Maroon.Experiments.OpticsSimulations,-Version=0.0.0.0,-Culture=neutral,-PublicKeyToken=null), mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089",
"$values": [
{
"$type": "Maroon.Physics.Optics.TableObject.LightComponent.ParallelSourceParameters, Maroon.Experiments.OpticsSimulations, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null",
"numberOfRays": 16,
"distanceBetweenRays": 0.0038,
"waveLengths": null,
"position": {
"$type": "Maroon.Utils.SerializableVector3, Maroon.ReusableScripts.Utils, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null",
"x": 1.2,
"y": 0.0,
"z": 0.62
},
"rotation": null
},
{
"$type": "Maroon.Physics.Optics.TableObject.OpticalComponent.LensParameters, Maroon.Experiments.OpticsSimulations, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null",
"R1": 0.15,
"R2": -0.15,
"d1": 0.0145,
"d2": 0.0145,
"Rc": 0.065,
"A": 1.728,
"B": 13420.0,
"position": {
"$type": "Maroon.Utils.SerializableVector3, Maroon.ReusableScripts.Utils, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null",
"x": 1.7,
"y": 0.0,
"z": 0.62
},
"rotation": null
}
]
}
}
Note that for the rotations you can either pass a Quaternion value via RotationQuaternion
, or you can pass Euler angles (unit vector) rotation via Rotation
. If both are passed, the quaternion value will be used.
Further examples for the Optics configurations can be found in the .json files here: https://github.com/GameLabGraz/Maroon/tree/develop/unity/Assets/Maroon/scenes/experiments/OpticsSimulations/Resources/Presets.