Skip to content

Use centre of viewport for picking instead of cursor? #165

Answered by 66OJ66
66OJ66 asked this question in Q&A
Discussion options

You must be logged in to vote

Hi - thanks for your reply!

I tried the quick method you mentioned, but it didn't produce the desired result by itself.

I ended up doing 2 things:

  1. Modify the PickingCameraBundle to use RayCastMethod::Transform as the cast_method before adding it to my Camera entity - e.g
let mut picking_camera_bundle = PickingCameraBundle::default();
picking_camera_bundle.source.cast_method = RayCastMethod::Transform;
  1. Make a custom version of PickingPlugin which excludes the update_pick_source_positions system.

Code below:

use bevy::prelude::*;
use bevy::app::PluginGroupBuilder;
use bevy::ecs::schedule::ShouldRun;
use bevy_mod_picking::{DebugCursorPickingPlugin, HighlightablePickingPlugins, Interactab…

Replies: 2 comments 3 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
3 replies
@aevyrie
Comment options

@66OJ66
Comment options

@aevyrie
Comment options

Answer selected by 66OJ66
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants