-
Notifications
You must be signed in to change notification settings - Fork 54
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve Move camera to object #709
Open
ampersand38
wants to merge
13
commits into
zen-mod:master
Choose a base branch
from
ampersand38:move-camera-to-selection-cqb
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 5 commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
d12e9b3
add cqb mode
ampersand38 7141a5b
Use SELECTED_OBJECTS macro.
ampersand38 7083fd8
combine comments
ampersand38 542b3d3
keybind instead of eh
ampersand38 7827604
handle far view
ampersand38 38533f4
setting
ampersand38 a37a33d
keyDown eh
ampersand38 dd35e08
renamed fnc
ampersand38 cb3ae06
Merge branch 'master' into move-camera-to-selection-cqb
mharis001 cba9564
Merge remote-tracking branch 'upstream/master' into move-camera-to-se…
ampersand38 7313e56
Merge remote-tracking branch 'upstream/master' into move-camera-to-se…
ampersand38 7629fa2
Merge remote-tracking branch 'upstream/master' into move-camera-to-se…
ampersand38 bb98700
prevent blocking curatorLockCameraTo Ctrl+F
ampersand38 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
#include "script_component.hpp" | ||
/* | ||
* Author: Ampersand | ||
* Handles the behaviour of the curatorMoveCamTo user action. | ||
* | ||
* Arguments: | ||
* None | ||
* | ||
* Return Value: | ||
* Key handled <BOOLEAN> | ||
* | ||
* Example: | ||
* [] call zen_editor_fnc_handleCuratorMoveCamTo | ||
* | ||
* Public: No | ||
*/ | ||
|
||
private _selectedObjects = SELECTED_OBJECTS; | ||
if (count _selectedObjects == 0) exitWith {false}; | ||
|
||
private _selectedObject = _selectedObjects select 0; | ||
private _objectPos = getPosWorld _selectedObject; | ||
private _objectDir = getDir _selectedObject; | ||
((0 boundingBoxReal _selectedObject) select 1) params ["", "_y", "_z"]; | ||
private _minDistance = 20; | ||
|
||
// Toggle between far and close views on subsequent activations with the same object selected | ||
if (isNil QGVAR(curatorMovedCamTo) || {_selectedObject != GVAR(curatorMovedCamTo)}) then { | ||
GVAR(curatorMovedCamTo) = _selectedObject; | ||
} else { | ||
_minDistance = 0.5; | ||
GVAR(curatorMovedCamTo) = nil; | ||
}; | ||
|
||
private _curatorPos = _objectPos getPos [_minDistance max _y, _objectDir + 180]; | ||
_curatorPos set [2, (_objectPos select 2) + (_minDistance max _z)]; | ||
curatorCamera setPosASL _curatorPos; | ||
curatorCamera setDir _objectDir; | ||
curatorCamera setVectorUp (vectorDir curatorCamera vectorAdd [0, 0, 1 + 1 / _minDistance]); | ||
|
||
true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I dislike adding a separate keybind. Let's use the KeyDown EH to override the vanilla keybind. If we want to make this optional, could add a setting like "Move Camera To Behaviour" - maybe 3 options: default, CQB mode, and CQB + alternative far view.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah ok. Should this code go in
camera
instead ofeditor
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think
editor
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does the setting belong under camera? see settings screenshot up top
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point. Normally, all the keybind handling is in
editor
component but I guess with the setting, it would make more sense to be undercamera
. Not really sure what option is the best.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For now I've implemented everything in
editor
, with the setting using thecamera
category.