Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
小 白蛋
OpenSpace
Commits
fc27806a
Unverified
Commit
fc27806a
authored
2 years ago
by
Malin E
Committed by
GitHub
2 years ago
Browse files
Options
Download
Plain Diff
Merge pull request #2214 from OpenSpace/issue/2194
Update the Ipac example asset
parents
3cf80e0f
bf0e2c32
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
data/assets/util/ipac.asset
+172
-27
data/assets/util/ipac.asset
with
172 additions
and
27 deletions
+172
-27
data/assets/util/ipac.asset
+
172
-
27
View file @
fc27806a
local orbit_right = {
Identifier = "ipac.orbit_right",
Name = "Orbit right",
Command = [[ openspace.navigation.addGlobalRotation(-5.0, 0.0) ]],
Documentation = "Orbits the camera to the right around the current focus",
GuiPath = "/Ipac",
IsLocal = false
}
asset.export("IpacOrbitRight", orbit_right)
local orbit_left = {
Identifier = "ipac.orbit_left",
Name = "Orbit left",
Command = [[ openspace.navigation.addGlobalRotation(5.0, 0.0) ]],
Documentation = "Orbits the camera to the left around the current focus",
GuiPath = "/Ipac",
IsLocal = false
}
asset.export("IpacOrbitLeft", orbit_left)
local orbit_up = {
Identifier = "ipac.orbit_up",
Name = "Orbit up",
Command = [[ openspace.navigation.addGlobalRotation(0.0, 5.0) ]],
Documentation = "Orbits the camera up around the current focus",
GuiPath = "/Ipac",
IsLocal = false
}
asset.export("IpacOrbitUp", orbit_up)
local orbit_down = {
Identifier = "ipac.orbit_down",
Name = "Orbit down",
Command = [[ openspace.navigation.addGlobalRotation(0.0, -5.0) ]],
Documentation = "Orbits the camera down around the current focus",
GuiPath = "/Ipac",
IsLocal = false
}
asset.export("IpacOrbitDown", orbit_down)
local pan_right = {
Identifier = "ipac.pan_right",
Name = "Pan right",
Command = [[ openspace.navigation.addLocalRotation(-5.0, 0.0) ]],
Documentation = "Pans the camera to the right",
GuiPath = "/Ipac",
IsLocal = false
}
asset.export("IpacPanRight", pan_right)
local pan_left = {
Identifier = "ipac.pan_left",
Name = "Pan left",
Command = [[ openspace.navigation.addLocalRotation(5.0, 0.0) ]],
Documentation = "Pans the camera to the left",
GuiPath = "/Ipac",
IsLocal = false
}
asset.export("IpacPanLeft", pan_left)
local pan_up = {
Identifier = "ipac.pan_up",
Name = "Pan up",
Command = [[ openspace.navigation.addLocalRotation(0.0, 5.0) ]],
Documentation = "Pans the camera up",
GuiPath = "/Ipac",
IsLocal = false
}
asset.export("IpacPanUp", pan_up)
local pan_down = {
Identifier = "ipac.pan_down",
Name = "Pan down",
Command = [[ openspace.navigation.addLocalRotation(0.0, -5.0) ]],
Documentation = "Pans the camera down",
GuiPath = "/Ipac",
IsLocal = false
}
asset.export("IpacPanDown", pan_down)
local zoom_in = {
Identifier = "ipac.zoom_in",
Name = "Zoom in",
Command = [[ openspace.navigation.addTruckMovement(0.0, 5.0) ]],
Documentation = "Zooms the camera in, towards the current focus",
GuiPath = "/Ipac",
IsLocal = false
}
asset.export("IpacZoomIn", zoom_in)
local zoom_out = {
Identifier = "ipac.zoom_out",
Name = "Zoom out",
Command = [[ openspace.navigation.addTruckMovement(0.0, -5.0) ]],
Documentation = "Zooms the camera out, away form the current focus",
GuiPath = "/Ipac",
IsLocal = false
}
asset.export("IpacZoomOut", zoom_out)
local focus_moon = {
Identifier = "ipac.focus_moon",
Name = "Focus on the Moon",
Command = [[
openspace.setPropertyValueSingle("NavigationHandler.OrbitalNavigator.Aim", "");
openspace.setPropertyValueSingle("NavigationHandler.OrbitalNavigator.Anchor", "Moon");
openspace.setPropertyValueSingle("NavigationHandler.OrbitalNavigator.RetargetAnchor", nil);
]],
Documentation = "Focuses the camera on the Moon",
GuiPath = "/Ipac",
IsLocal = false
}
asset.export("IpacFocusMoon", focus_moon)
local focus_earth = {
Identifier = "ipac.focus_earth",
Name = "Focus on the Earth",
Command = [[
openspace.setPropertyValueSingle("NavigationHandler.OrbitalNavigator.Aim", "");
openspace.setPropertyValueSingle("NavigationHandler.OrbitalNavigator.Anchor", "Earth");
openspace.setPropertyValueSingle("NavigationHandler.OrbitalNavigator.RetargetAnchor", nil)
]],
Documentation = "Focuses the camera on Earth",
GuiPath = "/Ipac",
IsLocal = false
}
asset.export("IpacFocusEarth", focus_earth)
local actions = {
orbit_right,
orbit_left,
orbit_up,
orbit_down,
pan_right,
pan_left,
pan_up,
pan_down,
zoom_in,
zoom_out,
focus_moon,
focus_earth
}
asset.onInitialize(function()
for _, a in ipairs(actions) do
openspace.action.registerAction(a)
end
openspace.clearKeys()
openspace.bindKey("RIGHT", "openspace.navigation.addGlobalRotation(-5.0, 0.0)");
openspace.bindKey("LEFT", "openspace.navigation.addGlobalRotation(5.0, 0.0)");
openspace.bindKey("UP", "openspace.navigation.addGlobalRotation(0.0, 5.0)");
openspace.bindKey("DOWN", "openspace.navigation.addGlobalRotation(0.0, -5.0)");
openspace.bindKey("CTRL+RIGHT", "openspace.navigation.addLocalRotation(-5.0, 0.0)");
openspace.bindKey("CTRL+LEFT", "openspace.navigation.addLocalRotation(5.0, 0.0)");
openspace.bindKey("CTRL+UP", "openspace.navigation.addLocalRotation(0.0, 5.0)");
openspace.bindKey("CTRL+DOWN", "openspace.navigation.addLocalRotation(0.0, -5.0)");
openspace.bindKey("ALT+UP", "openspace.navigation.addTruckMovement(0.0, 5.0)");
openspace.bindKey("ALT+DOWN", "openspace.navigation.addTruckMovement(0.0, -5.0)");
openspace.bindKey(
"SPACE",
[[
openspace.setPropertyValueSingle("NavigationHandler.OrbitalNavigator.Aim", "");
openspace.setPropertyValueSingle("NavigationHandler.OrbitalNavigator.Anchor", "Moon");
openspace.setPropertyValueSingle("NavigationHandler.OrbitalNavigator.RetargetAnchor", nil)
]])
openspace.bindKey(
"Z",
[[
openspace.setPropertyValueSingle("NavigationHandler.OrbitalNavigator.Aim", "");
openspace.setPropertyValueSingle("NavigationHandler.OrbitalNavigator.Anchor", "Earth");
openspace.setPropertyValueSingle("NavigationHandler.OrbitalNavigator.RetargetAnchor", nil)
]])
openspace.bindKey("RIGHT", orbit_right.Identifier)
openspace.bindKey("LEFT", orbit_left.Identifier)
openspace.bindKey("UP", orbit_up.Identifier)
openspace.bindKey("DOWN", orbit_down.Identifier)
openspace.bindKey("CTRL+RIGHT", pan_right.Identifier)
openspace.bindKey("CTRL+LEFT", pan_left.Identifier)
openspace.bindKey("CTRL+UP", pan_up.Identifier)
openspace.bindKey("CTRL+DOWN", pan_down.Identifier)
openspace.bindKey("ALT+UP", zoom_in.Identifier)
openspace.bindKey("ALT+DOWN", zoom_out.Identifier)
openspace.bindKey("SPACE", focus_moon.Identifier)
openspace.bindKey("Z", focus_earth.Identifier)
end)
asset.onDeinitialize(function ()
for i = #actions, 1, -1 do
openspace.action.removeAction(actions[i])
end
end)
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment
Menu
Projects
Groups
Snippets
Help