Skip to main content

Questions tagged [bevy]

A cross-platform, massively parallel game engine with an entity component system and 2D and 3D renderers.

Filter by
Sorted by
Tagged with
18 votes
2 answers
13k views

How can I manually create meshes in bevy with vertices?

What do I have to do to to create a mesh for bevy with the following vertices: let mut vertices : Vec<[f32; 3]> = Vec::new(); vertices.push([0.0, 0.0, 0.0]); vertices.push([1.0, 2.0, 1....
Bruno Wallner's user avatar
13 votes
3 answers
15k views

How, with Bevy, can you get and set Window information after creation?

I want to be able to read and set window-settings with Bevy. I attempted to do so with a basic system: fn test_system(mut win_desc: ResMut<WindowDescriptor>) { win_desc.title = "test&...
STF_ZBR's user avatar
  • 647
11 votes
2 answers
6k views

Reading the Position of a Mouse click in Bevy

I am trying to see where the mouse is pressed so I can select my character. I have tried the following #[derive(Default)] struct State { // Set up from example mouse_button_event_reader: ...
Will's user avatar
  • 1,119
11 votes
0 answers
3k views

How to run a Bevy app with default plugins without a GPU?

My laptop doesn't have a dedicated GPU. I run elementary OS 5 on this laptop, which has an integrated GPU. When I try running my beginner's Bevy app, use bevy::prelude::*; fn main() { App::build()...
Arun Parolikkal's user avatar
9 votes
2 answers
4k views

How do I convert screen space to world space coords in Bevy using Camera2dComponents?

Using Res<Events<CursorMoved>> I can get the mouse position change in screen space coordinates (zero in bottom-left corner), e.g. #[derive(Default)] struct State { cursor_moved_reader: ...
Jakub Arnold's user avatar
  • 86.7k
8 votes
2 answers
3k views

How to read Bevy events without consuming them?

I am currently trying to use events to signal when the character jumps in my Bevy game. I want the system that handles player inputs to send a JumpedEvent which can then be received by other systems ...
EtTuBrute's user avatar
  • 502
8 votes
1 answer
2k views

How does Bevy "scope" its systems based on the type of the arguments?

Bevy, a new Rust game engine and ECS, has a feature where it "scopes" its systems based on the type of the arguments. From its docs: The parameters we pass in to a "system function&...
Rodney Folz's user avatar
  • 6,817
8 votes
2 answers
3k views

How to do a nested query in a Bevy system?

I'm working on a little boids toy with Bevy, and each boid's velocity/acceleration depends on the position and velocity values of the boids around it. This means that for each boid, I want to run some ...
peter's user avatar
  • 121
7 votes
1 answer
5k views

How to make async system function in the bevy game engine?

I am currently working on a 3D voxel-based game and I want to have procedural generated chunks based on player movement. But running the chunk generation in a simple system results in huge FPS drops. ...
BrunoWallner's user avatar
7 votes
1 answer
2k views

Is the default font in Bevy unusable?

When attempting to print "Hello, world!" to the screen with Bevy, the text would not display until I imported a third-party font file and loaded it as an asset to use as the font value in ...
Connor Mooneyhan's user avatar
7 votes
1 answer
640 views

Dot Zero call to timer in Rust/Bevy?

In the Bevy book the following code is used: struct GreetTimer(Timer); fn greet_people( time: Res<Time>, mut timer: ResMut<GreetTimer>, query: Query<&Name, With<Person>&...
BWStearns's user avatar
  • 2,686
7 votes
2 answers
8k views

Is there a way of detecting collision of Sprites in the bevy game engine?

Currently im using the Position of two objects (comets and the ship) to detect if they collide. fn collision_detection( comets: Query<&Transform, With<Comet>>, mut ships: Query&...
Bruno Wallner's user avatar
7 votes
2 answers
8k views

Get all components of entity

Is it possible to get a list of components by having Entity in bevy rust? For example for debugging purposes. use bevy::prelude::*; fn main() { App::build() .add_plugins(DefaultPlugins) ...
simens_green's user avatar
7 votes
1 answer
721 views

How to manipulate the rendergraph in Bevy

I would like to be able to get the previously rendered frame and use that as a sampler in the current frame. There is a good set of example code in the Bevy repository to show me how to apply custom ...
vivichrist's user avatar
6 votes
1 answer
4k views

Proper way to keep assets loaded in Bevy engine using Handle and using the assets later?

I am learning Rust and Bevy engine, and I want to keep certain assets (such as Fonts) loaded during the entire application life-time. // Resource for fonts: #[derive(Default, Clone)] pub struct ...
NameOfLord's user avatar
6 votes
1 answer
5k views

How can I despawn an entity in bevy 0.5.0 that was spawned with commands.spawn_bundle()

This is a very simple question. I already rewrote my code to work with the syntax and other changes, that came with the new version of bevy. Everything seems to work when compiling, except the ...
Bruno Wallner's user avatar
6 votes
1 answer
2k views

How can you change a SpriteComponent color?

I have a query system that finds an object in which the mouse is over. This is not a button, but, I wish to change the color. I'm not sure where to start. What property would I query and how would I ...
STF_ZBR's user avatar
  • 647
6 votes
1 answer
3k views

How do I modify a mesh after it has been created in bevy rust?

I am working on a procedural generation system and want to be able to modify a mesh frame by frame in bevy rust. I have tried using assets.get_mut() however this results in an error: help: trait `...
Xzenotrex's user avatar
5 votes
3 answers
6k views

Bevy rotation in 2D

I'm trying to use Bevy 0.3, and I'm able to use the built-in transforms easily with Camera2dComponents::default(). This is top-down 2D. The issue is trying to synchronise the player's rotation to the ...
Ulrar's user avatar
  • 953
5 votes
3 answers
4k views

What is an acceptable approach to dragging sprites with Bevy 0.4?

While trying out Bevy, I had the need for dragging and dropping sprites. Unfortunately, this does not seem to come ready made or I did not find it in the documentation. What would be the most ...
MKroehnert's user avatar
  • 3,717
5 votes
2 answers
2k views

How to fix Bevy ECS queries conflicting even with filters

I am trying to execute the below two queries in a bevy system function. fn move_player( mut player_query: Query<(&mut Velocity, &mut Transform, &SpriteSize, &Player), With<...
simplelenz's user avatar
5 votes
1 answer
3k views

Error building alsa-sys and libudev-sys for Bevy

I am trying to get started with bevy, I have set up the environment as suggested by the bevy book including using the nightly tool chain. However, when I try to build bevy I get the messages: error: ...
Pioneer_11's user avatar
  • 1,026
5 votes
2 answers
2k views

Why are Bevy's Trait bounds not satisfied for the Rapier physics plugin?

I've been trying to run this minimal example to get Rapier's physics working with Bevy: use bevy::prelude::*; use bevy_rapier2d::prelude::*; fn main() { App::new() .add_plugins(...
TechPerson's user avatar
5 votes
1 answer
2k views

Is there a way to create "render texture" in Bevy?

I'd like to create a portal-like effect using Bevy. It seems Unity has a render texture to achieve that. Is there a way to do the equivalent in Bevy? If not, is there a plan to support that in the ...
whale9490's user avatar
5 votes
1 answer
3k views

Get width and height from an image in Bevy

I am fairly new to Bevy and rust. I want to load an png image and get the width and height of it. The code below does not print "found resource ...". fn setup( mut commands: Commands, ...
Michael's user avatar
  • 922
5 votes
1 answer
1k views

Bevy Vertex Colored Shader

I'm a newbie to shaders, and I'm trying to build a vertex colored shader in Bevy. Fortunately one of the bevy examples goes through how to use a custom shader, and creates a vertex colored shader, but ...
Joe Fioti's user avatar
  • 441
4 votes
1 answer
4k views

Why does this bevy project take so long to compile and launch?

I started following this tutorial on how to make a game in bevy. The code compiles fine, but it's still pretty slow (I'm honestly not sure if that's normal, it takes around 8 seconds), but when I ...
NaniNoni's user avatar
  • 175
4 votes
1 answer
1k views

How to flip a spritesheet in Bevy

I am trying to flip a sprite based on whether the player is moving left or right on the screen. My current approach of modifying the transform of the SpriteSheetComponents as follows does not seem to ...
EtTuBrute's user avatar
  • 502
4 votes
2 answers
6k views

How to rotate and move object in bevy

I want to rotate my object by a given amount and translate it forward to create a steerable tank. I couldn't find out how to do it, all the matrices, vectors, and quaternions make it difficult for me ...
Redline's user avatar
  • 511
4 votes
1 answer
5k views

How to add a background image to 2d game in Bevy

How can I add a background image to my 2d game? The code is here: https://github.com/mthelm85/game In assets/textures I have a file called pitch.png that I would like to serve as the background for my ...
mthelm85's user avatar
  • 151
4 votes
1 answer
1k views

Rust (Bevy): ECS Network data structure

I am not quite sure if I completely understand the Entity Component System approach, and probably that is one of the reasons for the emergence of this question. Still struggling with the OOP mindset! ...
Sergio Cavaleiro Costa's user avatar
4 votes
1 answer
2k views

How to use geometry-instancing in Bevy?

I am rendering a point-cloud using Bevy, but currently spawning a icoshpere for each point, which gets quite slow with 775k points. What is the easiest way to use mesh instancing to reduce overhead? ...
Redline's user avatar
  • 511
4 votes
1 answer
2k views

How to connect bevy game to externel TCP server using tokios async TcpStream?

I want to send Events between the game client and server and I already got it working, but I do not know how to do it with bevy. I am dependent to use tokios async TcpStream, because I have to be able ...
BrunoWallner's user avatar
4 votes
1 answer
2k views

Fastest way to deal with many sprites in bevy-engine

I am building a Cellular Automata visualization "game" with Rust and the BevyEngine. Currently, when initializing the world, I spawn a sprite for every cell. Within each update the sprites ...
Voß's user avatar
  • 103
4 votes
4 answers
5k views

How can I draw multiple(10000) cubes in the bevy game engine for my 3D voxel game?

When i create a 100 x 100 chunk of cubes in bevy it is only able to maintain like 10 fps. Even if i replace the cubes with something more simple like planes i dont get any better performance out of ...
Bruno Wallner's user avatar
4 votes
1 answer
678 views

Higher ranked trait bounds and function parameters

I'm trying to understand the implementation of Bevy's IntoForEachSystem trait and the way it interacts with the underlying Hecs Query and Fetch traits. Hecs has query types (the thing you request in a ...
Tim Robinson's user avatar
  • 54.3k
4 votes
1 answer
270 views

Is there a way to hide window while game is starting in Bevy?

When running game in Bevy: At startup, I see a big window with white rectangle in it. After a few seconds my WindowDescriptor kicks in, and the window is resized to the dimensions that I want. Is ...
jm.'s user avatar
  • 23.6k
4 votes
0 answers
792 views

Render Blender / gltf model including colors using Bevy

I'm doing my first steps with Bevy aiming for "settlers" or "anno 18xx" kind of simulation. I have a tree model, that I exported from Blender as gltf. The tree has a brown trunk ...
Achim's user avatar
  • 15.6k
4 votes
1 answer
657 views

Dll lookup fails on application load time

I'm trying to follow bevy's tutorial and setup everything on Windows 10 (21H1) x64. The setup kinda works. I did the following build optimizations (from bevy's tutorial): bevy's dynamic link feature ...
Timo's user avatar
  • 9,655
3 votes
3 answers
3k views

How to use Windowdescriptor in Bevy?

use bevy::prelude::*; fn main() { App::new() .add_plugins(DefaultPlugins) .insert_resource(WindowDescriptor{ width: 140.0, height:140.0, title: ...
Sarang Dutta's user avatar
3 votes
2 answers
4k views

In the Bevy Engine, how do I use &mut queries in the for-each system?

When extending a basic example with the mutating of a component, I tried adding &mut to a component parameter in a system. However, this triggered the no method "system" found error. My ...
Ty Overby's user avatar
3 votes
2 answers
4k views

Bevy How to Render Triangle (or Polygon) in 2D

In the bevy examples breakout only uses rectangles, there are examples of loading sprites, there is an example of loading a 3d mesh. In 2d I'd like to draw a triangle (or other polygons), but I haven'...
Jay Anderson's user avatar
3 votes
1 answer
2k views

Is there a way to do complex queries in Bevy ECS?

is it possible to create complex queries that directly filter by the value of a field in a component? For example, say - I have a 2D board game (say chess or something), and I want to figure out if ...
nir shahar's user avatar
3 votes
1 answer
1k views

How to modify a component in Bevy when using get_single()?

I am making a simple top-down "bullet hell" game with Bevy. I've tried to create a system that takes care of the player's dashing like this: fn player_dashing_system( kb: Res<Input<...
Jove's user avatar
  • 105
3 votes
2 answers
2k views

Bevy text isn't displayed and I don't know why

Hello everyone I am trying write the score in the top left corner of the window but for some reason it is not working. Here is the code I used to spawn the text: commands .spawn(TextBundle{ text: ...
Nakroxis's user avatar
3 votes
1 answer
3k views

Compiling bevy_dylib v0.5.0 error: linking with `cc` failed: exit status: 1

On Mac freshly upgraded to Monterey, I'm getting the following when attempting to cargo run a trivial Bevy program. I've reinstalled XCode CLTs like recommended here and other places. I've tried ...
BWStearns's user avatar
  • 2,686
3 votes
1 answer
2k views

How do I spawn children into an existing component? [closed]

Assume I have something like this: use bevy::prelude::*; // Bevy style tag struct &CharacterBox; // Somewhere to store the entity pub struct Action { pub character_box: Option<Entity>, ...
ippi's user avatar
  • 10.1k
3 votes
0 answers
157 views

Seams on noise WGSL shader, porting gdshader to wgsl (bevy)

left is wgsl, right is gdshader Bevy MRE here I am trying to port a water shader written in gdshader to WGSL (in Bevy). However I noticed that there is some seaming going on. After some time I figured ...
Racid's user avatar
  • 363
3 votes
0 answers
1k views

How to rotate a 3d mesh around local origin in Bevy

So it seems in Bevy when I use the rotate function 3d objects rotate around the global origin. My current solution is the following where I first set the objects position to the global origin, rotate ...
nic96's user avatar
  • 31
2 votes
2 answers
5k views

How to remove/delete/drop a component across all entities

As part of setup, I'll be generating a component that will then be used to finish the setup of other components. That component will no longer be needed, after that point. So, is there a way of ...
mako's user avatar
  • 1,302