camera sorta works using the old voxel-raycaster style of spherical coords
This commit is contained in:
30
src/main.rs
30
src/main.rs
@@ -124,7 +124,7 @@ fn main() {
|
||||
resources.insert(renderer);
|
||||
|
||||
let (physics_state, physics_pipeline) =
|
||||
PhysicsState::build(rapier3d::math::Vector::new(0.0, 0.0, -9.81));
|
||||
PhysicsState::build(rapier3d::math::Vector::new(0.0, -9.81, 0.0));
|
||||
resources.insert(physics_state);
|
||||
resources.insert(physics_pipeline);
|
||||
|
||||
@@ -249,14 +249,14 @@ pub fn entity_loading(world: &mut World, renderer: &mut Renderer) {
|
||||
let camera_ent: Entity = world.push((
|
||||
Camera {
|
||||
position: Point3 {
|
||||
x: 5.0,
|
||||
y: 5.0,
|
||||
z: 5.0
|
||||
x: 0.0,
|
||||
y: 0.0,
|
||||
z: 10.0
|
||||
},
|
||||
yaw: Rad(0.0),
|
||||
pitch: Rad(-75.0)
|
||||
yaw: Rad(-PI),
|
||||
pitch: Rad(PI/2.0)
|
||||
},
|
||||
CameraController::new(1.0, 1.0),
|
||||
CameraController::new(3.0, 1.0),
|
||||
));
|
||||
|
||||
let light_entity: Entity = world.push((
|
||||
@@ -287,7 +287,7 @@ pub fn entity_loading(world: &mut World, renderer: &mut Renderer) {
|
||||
let monkey_entity: Entity = world.push((
|
||||
Position {
|
||||
x: 1.0,
|
||||
y: 2.0,
|
||||
y: 5.0,
|
||||
z: 2.0,
|
||||
rot: Quaternion::from(Euler {
|
||||
x: Deg(90.0),
|
||||
@@ -313,26 +313,20 @@ pub fn entity_loading(world: &mut World, renderer: &mut Renderer) {
|
||||
|
||||
let mut static_floor_body = RigidBodyBuilder::new_static()
|
||||
.position(Isometry3::new(
|
||||
Vector3::new(0.0, 0.0, 0.0),
|
||||
Vector3::new(0.0, -8.0, 0.0),
|
||||
Vector::y() * PI,
|
||||
))
|
||||
.build();
|
||||
|
||||
let ball_collider = ColliderBuilder::ball(1.5).build();
|
||||
let floor_collider = ColliderBuilder::cuboid(0.5, 0.2, 0.1).build();
|
||||
let floor_collider = ColliderBuilder::cuboid(10.0, 0.2, 10.0).build();
|
||||
|
||||
//let mut dynamic_ball_body_handle = bodies.insert(dynamic_ball_body);
|
||||
//let mut static_floor_body_handle = bodies.insert(static_floor_body.clone());
|
||||
|
||||
// let ball_collider_handle = colliders.insert(ball_collider, dynamic_ball_body_handle, &mut bodies);
|
||||
// let floor_collider_handle = colliders.insert(floor_collider, dynamic_ball_body_handle, &mut bodies);
|
||||
|
||||
let plane_mesh = renderer.create_plane(7.0);
|
||||
let plane_mesh = renderer.load_mesh_to_buffer("./resources/plane.obj");
|
||||
|
||||
let plane_entity: Entity = world.push((
|
||||
Position {
|
||||
x: 0.0,
|
||||
y: 0.0,
|
||||
y: -8.0,
|
||||
z: 0.0,
|
||||
rot: Quaternion::from(Euler {
|
||||
x: Deg(0.0),
|
||||
|
||||
Reference in New Issue
Block a user