Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.
Sign upFeature/#593 add arc ball camera #700
Conversation
torkleyy
added
type: feature
status: ready
labels
May 9, 2018
torkleyy
reviewed
May 9, 2018
Thanks for your Pull Request @mnivoliez!
I've got some concerns regarding the implementation of the system. Otherwise I like it, could you please add the camera to an example (maybe a dedicated one)?
| + position = Some(target_transform.translation + new_target_to_cam); | ||
| + } | ||
| + } | ||
| + if let Some(new_pos) = position { |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
torkleyy
May 9, 2018
Member
This won't work for multiple arc ball cameras, I wonder if we should support that.
torkleyy
May 9, 2018
Member
This won't work for multiple arc ball cameras, I wonder if we should support that.
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
jojolepro
May 9, 2018
Collaborator
You should only be controlling a single camera at once normally. If you want multi controller support input events will need to have a tracker of which controller/mouse does what.
jojolepro
May 9, 2018
Collaborator
You should only be controlling a single camera at once normally. If you want multi controller support input events will need to have a tracker of which controller/mouse does what.
| + ); | ||
| + | ||
| + fn run(&mut self, (mut transforms, tags): Self::SystemData) { | ||
| + let mut position = None; |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
torkleyy
May 9, 2018
Member
There's a slightly better solution that also resolves my concern below: you can use RestrictedStorage to iterate over the transforms and then set the position in the same iteration of the loop. I'll come back to you and explain in more detail later.
torkleyy
May 9, 2018
Member
There's a slightly better solution that also resolves my concern below: you can use RestrictedStorage to iterate over the transforms and then set the position in the same iteration of the loop. I'll come back to you and explain in more detail later.
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
mnivoliez
May 9, 2018
I though that it would be only one arcball camera (I got no reference about a game having several arcball camera other that split screen game). The exemple is planned, but at 1h30 am, it was difficult to explain to my partner I was still working on code ^^'
The restricted storage could be something.
mnivoliez
May 9, 2018
I though that it would be only one arcball camera (I got no reference about a game having several arcball camera other that split screen game). The exemple is planned, but at 1h30 am, it was difficult to explain to my partner I was still working on code ^^'
The restricted storage could be something.
torkleyy
added
status: working
status: ready
and removed
status: ready
status: working
labels
May 9, 2018
torkleyy
reviewed
May 10, 2018
Honestly I think it's not obvious enough that you also need to add the FlyControlTag. We need to document the requirements of the ArcBallCamera.
| @@ -0,0 +1,2 @@ | ||
| +# Fly Camera Example |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
torkleyy
May 10, 2018
Member
Rather than a dedicated readme it would actually be more important to add it to the overview.
torkleyy
May 10, 2018
Member
Rather than a dedicated readme it would actually be more important to add it to the overview.
| @@ -9,3 +9,16 @@ pub struct FlyControlTag; | ||
| impl Component for FlyControlTag { | ||
| type Storage = NullStorage<FlyControlTag>; | ||
| } | ||
| + | ||
| +#[derive(Debug)] | ||
| +pub struct ArcBallCameraTag { |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
torkleyy
added
status: stalled
status: working
and removed
status: ready
status: stalled
labels
May 12, 2018
| @@ -9,3 +9,19 @@ pub struct FlyControlTag; | ||
| impl Component for FlyControlTag { | ||
| type Storage = NullStorage<FlyControlTag>; | ||
| } | ||
| + | ||
| +/// Add this to a camera to which you have already add the FlyControlTag to add a arc ball |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
MrMinimal
May 12, 2018
Contributor
I'd go with "To add an arc ball behaviour, add this to a camera which already has the FlyControlTag added."
MrMinimal
May 12, 2018
Contributor
I'd go with "To add an arc ball behaviour, add this to a camera which already has the FlyControlTag added."
| + | ||
| +/// Add this to a camera to which you have already add the FlyControlTag to add a arc ball | ||
| +/// behaviour to the camera. | ||
| +/// Please not that this component require the ArcBallControlSystem to work. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
| + | ||
| +impl Component for ArcBallControlTag { | ||
| + // we can use HashMapStorage here because, according to the specs doc, this storage should be | ||
| + // use when the component is use with few entity, I think there will rarely more than one |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
| +/// The system that manages the arc ball movement; | ||
| +/// In essence, the system will allign the camera with its target while keeping the distance to it | ||
| +/// and while keeping the orientation of the camera. | ||
| +/// To modify the orientation of the camera in according with the mouse input, please use the |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
|
@mnivoliez Please rebase this PR onto |
added some commits
May 8, 2018
Rhuagh
approved these changes
May 12, 2018
I believe this could be done using just the transform parenting system, and the free rotation system, but I'll accept it anyways for clarity.
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
|
If the PR is ready for merge, please change the title. |
| @@ -9,3 +9,19 @@ pub struct FlyControlTag; | ||
| impl Component for FlyControlTag { | ||
| type Storage = NullStorage<FlyControlTag>; | ||
| } | ||
| + | ||
| +/// Add this to a camera to which you have already add the FlyControlTag to add a arc ball |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
MrMinimal
May 12, 2018
Contributor
I'd go with "To add an arc ball behaviour, add this to a camera which already has the FlyControlTag added."
MrMinimal
May 12, 2018
Contributor
I'd go with "To add an arc ball behaviour, add this to a camera which already has the FlyControlTag added."
mnivoliez
changed the title from
[WIP] Feature/#593 add arc ball camera
to
Feature/#593 add arc ball camera
May 12, 2018
Rhuagh
added
status: ready
and removed
status: working
labels
May 12, 2018
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
|
bors r+ |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
|
|
Rhuagh
assigned
jojolepro
May 12, 2018
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
|
@jojolepro please merge if you're ok with this. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
|
bors r+ |
mnivoliez commentedMay 8, 2018
•
edited by torkleyy
Edited 1 time
-
torkleyy
edited May 8, 2018 (most recent)
Here is my work on issue #593 .
For now, I have set up a system and component checking distance between the camera and the target, the free rotation system should take care of the rotation itself.
There is at this point no test, I'll do that as soon as possible.
Also, I do not know if it's the case but in the FPS/TPS case, the camera should be child to the player and evolve in player space (in the case of TPS, we should also check for other collidable object).
This change is