You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a simple scene, just the standard Bevy 3d example with the orbit controller added instead of the example's camera. When I zoom all the way in or out, I get a panic with an assertion failed in look_angles.rs:
repro scene:
use bevy::prelude::*;use smooth_bevy_cameras::{
controllers::orbit::{OrbitCameraBundle,OrbitCameraController,OrbitCameraPlugin},LookTransformPlugin,};fnmain(){App::build().add_plugins(DefaultPlugins).add_plugin(LookTransformPlugin).add_plugin(OrbitCameraPlugin::default()).add_startup_system(setup.system()).run();}fnsetup(mutcommands:Commands,mutmeshes:ResMut<Assets<Mesh>>,mutmaterials:ResMut<Assets<StandardMaterial>>,){// plane
commands.spawn_bundle(PbrBundle{mesh: meshes.add(Mesh::from(shape::Plane{size:5.0})),material: materials.add(Color::rgb(0.3,0.5,0.3).into()),
..Default::default()});// cube
commands.spawn_bundle(PbrBundle{mesh: meshes.add(Mesh::from(shape::Cube{size:1.0})),material: materials.add(Color::rgb(0.8,0.7,0.6).into()),transform:Transform::from_xyz(0.0,0.5,0.0),
..Default::default()});// light
commands.spawn_bundle(LightBundle{transform:Transform::from_xyz(4.0,8.0,4.0),
..Default::default()});// camera
commands.spawn_bundle(OrbitCameraBundle::new(OrbitCameraController::default(),PerspectiveCameraBundle::default(),Vec3::new(-2.0,2.5,5.0),Vec3::ZERO,));}
The text was updated successfully, but these errors were encountered:
I'm guessing the issue is that the radius_scalar in the orbit controller is somehow dropping to 0.0 and then when you try LookAngles::from_vector(transform.look_direaction()), the direction is the zero vector (since target = eye).
I took some time to debug it and realized it's actually an issue with normalizing very large vectors. When zoomed out very far, the LookTransform::look_direction will return zero because it is trying to normalize a large vector like:
I have a simple scene, just the standard Bevy 3d example with the orbit controller added instead of the example's camera. When I zoom all the way in or out, I get a panic with an assertion failed in
look_angles.rs
:repro scene:
The text was updated successfully, but these errors were encountered: