-
-
Notifications
You must be signed in to change notification settings - Fork 469
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make nalgebra easier to use #727
Comments
Perhaps a method like body.set_position(body.position().translated(&(move_dir * dt))); Edit: See @sebcrozet's example below for what you can do with As for the general complexity of An unfortunate contributor to the complexity of |
First, here is the most concise way of doing what you are trying to do: body.set_position(Translation3::from(move_dir * dt) * body.position()); The
Though I agree this may not be clear enough, and would deserve some examples. There are a few reasons why nalgebra is not easy to use when you start with this crate. First nalgebra has a lot of features designed to be used in both generic and non-generic contexts. It covers most feature you would need from simple 2D/3D math, to complex operations like matrix decomposition. This results in a few issues:
The thing is that |
Thanks, I'll check out nalgebra-glm. |
Let's say I want to move a kinematic body in nphysics. RigidBody has a set_position function, sounds simple enough.
error[E0369]: cannot add `na::Matrix<f32, na::U3, na::U1, na::ArrayStorage<f32, na::U3, na::U1>>` to `&na::Isometry<f32, na::U3, na::Unit<na::Quaternion<f32>>>
Okay... What's an isometry? Oh I see, it represents translation and rotation. It's got some functions to transform points... ah! Append translation! That takes a Translation3... which I can convert a vector into. Oh, it's mut only, so I'll have to .to_owned...
There! Perfectly concise, readable code.
nalgebra is hard to use. Every user-facing type like Vector3 is actually something else behind six different type aliases and expands to garbage like
na::Matrix<f32, na::U3, na::U1, na::ArrayStorage<f32, na::U3, na::U1>>
in errors. For every line of code I write, I have to open two new tabs of documentation. For starters, I'd like to see more convenience functions and operators so that I don't have to do a billion conversions to get two things to interact with each other.The text was updated successfully, but these errors were encountered: