Code Monkey home page Code Monkey logo

bevy_mod_raycast's Introduction

Raycasting for Bevy

CI crates.io docs.rs Bevy tracking

raycast_demo

A Bevy plugin for 3D ray casting against meshes. Used to build bevy_mod_picking. Contributions welcome!

Uses

This plugin makes it simple to create ray casting sources, such as a transform (first person, third person shooter), or screenspace coordinates (mouse picking). Rays are shot from these sources every frame using a bevy system, and the intersections are stored in the ray casting source's component.

  • Only meshes that you mark with a component will be checked for intersections.
  • You can define which ray casting source(s) should interact with which mesh(es) by marking grouped sources and targets with the same type.
  • This plugin also provides some functionality to compute the intersection of rays with primitive shapes.
  • Acceleration is provided using Bevy's AABBs and visibility culling.

Alternatives

For a more full featured and performant option, consider using bevy_rapier. Note that rapier is a full physics engine that can also do raycasting; by contrast, this crate prioritizes simplicity and ergonomics.

Bevy Version Support

I intend to track the main branch of Bevy. PRs supporting this are welcome!

bevy bevy_mod_raycast
0.10 0.8
0.9 0.7
0.8 0.6
0.7 0.4, 0.5
0.6 0.3
0.5 0.2
0.4 0.1

Examples

Mouse picking using a ray cast built using screen space coordinates:

cargo run --example mouse_picking

Mouse picking using a ray cast built using screen space coordinates, for 2D meshes:

cargo run --example mouse_picking_2d

Ray casting from a camera using ray casts from the camera entity's GlobalTransform:

cargo run --example minimal

Manually compute raycast against primitive shape, and check for line-of-sight visibility

cargo run --example ray_intersection_over_mesh

Optimization Mouse picking over many meshes using AABBs:

cargo run --example bounding_volume

Optimization Mouse picking over complicated mesh using simplified mesh for the raycasting:

cargo run --example simplified_mesh

bevy_mod_raycast's People

Contributors

aevyrie avatar mockersf avatar striezel avatar mxgrey avatar siler avatar therawmeatball avatar ratysz avatar courtneyabraham avatar shatur avatar jakobhellermann avatar jim-ec avatar obsgolem avatar ctrlfct avatar theklanc avatar mcobzarenco avatar nsabovic avatar olegomon avatar sarthaksingh31 avatar soerenmeier avatar toniman575 avatar parnikainsight avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.