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 avian.
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 avian.
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 avian.
Related Issues (20)
- Make `AncestorMarker` reflect `Component` and add it to the type registry.
- Add `with_included_entities` to the SpatialQuery system param
- GravityScale::default() should be 1.0
- Implement joint motors
- Implement multibody joints, aka articulations
- Implement ground detection
- Implement a component for configuring which types of bodies a collider can collide with HOT 1
- Negative scales coming from an ancestor are ignored by colliders HOT 3
- `RayCaster.ignore_self` doesn't ignore colliders in children HOT 1
- Unexpected behavior with `LockedAxes` and rotations after upgrading from `0.1.0` to `0.1.1` HOT 1
- Make physics entity creation more difficult to mess up HOT 1
- Document components and resources needed for rollback HOT 1
- Incorrect CenterOfMass for ColliderConstructorHierarchy with scale up transform
- Make collision reporting opt-in HOT 2
- No error if entity has transform but not global transform.
- 3D friction behaves unrealistically
- ~Question~ Can you construct custom collision shapes? HOT 1
- LockedAxes break ExternalTorque
- really bad debug-render performance
- Difficulty with Implementing Damping and Movement in Spacecraft Using Avian
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 avian.