Comments (3)
I guess one workaround would be to just add documentation comments that specify that AngVel
(and other angular components) use radians, and hope that users understand not to use to_radians
. If we want to be more explicit, we can specifically mention that to_radians
probably won't do what you expect, since it's already in radians.
Something like this:
/// The angular velocity of a body, expressed in radians.
///
/// **Note**: Because the component's value is already in radians, calling the derived method `to_radians` will probably not produce the expected result.
#[cfg(feature = "2d")]
#[derive(Reflect, Clone, Copy, Component, Debug, Default, Deref, DerefMut, PartialEq, From)]
#[reflect(Component)]
pub struct AngVel(pub f32);
Like you said, we could also just remove Deref
, at least from the components that use radians, but I wouldn't remove it from every component because of ergonomics. Removing it from just a few components would reduce consistency though...
from bevy_xpbd.
Yeah, the reason it's particularly tempting is that we have Rot::from_radians
, so it's particularly tempting to try to call through your IDE's auto-completion, and I don't think warnings in the reference would help much then.
e.g. this fails:
let rot = Rot::from_radians(PI);
assert_relative_eq!(PI, rot.to_radians());
I think removing the deref impl would probably be best here... but let's maybe wait and see a bit.
from bevy_xpbd.
For now I'll just remove the Deref
impl from the 2D AngularVelocity
(see #46). I agree that it's probably the best way to go about this.
If someone has a better approach, feel free to reopen this issue.
from bevy_xpbd.
Related Issues (20)
- Rotational motion ignores center of mass HOT 3
- TriMeshFlags in AsyncColliders
- Entity are overlapping at spawn, which can result in explosive behavior. HOT 2
- ColliderDensity of 0 causes cast_ray to panic
- Support for joints with with local frames (anchor position + rotation) HOT 2
- [feature] Support for child entities enacting force on parent `RigidBody` HOT 2
- Unstable joint when attached body has multiple colliders
- Debug render axes "dot" is hard-coded to 0.5 radius in 2D
- Children entity collision handling is *weird*.
- Support for use within Bevy's FixedUpdate schedule? HOT 2
- Velocity decaying to zero causes sensors to stop colliding HOT 1
- Fluid Simulation HOT 3
- Spawn non-colliding entities HOT 5
- Collision between the character and the square in the kinematic_character_2d is wonky
- Disabling Collision of Bodies Connected with a Joint
- Make Sensor Component storage type a SparseSet
- allow `AsyncSceneCollider` to take non-computed `Collider`s
- Negative scale on transforms causes collider to stop detecting collisions.
- Raycast Does Not Follow Entity Transform Without Rigidbody
- Scaling of parent entity not effecting child collider
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from bevy_xpbd.