mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-01-06 03:29:44 -06:00
FixedRotation that depends on other nodes now updates correctly even if time is paused (#2069)
* Update fixed rotation every frame if it depends on another sgn (closes #1751) This guards against any weird edge cases, where a node the rotation depends on is moved independently of simulation time * Fix faulty indentation
This commit is contained in:
@@ -41,36 +41,36 @@ local initializeAndAddNodes = function()
|
||||
},
|
||||
Tag = { "earth_satellite", "ISS" },
|
||||
GUI = {
|
||||
Path = "/Solar System/Planets/Earth/Satellites/ISS"
|
||||
Path = "/Solar System/Planets/Earth/Satellites/ISS"
|
||||
}
|
||||
}
|
||||
|
||||
local parentNode = {
|
||||
Identifier = "ISSModel",
|
||||
Parent = iss.Identifier,
|
||||
Transform = {
|
||||
Rotation = {
|
||||
Type = "FixedRotation",
|
||||
Attached = "ISSModel",
|
||||
XAxis = { 0.01, -1.0, 0.56 },
|
||||
XAxisOrthogonal = true,
|
||||
YAxis = transforms.EarthInertial.Identifier
|
||||
}
|
||||
},
|
||||
Renderable = {
|
||||
Type = "RenderableModel",
|
||||
GeometryFile = models .. "ISS.fbx",
|
||||
ModelScale = "Centimeter",
|
||||
LightSources = {
|
||||
sun.LightSource
|
||||
},
|
||||
PerformShading = true,
|
||||
DisableFaceCulling = true
|
||||
},
|
||||
GUI = {
|
||||
Name = "ISS Model",
|
||||
Path = "/Solar System/Planets/Earth/Satellites/ISS"
|
||||
Identifier = "ISSModel",
|
||||
Parent = iss.Identifier,
|
||||
Transform = {
|
||||
Rotation = {
|
||||
Type = "FixedRotation",
|
||||
Attached = "ISSModel",
|
||||
XAxis = { 0.01, -1.0, 0.56 },
|
||||
XAxisOrthogonal = true,
|
||||
YAxis = transforms.EarthInertial.Identifier
|
||||
}
|
||||
},
|
||||
Renderable = {
|
||||
Type = "RenderableModel",
|
||||
GeometryFile = models .. "ISS.fbx",
|
||||
ModelScale = "Centimeter",
|
||||
LightSources = {
|
||||
sun.LightSource
|
||||
},
|
||||
PerformShading = true,
|
||||
DisableFaceCulling = true
|
||||
},
|
||||
GUI = {
|
||||
Name = "ISS Model",
|
||||
Path = "/Solar System/Planets/Earth/Satellites/ISS"
|
||||
}
|
||||
}
|
||||
|
||||
local issTrail = {
|
||||
|
||||
@@ -485,6 +485,20 @@ bool FixedRotation::initialize() {
|
||||
return res;
|
||||
}
|
||||
|
||||
void FixedRotation::update(const UpdateData& data) {
|
||||
bool anyAxisIsObjectType = (
|
||||
_xAxis.type == Axis::Type::Object ||
|
||||
_yAxis.type == Axis::Type::Object ||
|
||||
_zAxis.type == Axis::Type::Object
|
||||
);
|
||||
|
||||
if (_attachedNode || anyAxisIsObjectType) {
|
||||
requireUpdate();
|
||||
}
|
||||
|
||||
Rotation::update(data);
|
||||
}
|
||||
|
||||
glm::dmat3 FixedRotation::matrix(const UpdateData&) const {
|
||||
if (!_enabled) {
|
||||
return glm::dmat3();
|
||||
|
||||
@@ -47,6 +47,7 @@ public:
|
||||
|
||||
static documentation::Documentation Documentation();
|
||||
|
||||
void update(const UpdateData& data) override;
|
||||
glm::dmat3 matrix(const UpdateData& data) const override;
|
||||
|
||||
private:
|
||||
|
||||
Reference in New Issue
Block a user