-
Notifications
You must be signed in to change notification settings - Fork 2
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
Change the orbit target without move the camera #6
Comments
Hm, the current behavior of /// Sets target position in world space preserving eye position inclusive its roll attitude.
pub fn set_target(&mut self, pos: Point3<N>) {
let eye = self.eye();
let (new_dir, zat) = Unit::new_and_get(pos - eye);
let old_dir = Unit::new_normalize(self.pos - eye);
let rot = UnitQuaternion::rotation_between_axis(&old_dir, &new_dir)
.unwrap_or_else(|| UnitQuaternion::from_axis_angle(&self.yaw_axis(), N::pi()));
let rot = rot * self.rot;
*self = Self { pos, rot, zat }
} |
Have tried yet myself, with this rot, still moving to the center of the view. that's trange, can't figure out what's wrong. UnitQuaternion::rotation_between_axis(&old_dir, &new_dir) |
Ok, maybe I misunderstood you. Do you just want to move (translate) your cad model around? This can be achieved with the |
I want to keep the camera static, when changing the orbit center. When a object clicked, the orbit center is just assigned by the object center, no camera move. But now the camera moves with a click. |
The camera itself cannot store an orbit center (i.e. target) without looking at it. If you want to assign a new target without moving the camera, you have to store the new target separately and only apply it when you want the camera to move. The camera stores three elements:
|
Oh I see, I can use the second target when orbiting. But the logic will be complicated. If I can make the new look matrix just as it should be. The camera may mot move. |
Have you found a solution? I would try to use the Bevy ECS to store the target assignment as part of the camera bundle which can then be reassigned when clicking an object. |
Havent solved yet. |
I have a cad model manipulated by trackball crate, it works nice. But when I want to change the orbit center, the camera moves to forwad to the object target soon. I want to keep camera static when change the target. I used this function to change target:
The text was updated successfully, but these errors were encountered: