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 up[Ready] Fly camera! #578
Conversation
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
jojolepro
Feb 18, 2018
Collaborator
Forgot to format, will take a while for me to update rustfmt and rust.
|
Forgot to format, will take a while for me to update rustfmt and rust. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
|
formatted, ready for review |
| -version = "0.1.0" | ||
| -authors = ["Simon Rönnberg <seamonr@gmail.com>"] | ||
| +version = "0.2.0" | ||
| +authors = ["Simon Rönnberg <seamonr@gmail.com>","Joël Lupien <jojolepromain@gmail.com>"] |
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.
| + if axis.magnitude() == 0.0 { | ||
| + return self; | ||
| + } | ||
| + //let delta = Quaternion::from(self.rotation).conjugate() * axis.normalize() * amount; |
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.
| + } | ||
| + } | ||
| + | ||
| + fn get_axis(name: Option<&'a str>, input: &Fetch<InputHandler<String, String>>) -> f32 { |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
Rhuagh
Feb 19, 2018
Member
don't use specs-stuff in function signatures where not needed, you could take &InputHandler..> here. Also, this removes the ability to use a different type for the Axis/Action in InputHandler, we should not force <String, String> in our core functionality
Rhuagh
Feb 19, 2018
Member
don't use specs-stuff in function signatures where not needed, you could take &InputHandler..> here. Also, this removes the ability to use a different type for the Axis/Action in InputHandler, we should not force <String, String> in our core functionality
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
| +} | ||
| + | ||
| +/// The system that manages the camera rotation. | ||
| +pub struct FlyCameraRotationSystem { |
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.
jojolepro
Feb 19, 2018
Collaborator
More system = more parallelisation = better performance + ideomatic?
Also its a separation of features, you might want to use the camera rotation without the movement of it (first person camera, kind of)
jojolepro
Feb 19, 2018
Collaborator
More system = more parallelisation = better performance + ideomatic?
Also its a separation of features, you might want to use the camera rotation without the movement of it (first person camera, kind of)
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
jojolepro
Feb 19, 2018
Collaborator
I think this is what should have been done everywhere in fact. A ton of small systems instead of a couple of big ones.
jojolepro
Feb 19, 2018
Collaborator
I think this is what should have been done everywhere in fact. A ton of small systems instead of a couple of big ones.
| +pub fn hide_cursor(msg: &mut WindowMessages) { | ||
| + change_cursor_state(msg, CursorState::Hide); | ||
| +} | ||
| +/// Set the cursor back to normal/visible. |
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.
| @@ -0,0 +1,164 @@ | ||
| +//! Demonstrates how to load renderable objects, along with several lighting |
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.
| + ); | ||
| + let mut game = Application::build(resources_directory, ExampleState)? | ||
| + .with( | ||
| + FlyCameraMovementSystem::new(1.0, Some("move_x"), Some("move_y"), Some("move_z")), |
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.
torkleyy
added
type: feature
status: ready
project: debugging
labels
Feb 19, 2018
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
torkleyy
Feb 19, 2018
Member
Reviewed 6 of 10 files at r1, 5 of 7 files at r2.
Review status: 11 of 13 files reviewed at latest revision, 17 unresolved discussions.
amethyst_core/src/transform/components/local_transform.rs, line 57 at r2 (raw file):
#[inline] pub fn move_local(&mut self, axis: Vector3<f32>, amount: f32) -> &mut Self { if axis.magnitude() == 0.0 {
Use squared magnitude?
amethyst_utils/src/fly_camera.rs, line 13 at r2 (raw file):
speed: f32, /// The name of the input axis to locally move in the x coordinates. move_x_name: Option<&'a str>,
Should be generic over the axis key of the input manager.x
amethyst_utils/src/fly_camera.rs, line 36 at r2 (raw file):
fn get_axis(name: Option<&'a str>, input: &Fetch<InputHandler<String, String>>) -> f32 { if let Some(n) = name {
name.and_then(|n| input.axis_value(n)).unwrap_or(0.0)
amethyst_utils/src/fly_camera.rs, line 41 at r2 (raw file):
} } return 0.0;
No need for an explicit return
amethyst_utils/src/fly_camera.rs, line 60 at r2 (raw file):
let dir = Vector3::new(x, y, z); for (_, transform) in (&camera, &mut transform).join() {
Do we want to move all cameras? I'd say pass an entity to the system.
amethyst_utils/src/fly_camera.rs, line 67 at r2 (raw file):
Previously, jojolepro wrote…
I think this is what should have been done everywhere in fact. A ton of small systems instead of a couple of big ones.
Yeah, usually splitting makes sense, but here both will block each other since they need access to WriteStorage<Transform>
amethyst_utils/src/lib.rs, line 2 at r2 (raw file):
extern crate amethyst_core; extern crate amethyst_input;
I'm unsure if this fly_camera should go into amethyst_utils. I could imagine amethyst_input or amethyst_renderer depending on utils in the future. A recursive dependency is not permitted however. We need to consider putting this feature into another crate.
amethyst_utils/src/mouse.rs, line 21 at r2 (raw file):
msg.send_command(move |win| { if let Err(err) = win.set_cursor_state(state) { eprintln!("Unable to change the cursor state! Error: {:?}", err);
Should use error!
amethyst_utils/src/mouse.rs, line 37 at r2 (raw file):
/// The system that locks the mouse to the center of the screen. Useful for first person camera. pub struct MouseCenterLockSystem;
In my experience this kind of manually setting the mouse position to the middle of the screen doesn't go well. What does this offer over MouseCursor::Grab?
examples/fly_camera/README.md, line 1 at r2 (raw file):
# Fly Camera Example
Missing description
examples/fly_camera/resources/input.ron, line 18 at r2 (raw file):
actions: { }, )
Missing newline
Comments from Reviewable
|
Reviewed 6 of 10 files at r1, 5 of 7 files at r2. amethyst_core/src/transform/components/local_transform.rs, line 57 at r2 (raw file):
Use squared magnitude? amethyst_utils/src/fly_camera.rs, line 13 at r2 (raw file):
Should be generic over the axis key of the input manager.x amethyst_utils/src/fly_camera.rs, line 36 at r2 (raw file):
amethyst_utils/src/fly_camera.rs, line 41 at r2 (raw file):
No need for an explicit return amethyst_utils/src/fly_camera.rs, line 60 at r2 (raw file):
Do we want to move all cameras? I'd say pass an entity to the system. amethyst_utils/src/fly_camera.rs, line 67 at r2 (raw file): Previously, jojolepro wrote…
Yeah, usually splitting makes sense, but here both will block each other since they need access to amethyst_utils/src/lib.rs, line 2 at r2 (raw file):
I'm unsure if this amethyst_utils/src/mouse.rs, line 21 at r2 (raw file):
Should use amethyst_utils/src/mouse.rs, line 37 at r2 (raw file):
In my experience this kind of manually setting the mouse position to the middle of the screen doesn't go well. What does this offer over examples/fly_camera/README.md, line 1 at r2 (raw file):
Missing description examples/fly_camera/resources/input.ron, line 18 at r2 (raw file):
Missing newline Comments from Reviewable |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
jojolepro
Feb 19, 2018
Collaborator
amethyst_utils/src/mouse.rs, line 37 at r2 (raw file):
/// The system that locks the mouse to the center of the screen. Useful for first person camera.
pub struct MouseCenterLockSystem;
In my experience this kind of manually setting the mouse position to the middle of the screen doesn't go >well. What does this offer over MouseCursor::Grab?
MouseGrab locks the mouse inside of the windows, but doesn't force it to be centered.
amethyst_utils/src/fly_camera.rs, line 67 at r2 (raw file):
Previously, jojolepro wrote…
I think this is what should have been done everywhere in fact. A ton of small systems instead of a >couple of big ones.Yeah, usually splitting makes sense, but here both will block each other since they need access to >WriteStorage
I still prefer having System separated. Even if both block each other on the Transform, some other systems will have access to resources that become free after the first system is done. ScreenDimensions is an example.
I fixed everything else in both reviews. Thanks for reviewing! :)
MouseGrab locks the mouse inside of the windows, but doesn't force it to be centered.
I still prefer having System separated. Even if both block each other on the Transform, some other systems will have access to resources that become free after the first system is done. I fixed everything else in both reviews. Thanks for reviewing! :) |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
torkleyy
Feb 19, 2018
Member
Thanks for addressing. Please make sure to comment "Done." (shortcut key: "d") to my review comments so I can acknowledge them.
Reviewed 4 of 10 files at r3.
Review status: 10 of 16 files reviewed at latest revision, 24 unresolved discussions.
amethyst_renderer/src/bundle.rs, line 50 at r3 (raw file):
) -> Result<DispatcherBuilder<'a, 'b>> { world.add_resource(AmbientColor(Rgba::from([0.01; 3]))); if !world.res.has_value(ResourceId::new::<WindowMessages>()) {
Should use Entry API.
amethyst_utils/src/bundles.rs, line 58 at r3 (raw file):
) -> Result<DispatcherBuilder<'a, 'b>> { world.register::<FlyCameraTag>(); if !world.res.has_value(ResourceId::new::<WindowMessages>()) {
Should use Entry API.
amethyst_utils/src/bundles.rs, line 63 at r3 (raw file):
let mut msg = world.write_resource::<WindowMessages>(); grab_cursor(&mut msg); set_mouse_cursor_none(&mut msg);
Should be in the bundle documentation.
amethyst_utils/src/fly_camera.rs, line 15 at r3 (raw file):
impl Component for FlyCameraTag { type Storage = VecStorage<FlyCameraTag>;
Should use a NullStorage.
amethyst_utils/src/fly_camera.rs, line 20 at r3 (raw file):
/// The system that manages the camera movement. /// Generic parameters are the parameters for the InputHandler. pub struct FlyCameraMovementSystem<A, B> {
Why do we need B here?
amethyst_utils/src/fly_camera.rs, line 22 at r3 (raw file):
pub struct FlyCameraMovementSystem<A, B> { /// The movement speed of the camera in units per second. pub speed: f32,
You cannot access fields of a system unfortunately.
amethyst_utils/src/fly_camera.rs, line 121 at r3 (raw file):
let offset_x = half_x - posx as f32; let offset_y = half_y - posy as f32; for (transform, _) in (&mut transform, &tag).join() {
Still, do we want to fly all of them at once?
Comments from Reviewable
|
Thanks for addressing. Please make sure to comment "Done." (shortcut key: "d") to my review comments so I can acknowledge them. Reviewed 4 of 10 files at r3. amethyst_renderer/src/bundle.rs, line 50 at r3 (raw file):
Should use Entry API. amethyst_utils/src/bundles.rs, line 58 at r3 (raw file):
Should use Entry API. amethyst_utils/src/bundles.rs, line 63 at r3 (raw file):
Should be in the bundle documentation. amethyst_utils/src/fly_camera.rs, line 15 at r3 (raw file):
Should use a amethyst_utils/src/fly_camera.rs, line 20 at r3 (raw file):
Why do we need amethyst_utils/src/fly_camera.rs, line 22 at r3 (raw file):
You cannot access fields of a system unfortunately. amethyst_utils/src/fly_camera.rs, line 121 at r3 (raw file):
Still, do we want to fly all of them at once? Comments from Reviewable |
torkleyy
self-assigned this
Feb 19, 2018
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
jojolepro
Feb 19, 2018
Collaborator
Review status: 10 of 16 files reviewed at latest revision, 24 unresolved discussions.
amethyst_core/src/transform/components/local_transform.rs, line 57 at r2 (raw file):
Previously, torkleyy (Thomas Schaller) wrote…
Use squared magnitude?
Done.
amethyst_utils/src/fly_camera.rs, line 13 at r2 (raw file):
Previously, torkleyy (Thomas Schaller) wrote…
Should be generic over the axis key of the input manager.x
Done.
amethyst_utils/src/fly_camera.rs, line 35 at r2 (raw file):
Previously, jojolepro wrote…
done
Done.
amethyst_utils/src/fly_camera.rs, line 36 at r2 (raw file):
Previously, torkleyy (Thomas Schaller) wrote…
name.and_then(|n| input.axis_value(n)).unwrap_or(0.0)
Done.
amethyst_utils/src/fly_camera.rs, line 41 at r2 (raw file):
Previously, torkleyy (Thomas Schaller) wrote…
No need for an explicit return
Done.
amethyst_utils/src/fly_camera.rs, line 60 at r2 (raw file):
Previously, torkleyy (Thomas Schaller) wrote…
Do we want to move all cameras? I'd say pass an entity to the system.
Done.
amethyst_utils/src/fly_camera.rs, line 67 at r2 (raw file):
Previously, torkleyy (Thomas Schaller) wrote…
Yeah, usually splitting makes sense, but here both will block each other since they need access to
WriteStorage<Transform>
replied as comment
amethyst_utils/src/fly_camera.rs, line 15 at r3 (raw file):
Previously, torkleyy (Thomas Schaller) wrote…
Should use a
NullStorage.
Done.
amethyst_utils/src/fly_camera.rs, line 20 at r3 (raw file):
Previously, torkleyy (Thomas Schaller) wrote…
Why do we need
Bhere?
Second type argument of InputHandler<A,B>. I did put a doc line about it.
amethyst_utils/src/fly_camera.rs, line 22 at r3 (raw file):
Previously, torkleyy (Thomas Schaller) wrote…
You cannot access fields of a system unfortunately.
Done.
amethyst_utils/src/fly_camera.rs, line 121 at r3 (raw file):
Previously, torkleyy (Thomas Schaller) wrote…
Still, do we want to fly all of them at once?
Only the one tagged will. Its up to the user to specify which entities have that tag.
amethyst_utils/src/lib.rs, line 2 at r2 (raw file):
Previously, torkleyy (Thomas Schaller) wrote…
I'm unsure if this
fly_camerashould go intoamethyst_utils. I could imagineamethyst_inputoramethyst_rendererdepending on utils in the future. A recursive dependency is not permitted however. We need to consider putting this feature into another crate.
It could be move if we ever get a cycle dependency.
amethyst_utils/src/mouse.rs, line 21 at r2 (raw file):
Previously, torkleyy (Thomas Schaller) wrote…
Should use
error!
Done.
amethyst_utils/src/mouse.rs, line 37 at r2 (raw file):
Previously, torkleyy (Thomas Schaller) wrote…
In my experience this kind of manually setting the mouse position to the middle of the screen doesn't go well. What does this offer over
MouseCursor::Grab?
replied as comment
examples/fly_camera/README.md, line 1 at r2 (raw file):
Previously, torkleyy (Thomas Schaller) wrote…
Missing description
Done.
examples/fly_camera/resources/input.ron, line 18 at r2 (raw file):
Previously, torkleyy (Thomas Schaller) wrote…
Missing newline
Done.
Comments from Reviewable
|
Review status: 10 of 16 files reviewed at latest revision, 24 unresolved discussions. amethyst_core/src/transform/components/local_transform.rs, line 57 at r2 (raw file): Previously, torkleyy (Thomas Schaller) wrote…
Done. amethyst_utils/src/fly_camera.rs, line 13 at r2 (raw file): Previously, torkleyy (Thomas Schaller) wrote…
Done. amethyst_utils/src/fly_camera.rs, line 35 at r2 (raw file): Previously, jojolepro wrote…
Done. amethyst_utils/src/fly_camera.rs, line 36 at r2 (raw file): Previously, torkleyy (Thomas Schaller) wrote…
Done. amethyst_utils/src/fly_camera.rs, line 41 at r2 (raw file): Previously, torkleyy (Thomas Schaller) wrote…
Done. amethyst_utils/src/fly_camera.rs, line 60 at r2 (raw file): Previously, torkleyy (Thomas Schaller) wrote…
Done. amethyst_utils/src/fly_camera.rs, line 67 at r2 (raw file): Previously, torkleyy (Thomas Schaller) wrote…
replied as comment amethyst_utils/src/fly_camera.rs, line 15 at r3 (raw file): Previously, torkleyy (Thomas Schaller) wrote…
Done. amethyst_utils/src/fly_camera.rs, line 20 at r3 (raw file): Previously, torkleyy (Thomas Schaller) wrote…
Second type argument of InputHandler<A,B>. I did put a doc line about it. amethyst_utils/src/fly_camera.rs, line 22 at r3 (raw file): Previously, torkleyy (Thomas Schaller) wrote…
Done. amethyst_utils/src/fly_camera.rs, line 121 at r3 (raw file): Previously, torkleyy (Thomas Schaller) wrote…
Only the one tagged will. Its up to the user to specify which entities have that tag. amethyst_utils/src/lib.rs, line 2 at r2 (raw file): Previously, torkleyy (Thomas Schaller) wrote…
It could be move if we ever get a cycle dependency. amethyst_utils/src/mouse.rs, line 21 at r2 (raw file): Previously, torkleyy (Thomas Schaller) wrote…
Done. amethyst_utils/src/mouse.rs, line 37 at r2 (raw file): Previously, torkleyy (Thomas Schaller) wrote…
replied as comment examples/fly_camera/README.md, line 1 at r2 (raw file): Previously, torkleyy (Thomas Schaller) wrote…
Done. examples/fly_camera/resources/input.ron, line 18 at r2 (raw file): Previously, torkleyy (Thomas Schaller) wrote…
Done. Comments from Reviewable |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
jojolepro
Feb 19, 2018
Collaborator
Review status: 9 of 16 files reviewed at latest revision, 24 unresolved discussions.
amethyst_renderer/src/bundle.rs, line 50 at r3 (raw file):
Previously, torkleyy (Thomas Schaller) wrote…
Should use Entry API.
Done.
amethyst_utils/src/bundles.rs, line 58 at r3 (raw file):
Previously, torkleyy (Thomas Schaller) wrote…
Should use Entry API.
Done.
amethyst_utils/src/bundles.rs, line 63 at r3 (raw file):
Previously, torkleyy (Thomas Schaller) wrote…
Should be in the bundle documentation.
Done.
Comments from Reviewable
|
Review status: 9 of 16 files reviewed at latest revision, 24 unresolved discussions. amethyst_renderer/src/bundle.rs, line 50 at r3 (raw file): Previously, torkleyy (Thomas Schaller) wrote…
Done. amethyst_utils/src/bundles.rs, line 58 at r3 (raw file): Previously, torkleyy (Thomas Schaller) wrote…
Done. amethyst_utils/src/bundles.rs, line 63 at r3 (raw file): Previously, torkleyy (Thomas Schaller) wrote…
Done. Comments from Reviewable |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
|
Fixed all. Thanks for review ;) |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
torkleyy
Feb 19, 2018
Member
Reviewed 1 of 10 files at r3, 1 of 3 files at r4.
Review status: 11 of 16 files reviewed at latest revision, 11 unresolved discussions.
amethyst_utils/src/fly_camera.rs, line 20 at r3 (raw file):
Previously, jojolepro wrote…
Second type argument of InputHandler<A,B>. I did put a doc line about it.
But you never store B, you can simply put the type param on the methods.
amethyst_utils/src/fly_camera.rs, line 121 at r3 (raw file):
Previously, jojolepro wrote…
Only the one tagged will. Its up to the user to specify which entities have that tag.
Problem is if multiple entities have that tag.
amethyst_utils/src/lib.rs, line 2 at r2 (raw file):
Previously, jojolepro wrote…
It could be move if we ever get a cycle dependency.
Still, I don't think this is the right place.
examples/fly_camera/resources/input.ron, line 18 at r2 (raw file):
Previously, jojolepro wrote…
Done.
Err.. I don't think so.
Comments from Reviewable
|
Reviewed 1 of 10 files at r3, 1 of 3 files at r4. amethyst_utils/src/fly_camera.rs, line 20 at r3 (raw file): Previously, jojolepro wrote…
But you never store amethyst_utils/src/fly_camera.rs, line 121 at r3 (raw file): Previously, jojolepro wrote…
Problem is if multiple entities have that tag. amethyst_utils/src/lib.rs, line 2 at r2 (raw file): Previously, jojolepro wrote…
Still, I don't think this is the right place. examples/fly_camera/resources/input.ron, line 18 at r2 (raw file): Previously, jojolepro wrote…
Err.. I don't think so. Comments from Reviewable |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
jojolepro
Feb 19, 2018
Collaborator
Review status: 11 of 16 files reviewed at latest revision, 11 unresolved discussions.
amethyst_utils/src/fly_camera.rs, line 20 at r3 (raw file):
Previously, torkleyy (Thomas Schaller) wrote…
But you never store
B, you can simply put the type param on the methods.
How do you want to do that? I need to keep the B generic parameter all the way from the user's main.rs file to be able to fetch the right InputHandler<A,B>. I figured storing it as a PhantomData would do just that?
amethyst_utils/src/fly_camera.rs, line 121 at r3 (raw file):
Previously, torkleyy (Thomas Schaller) wrote…
Problem is if multiple entities have that tag.
- Users might want to have multiple fly camera. You have to keep in mind that someone might want to make a remote turret by only using the fly camera's rotation system. In that case, it might be useful to use tags.
- If the user only wants one fly camera, then only add one tag? The systems are changing (transform,tag), they completely ignore the Camera component.
amethyst_utils/src/lib.rs, line 2 at r2 (raw file):
Previously, torkleyy (Thomas Schaller) wrote…
Still, I don't think this is the right place.
Where do you want it then?
examples/fly_camera/resources/input.ron, line 18 at r2 (raw file):
Previously, torkleyy (Thomas Schaller) wrote…
Err.. I don't think so.
blame rustfmt
Comments from Reviewable
|
Review status: 11 of 16 files reviewed at latest revision, 11 unresolved discussions. amethyst_utils/src/fly_camera.rs, line 20 at r3 (raw file): Previously, torkleyy (Thomas Schaller) wrote…
How do you want to do that? I need to keep the B generic parameter all the way from the user's main.rs file to be able to fetch the right InputHandler<A,B>. I figured storing it as a PhantomData would do just that? amethyst_utils/src/fly_camera.rs, line 121 at r3 (raw file): Previously, torkleyy (Thomas Schaller) wrote…
amethyst_utils/src/lib.rs, line 2 at r2 (raw file): Previously, torkleyy (Thomas Schaller) wrote…
Where do you want it then? examples/fly_camera/resources/input.ron, line 18 at r2 (raw file): Previously, torkleyy (Thomas Schaller) wrote…
blame rustfmt Comments from Reviewable |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
Rhuagh
Feb 20, 2018
Member
Reviewed 3 of 10 files at r1, 3 of 7 files at r2, 7 of 10 files at r3, 3 of 3 files at r4.
Review status: all files reviewed at latest revision, 5 unresolved discussions.
amethyst_utils/src/fly_camera.rs, line 25 at r4 (raw file):
speed: f32, /// The name of the input axis to locally move in the x coordinates. move_x_name: Option<A>,
Would it be possible to give these better names? They don't really encode movement along the global x/y/z axis, they're along the local axes. Something like right_input_axis etc?
Comments from Reviewable
|
Reviewed 3 of 10 files at r1, 3 of 7 files at r2, 7 of 10 files at r3, 3 of 3 files at r4. amethyst_utils/src/fly_camera.rs, line 25 at r4 (raw file):
Would it be possible to give these better names? They don't really encode movement along the global x/y/z axis, they're along the local axes. Something like Comments from Reviewable |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
Rhuagh
Feb 20, 2018
Member
Review status: all files reviewed at latest revision, 5 unresolved discussions.
amethyst_utils/src/fly_camera.rs, line 20 at r3 (raw file):
Previously, jojolepro wrote…
How do you want to do that? I need to keep the B generic parameter all the way from the user's main.rs file to be able to fetch the right InputHandler<A,B>. I figured storing it as a PhantomData would do just that?
@torkleyy He needs to have the B generic type here because the System impl below needs it to be able to Fetch<InputHandler<A, B>>
Comments from Reviewable
|
Review status: all files reviewed at latest revision, 5 unresolved discussions. amethyst_utils/src/fly_camera.rs, line 20 at r3 (raw file): Previously, jojolepro wrote…
@torkleyy He needs to have the B generic type here because the System impl below needs it to be able to Comments from Reviewable |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
Xaeroxe
Feb 21, 2018
Member
Review status: all files reviewed at latest revision, 6 unresolved discussions.
examples/fly_camera/main.rs, line 33 at r4 (raw file):
//trans.scale = [1.0; 3].into(); //trans.move_local(Vector3::new(1.0,0.0,-1.0),5.0);
Please don't leave commented out code in the PR, at least not without a stated reason. It comes off looking sloppy.
examples/fly_camera/resources/input.ron, line 18 at r2 (raw file):
Previously, jojolepro wrote…
blame rustfmt
rustfmt doesn't touch ron files.
Comments from Reviewable
|
Review status: all files reviewed at latest revision, 6 unresolved discussions. examples/fly_camera/main.rs, line 33 at r4 (raw file):
Please don't leave commented out code in the PR, at least not without a stated reason. It comes off looking sloppy. examples/fly_camera/resources/input.ron, line 18 at r2 (raw file): Previously, jojolepro wrote…
rustfmt doesn't touch ron files. Comments from Reviewable |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
jojolepro
Feb 21, 2018
Collaborator
Review status: 12 of 16 files reviewed at latest revision, 6 unresolved discussions.
amethyst_utils/src/fly_camera.rs, line 25 at r4 (raw file):
Previously, Rhuagh (Simon Rönnberg) wrote…
Would it be possible to give these better names? They don't really encode movement along the global x/y/z axis, they're along the local axes. Something like
right_input_axisetc?
Done.
examples/fly_camera/main.rs, line 33 at r4 (raw file):
Previously, Xaeroxe (Jacob Kiesel) wrote…
Please don't leave commented out code in the PR, at least not without a stated reason. It comes off looking sloppy.
Done.
examples/fly_camera/resources/input.ron, line 18 at r2 (raw file):
Previously, Xaeroxe (Jacob Kiesel) wrote…
rustfmt doesn't touch ron files.
should be fixed now...
Comments from Reviewable
|
Review status: 12 of 16 files reviewed at latest revision, 6 unresolved discussions. amethyst_utils/src/fly_camera.rs, line 25 at r4 (raw file): Previously, Rhuagh (Simon Rönnberg) wrote…
Done. examples/fly_camera/main.rs, line 33 at r4 (raw file): Previously, Xaeroxe (Jacob Kiesel) wrote…
Done. examples/fly_camera/resources/input.ron, line 18 at r2 (raw file): Previously, Xaeroxe (Jacob Kiesel) wrote…
should be fixed now... Comments from Reviewable |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
jojolepro
Feb 21, 2018
Collaborator
@torkleyy reply to my answer whenever you get time please. Its been two days. Thanks!
|
@torkleyy reply to my answer whenever you get time please. Its been two days. Thanks! |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
|
Once people are happy with how the code is, I'll rebase. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
jojolepro
Feb 22, 2018
Collaborator
Review status: 8 of 20 files reviewed at latest revision, 6 unresolved discussions.
amethyst_utils/src/lib.rs, line 2 at r2 (raw file):
Previously, jojolepro wrote…
Where do you want it then?
Done.
Comments from Reviewable
|
Review status: 8 of 20 files reviewed at latest revision, 6 unresolved discussions. amethyst_utils/src/lib.rs, line 2 at r2 (raw file): Previously, jojolepro wrote…
Done. Comments from Reviewable |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
jojolepro
Feb 22, 2018
Collaborator
Allright, I made a new crate after talking with people on gitter and thinking about it more. I makes sense to have a controls crate, since I'll be adding more control types in the future (fps, third person, vehicle, aircraft, etc..)
This should be ready for a new (and hopefully final) review.
|
Allright, I made a new crate after talking with people on gitter and thinking about it more. I makes sense to have a controls crate, since I'll be adding more control types in the future (fps, third person, vehicle, aircraft, etc..) This should be ready for a new (and hopefully final) review. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
Xaeroxe
Feb 22, 2018
Member
Reviewed 1 of 6 files at r5, 11 of 13 files at r6, 2 of 2 files at r7.
Review status: all files reviewed at latest revision, 5 unresolved discussions.
Comments from Reviewable
|
Reviewed 1 of 6 files at r5, 11 of 13 files at r6, 2 of 2 files at r7. Comments from Reviewable |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
Rhuagh
Feb 22, 2018
Member
Reviewed 1 of 6 files at r5, 11 of 13 files at r6, 2 of 2 files at r7.
Review status: all files reviewed at latest revision, 6 unresolved discussions.
amethyst_controls/src/systems.rs, line 10 at r7 (raw file):
use std::marker::PhantomData; use super::*;
Not a fan of glob imports, especially when it's for a single type.
examples/fly_camera/main.rs, line 8 at r7 (raw file):
use amethyst::assets::Loader; use amethyst::config::Config; use amethyst::controls::*;
Glob import.
examples/fly_camera/resources/input.ron, line 18 at r2 (raw file):
Previously, jojolepro wrote…
should be fixed now...
Nope
Comments from Reviewable
|
Reviewed 1 of 6 files at r5, 11 of 13 files at r6, 2 of 2 files at r7. amethyst_controls/src/systems.rs, line 10 at r7 (raw file):
Not a fan of glob imports, especially when it's for a single type. examples/fly_camera/main.rs, line 8 at r7 (raw file):
Glob import. examples/fly_camera/resources/input.ron, line 18 at r2 (raw file): Previously, jojolepro wrote…
Nope Comments from Reviewable |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
torkleyy
Feb 23, 2018
Member
Didn't review it a second time yet, but I like the direction and thank you for moving the code :)
|
Didn't review it a second time yet, but I like the direction and thank you for moving the code :) |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
torkleyy
self-requested a review
Feb 24, 2018
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
torkleyy
Feb 24, 2018
Member
Reviewed 1 of 12 files at r3, 9 of 13 files at r6, 1 of 2 files at r7, 4 of 4 files at r8.
Review status: all files reviewed at latest revision, 5 unresolved discussions.
amethyst_utils/src/lib.rs, line 2 at r2 (raw file):
Previously, jojolepro wrote…
Done.
I don't think this is done, we still depend on Amethyst crates other than amethyst_core.
amethyst_utils/src/mouse.rs, line 1 at r8 (raw file):
use amethyst_renderer::WindowMessages;
Move this file to amethyst_renderer?
examples/pong/resources/input.ron, line 15 at r8 (raw file):
}, )
Missing newline
Comments from Reviewable
|
Reviewed 1 of 12 files at r3, 9 of 13 files at r6, 1 of 2 files at r7, 4 of 4 files at r8. amethyst_utils/src/lib.rs, line 2 at r2 (raw file): Previously, jojolepro wrote…
I don't think this is done, we still depend on Amethyst crates other than amethyst_utils/src/mouse.rs, line 1 at r8 (raw file):
Move this file to examples/pong/resources/input.ron, line 15 at r8 (raw file):
Missing newline Comments from Reviewable |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
jojolepro
Feb 24, 2018
Collaborator
Review status: 13 of 21 files reviewed at latest revision, 5 unresolved discussions.
amethyst_controls/src/systems.rs, line 10 at r7 (raw file):
Previously, Rhuagh (Simon Rönnberg) wrote…
Not a fan of glob imports, especially when it's for a single type.
Done. The only glob import left is in the bundle file. As this file usually touches most of the crate, I assume it is okay.
amethyst_renderer/src/mouse.rs, line 1 at r8 (raw file):
Previously, torkleyy (Thomas Schaller) wrote…
Move this file to
amethyst_renderer?
Done.
amethyst_utils/src/lib.rs, line 2 at r2 (raw file):
Previously, torkleyy (Thomas Schaller) wrote…
I don't think this is done, we still depend on Amethyst crates other than
amethyst_core.
Done.
examples/fly_camera/main.rs, line 8 at r7 (raw file):
Previously, Rhuagh (Simon Rönnberg) wrote…
Glob import.
Done.
examples/fly_camera/resources/input.ron, line 18 at r2 (raw file):
Previously, Rhuagh (Simon Rönnberg) wrote…
Nope
I really hope this file coming from hell is fixed now :P
examples/pong/resources/input.ron, line 15 at r8 (raw file):
Previously, torkleyy (Thomas Schaller) wrote…
Missing newline
Done.
Comments from Reviewable
|
Review status: 13 of 21 files reviewed at latest revision, 5 unresolved discussions. amethyst_controls/src/systems.rs, line 10 at r7 (raw file): Previously, Rhuagh (Simon Rönnberg) wrote…
Done. The only glob import left is in the bundle file. As this file usually touches most of the crate, I assume it is okay. amethyst_renderer/src/mouse.rs, line 1 at r8 (raw file): Previously, torkleyy (Thomas Schaller) wrote…
Done. amethyst_utils/src/lib.rs, line 2 at r2 (raw file): Previously, torkleyy (Thomas Schaller) wrote…
Done. examples/fly_camera/main.rs, line 8 at r7 (raw file): Previously, Rhuagh (Simon Rönnberg) wrote…
Done. examples/fly_camera/resources/input.ron, line 18 at r2 (raw file): Previously, Rhuagh (Simon Rönnberg) wrote…
I really hope this file coming from hell is fixed now :P examples/pong/resources/input.ron, line 15 at r8 (raw file): Previously, torkleyy (Thomas Schaller) wrote…
Done. Comments from Reviewable |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
torkleyy
Feb 25, 2018
Member
Reviewed 1 of 14 files at r6, 9 of 9 files at r9.
Review status: all files reviewed at latest revision, 2 unresolved discussions.
Comments from Reviewable
|
Reviewed 1 of 14 files at r6, 9 of 9 files at r9. Comments from Reviewable |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
Rhuagh
Feb 25, 2018
Member
Reviewed 2 of 14 files at r6, 2 of 5 files at r8, 9 of 9 files at r9.
Review status: all files reviewed at latest revision, 2 unresolved discussions.
examples/fly_camera/main.rs, line 8 at r9 (raw file):
use amethyst::assets::Loader; use amethyst::config::Config; use amethyst::controls::{FlyControlTag,FlyControlBundle};
Space, run fmt pls
Comments from Reviewable
|
Reviewed 2 of 14 files at r6, 2 of 5 files at r8, 9 of 9 files at r9. examples/fly_camera/main.rs, line 8 at r9 (raw file):
Space, run fmt pls Comments from Reviewable |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
Rhuagh
Feb 25, 2018
Member
Reviewed 1 of 9 files at r9, 2 of 2 files at r10.
Review status: all files reviewed at latest revision, 2 unresolved discussions.
Comments from Reviewable
|
Reviewed 1 of 9 files at r9, 2 of 2 files at r10. Comments from Reviewable |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
|
Please squash the commits a bit |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
|
I think I broke my commit message, but there you go ;) |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
torkleyy
Feb 25, 2018
Member
Please run rustfmt and squash the commits, then merge.
bors r+
Reviewed 1 of 2 files at r10, 11 of 11 files at r11.
Review status: all files reviewed at latest revision, all discussions resolved.
Comments from Reviewable
|
Please run rustfmt and squash the commits, then merge. bors r+ Reviewed 1 of 2 files at r10, 11 of 11 files at r11. Comments from Reviewable |


jojolepro commentedFeb 18, 2018
•
edited
Edited 2 times
-
jojolepro
edited Feb 19, 2018 (most recent)
-
torkleyy
edited Feb 18, 2018
Explore the world with that fancy camera!
Wow, much rotation!
Jokes aside, this adds a fly camera, an example that shows how to use it, and some useful functions to change the cursor behaviour.
If someone manages to add a constraint to rotation in a PR, this could use it to prevent the camera from going upside down.
Also fixes a bug in transform::move_local that wasn't actually taking rotation into account.
This change is