WIP fixing axis/rotation of scene imports from blender files
This commit is contained in:
parent
1291971f38
commit
7ae7a1dd8b
BIN
assets/models/xyzaxis.glb
Normal file
BIN
assets/models/xyzaxis.glb
Normal file
Binary file not shown.
Binary file not shown.
BIN
src/blender/xyzaxis.blend
Normal file
BIN
src/blender/xyzaxis.blend
Normal file
Binary file not shown.
70
src/cmd.rs
70
src/cmd.rs
|
@ -747,22 +747,33 @@ fn spawn_scenes(
|
|||
for (name, template, pos, rot) in scene_defs {
|
||||
let pos = DVec3::new(
|
||||
root_state.pos[0] + pos[0],
|
||||
root_state.pos[1] - pos[2],
|
||||
root_state.pos[2] + pos[1],
|
||||
root_state.pos[1] + pos[2],
|
||||
root_state.pos[2] - pos[1],
|
||||
);
|
||||
if Some(name.to_string()) == root_state.name {
|
||||
match template {
|
||||
"cruiser" => {
|
||||
let mut state = ParserState::default();
|
||||
state.class = DefClass::Actor;
|
||||
state.pos = pos;
|
||||
state.model = Some("cruiser".to_string());
|
||||
|
||||
state.rotation = Quat::from_euler(EulerRot::XYZ, rot[0], rot[1], rot[2]);
|
||||
|
||||
// command: relativeto ?
|
||||
//orig state.rotation = Quat::from_euler(EulerRot::XYZ, rot[0], rot[2], rot[1]);
|
||||
//state.rotation = Quat::from_euler(EulerRot::ZXY, rot[0], rot[2], -rot[1]);
|
||||
//almost state.rotation = Quat::from_euler(EulerRot::YXZ, rot[0], rot[2], -rot[1]);
|
||||
//no state.rotation = Quat::from_euler(EulerRot::YZX, rot[0], rot[2], -rot[1]);
|
||||
//no state.rotation = Quat::from_euler(EulerRot::ZYX, rot[0], rot[2], -rot[1]);
|
||||
//no state.rotation = Quat::from_euler(EulerRot::XZY, rot[0], rot[2], -rot[1]);
|
||||
//state.rotation = Quat::from_euler(EulerRot::YXZ, rot[2], rot[0], -rot[1]);
|
||||
//allbutlast state.rotation = Quat::from_euler(EulerRot::ZYX, -rot[1], rot[2], rot[0]);
|
||||
//state.rotation = Quat::from_euler(EulerRot::XZY, rot[0], -rot[1], rot[2]);
|
||||
// state.rotation = Quat::from_euler(EulerRot::XYZ, rot[0], rot[2], -rot[1]);
|
||||
//aaalmost state.rotation = Quat::from_euler(EulerRot::YXZ, rot[2], rot[0], -rot[1]);
|
||||
// state.rotation = Quat::from_euler(EulerRot::ZXY, -rot[1], rot[0], rot[2]);
|
||||
state.rotation = Quat::from_euler(EulerRot::YZX, rot[2], -rot[1], rot[0]);
|
||||
// state.rotation = Quat::from_euler(EulerRot::ZYX, -rot[1], rot[2], rot[0]);
|
||||
state.relative_to = root_state.relative_to.clone();
|
||||
|
||||
match template {
|
||||
"cruiser" => {
|
||||
state.model = Some("cruiser".to_string());
|
||||
|
||||
// command: name Cruiser
|
||||
state.name = Some("Cruiser".to_string());
|
||||
|
||||
|
@ -796,19 +807,12 @@ fn spawn_scenes(
|
|||
|
||||
// command: pointofinterest yes
|
||||
state.is_point_of_interest = true;
|
||||
|
||||
ew_spawn.send(SpawnEvent(state));
|
||||
}
|
||||
"shippingcontainer" => {
|
||||
let mut state = ParserState::default();
|
||||
state.class = DefClass::Actor;
|
||||
state.pos = pos;
|
||||
state.model = Some("shippingcontainer".to_string());
|
||||
|
||||
state.rotation = Quat::from_euler(EulerRot::XYZ, rot[0], rot[1], rot[2]);
|
||||
|
||||
// command: relativeto ?
|
||||
state.relative_to = root_state.relative_to.clone();
|
||||
|
||||
// command: name Cruiser
|
||||
state.name = Some("Shipping Container".to_string());
|
||||
|
||||
|
@ -824,20 +828,11 @@ fn spawn_scenes(
|
|||
// command: density 500
|
||||
state.density = 500.0;
|
||||
|
||||
// command: pointofinterest yes
|
||||
ew_spawn.send(SpawnEvent(state));
|
||||
}
|
||||
"fueltank" => {
|
||||
let mut state = ParserState::default();
|
||||
state.class = DefClass::Actor;
|
||||
state.pos = pos;
|
||||
state.model = Some("fueltank".to_string());
|
||||
|
||||
state.rotation = Quat::from_euler(EulerRot::XYZ, rot[0], rot[1], rot[2]);
|
||||
|
||||
// command: relativeto ?
|
||||
state.relative_to = root_state.relative_to.clone();
|
||||
|
||||
// command: name "Fuel Tank"
|
||||
state.name = Some("Fuel Tank".to_string());
|
||||
|
||||
|
@ -860,10 +855,29 @@ fn spawn_scenes(
|
|||
// command: chat_achievement no
|
||||
state.chat_counts_towards_achievements = false;
|
||||
|
||||
// command: pointofinterest yes
|
||||
ew_spawn.send(SpawnEvent(state));
|
||||
}
|
||||
_ => {}
|
||||
"xyz" => {
|
||||
state.model = Some("xyzaxis".to_string());
|
||||
|
||||
// command: name "XYZAxis"
|
||||
state.name = Some("XYZAxis".to_string());
|
||||
|
||||
// command: scale 5
|
||||
state.model_scale = 2.0;
|
||||
|
||||
// command: angularmomentum 0 0 0
|
||||
state.angular_momentum = DVec3::ZERO;
|
||||
|
||||
// command: collider mesh
|
||||
state.collider_is_one_mesh_of_scene = true;
|
||||
state.collider_is_mesh = true;
|
||||
|
||||
ew_spawn.send(SpawnEvent(state));
|
||||
}
|
||||
_ => {
|
||||
error!("Can't find template named `{template}' in cmd::spawn_scenes!");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -321,12 +321,12 @@ actor 0 59305 0 suitv2
|
|||
wants maxvelocity none
|
||||
oxygen 0.008
|
||||
health 0.3
|
||||
rotationy 135
|
||||
rotationy 180
|
||||
|
||||
scene 10 -30 20 test
|
||||
relativeto player
|
||||
|
||||
actor 700 -100 -1100 suitv2
|
||||
actor 0 0 -300 suitv2
|
||||
template person
|
||||
relativeto player
|
||||
name Luna
|
||||
|
|
|
@ -2,8 +2,16 @@
|
|||
// DO NOT MODIFY MANUALLY, CHANGES WILL BE OVERWRITTEN!
|
||||
[
|
||||
("test", "cruiser", [0.0, 0.0, 0.0], [0.0, 0.0, 0.0]),
|
||||
("workshop", "fueltank", [21.132, -24.376015, 0.0], [1.1160387, -1.308411, -0.9967722]),
|
||||
("workshop", "shippingcontainer", [0.0, 0.0, 0.0], [-0.026294278, 0.000376441, 0.014312184]),
|
||||
("workshop", "shippingcontainer", [0.0, 12.0, 0.0], [-0.053937975, -0.013098141, 0.0]),
|
||||
("workshop", "shippingcontainer", [0.0, -12.0, 0.0], [0.061487854, 0.08236491, -0.051188234]),
|
||||
("workshop", "fueltank", [21.074543, -2.4312592, -4.7432747], [1.609848, 0.008555692, 1.646027]),
|
||||
("workshop", "shippingcontainer", [-1.6206985, 12.010283, -2.9834328], [-0.02629428, 0.00037644096, 1.7372935]),
|
||||
("workshop", "shippingcontainer", [-13.479424, 10.191104, -8.136984], [-0.05393797, -0.013098141, 1.7229813]),
|
||||
("workshop", "shippingcontainer", [10.243189, 13.829462, -4.302782], [0.061487854, 0.08236491, 1.6717931]),
|
||||
("workshop", "xyz", [7.73461, -19.380116, -8.103504], [0.43633232, 1.0471976, 2.0943952]),
|
||||
("workshop", "xyz", [-18.857063, -94.26912, -13.345884], [0.0, 0.0, 0.0]),
|
||||
("workshop", "xyz", [-12.792587, -94.26912, -13.345884], [1.5707964, 0.0, 0.0]),
|
||||
("workshop", "xyz", [-6.138853, -94.26912, -13.345884], [0.0, 1.5707964, 0.0]),
|
||||
("workshop", "xyz", [-0.7364948, -94.26912, -13.345884], [0.0, 0.0, 1.5707964]),
|
||||
("workshop", "xyz", [3.9053717, -94.26912, -13.345884], [1.5707964, 1.5707964, 0.0]),
|
||||
("workshop", "xyz", [9.347175, -94.26912, -13.345884], [1.5707964, 0.0, 1.5707964]),
|
||||
("workshop", "xyz", [15.39941, -94.26912, -13.345884], [0.0, 1.5707964, 1.5707964]),
|
||||
]
|
||||
|
|
|
@ -65,6 +65,7 @@ pub fn asset_name_to_path(name: &str) -> &'static str {
|
|||
"point_of_interest" => "models/point_of_interest.glb#Scene0",
|
||||
"metis" => "models/metis.gltf#Scene0",
|
||||
"thebe" => "models/thebe.gltf#Scene0",
|
||||
"xyzaxis" => "models/xyzaxis.glb#Scene0",
|
||||
_ => "models/error.glb#Scene0",
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue