Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Top down camera for Bevy engine

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT
NotificationsYou must be signed in to change notification settings

olekspickle/bevy_top_down_camera

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

  • Move around by hovering cursor to the edges of the screen
  • Zoom in/out
  • Rotate horizontally to change observable angle preserving pitch and yaw
  • Follow target

camera demo

Getting Started

Add thebevy_top_down_camera crate:

cargo add bevy_third_person_camera

Import thebevy_top_down_camera crate:

use bevy_top_down_camera::*;

Add theTopDownCameraPlugin:

.add_plugins(TopDownCameraPlugin)

Add theTopDownCamera component to the camera entity:

commands.spawn((Camera3d::default(),TopDownCamera::default(),));

If you want camera to follow the player, add theTopDownCameraTarget component to your player:

// Playercommands.spawn((MeshMaterial3d(materials.add(Color::WHITE)),Mesh3d(meshes.add(Mesh::from(Cuboid::new(1.0,1.0,1.0)))),Transform::from_translation(Vec3::new(0.0,0.5,0.0)),TopDownCameraTarget,Player,));

Examples

  • default
cargo run --example <example name>

Custom Settings

Most settings can be overridden:

commands.spawn((// These are the default settingsTopDownCamera{follow:false,zoom_enabled:true,zoom:(5.0,50.0).into(),cursor_enabled:true,cursor_move_speed:0.2,cursor_max_speed:200.0,cursor_rotate_speed:0.01,cursor_edge_margin:Vec2::splat(30.0),mode:CameraMode::Move,initial_setup:false,height:Height::new(5.0,50.0),height_keys_enabled:true,height_rise_key:KeyCode::KeyX.into(),height_lower_key:KeyCode::KeyZ.into(),rotate_key:MouseButton::Right.into(),},Camera3d::default(),));

Physics Support

When using third party physics engines such as bevy rapier 3d or avian 3d, you should force the 'sync_player_camera' system to runafter the physics systems. Failing to do this will cause a jittering effect to occur when applying forces/impulses to an object that has a camera entity attached. Simply add the following to your App::new() method (also see examples/physics.rs for complete example):

.configure_sets(PostUpdate,CameraSyncSet.after(PhysicsSet::StepSimulation))// Bevy Rapier 3d.configure_sets(PostUpdate,CameraSyncSet.after(PhysicsSet::Sync))// Avian 3d

Default Controls

ActionMouse/KeyboardEnabled by Default
Zoom InScroll UpYes
Zoom OutScroll DownYes
RotateRight Mouse ButtonYes
Move aroundHover to screen edgesYes
Follow-No

Bevy Version Compatibility

bevybevy_top_down_camera
0.160.1.0 - 0.1.5

License

About

Top down camera for Bevy engine

Resources

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages


[8]ページ先頭

©2009-2025 Movatter.jp