• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

sburris0/bevy_flycam: Basic first-person fly camera for the Bevy game engine

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称:

sburris0/bevy_flycam

开源软件地址:

https://github.com/sburris0/bevy_flycam

开源编程语言:

Rust 100.0%

开源软件介绍:

bevy_flycam

Crates.io Crates.io docs.rs

A basic first-person fly camera for Bevy 0.7

Controls

  • WASD to move horizontally
  • SPACE to ascend
  • LSHIFT to descend
  • ESC to grab/release cursor.

Comparison

There are a few notable differences from bevy_fly_camera...

  • No linear interpolation
  • Cursor grabbing
  • Shorter code
  • Single-line setup
  • A tiny bit faster?

Usage

  1. Add to Cargo.toml or copy lib.rs to your own file
[dependencies]
bevy = "0.7"
bevy_flycam = "*"

or

[dependencies]
bevy = "0.7"
bevy_flycam = { git = "https://github.com/sburris0/bevy_flycam" }
  1. Include the PlayerPlugin
use bevy_flycam::PlayerPlugin;

This will spawn a camera for you. Use NoCameraPlayerPlugin if you do not want this and make sure to use .insert(FlyCam) on your own camera or else this plugin won't know what to move.

  1. Add the PlayerPlugin:
#[bevy_main]
fn main() {
    App::new()
        .add_plugins(DefaultPlugins)
        .add_plugin(PlayerPlugin)
        .run();
}

Alternatively you can see the example basic.rs or scroll.rs located in the examples folder. You can run the example by cloning this repository and run the command: cargo run --release --example basic

Customization

To modify player movement speed or mouse sensitivity, import bevy_flycam::MovementSettings and add it as a resource:

#[bevy_main]
fn main() {
    App::new()
        .add_plugins(DefaultPlugins)
        .add_plugin(PlayerPlugin)
        .insert_resource(MovementSettings {
            sensitivity: 0.00015, // default: 0.00012
            speed: 12.0, // default: 12.0
        })
        .run();
}

Support

Bevy tracking

bevy_flycam's crate version follows bevy's X version as shown:

bevy bevy_flycam
0.X.Y 0.X

Contributing

PRs are very welcome.




鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap