Get transforms into the right order
This commit is contained in:
parent
0f16adaa2d
commit
7a8476e7f7
2 changed files with 7 additions and 11 deletions
|
@ -22,5 +22,5 @@ I just started doing it. That means it isn't very usable right now. I'm working
|
||||||
* [rFactor 2 Modding Resources](https://www.studio-397.com/modding-resources/)
|
* [rFactor 2 Modding Resources](https://www.studio-397.com/modding-resources/)
|
||||||
* [rF2SharedMemoryMapPlugin](https://github.com/TheIronWolfModding/rF2SharedMemoryMapPlugin)
|
* [rF2SharedMemoryMapPlugin](https://github.com/TheIronWolfModding/rF2SharedMemoryMapPlugin)
|
||||||
* [rF2SharedMemoryMapPlugin_Wine](https://github.com/schlegp/rF2SharedMemoryMapPlugin_Wine)
|
* [rF2SharedMemoryMapPlugin_Wine](https://github.com/schlegp/rF2SharedMemoryMapPlugin_Wine)
|
||||||
* [CrewChief](https://github.com/mrbelowski/CrewChiefV4)
|
* [CrewChief](https://gitlab.com/mr_belowski/CrewChiefV4/-/tree/master/CrewChiefV4)
|
||||||
* [OpenSimHud](https://github.com/schlegp/OpenSimHud)
|
* [OpenSimHud](https://github.com/schlegp/OpenSimHud)
|
||||||
|
|
|
@ -250,7 +250,8 @@ impl RFactorData {
|
||||||
buffered_car.update(
|
buffered_car.update(
|
||||||
self.ortho,
|
self.ortho,
|
||||||
offset,
|
offset,
|
||||||
other_position.rotation - player_position.rotation,
|
player_position.rotation,
|
||||||
|
other_position.rotation,
|
||||||
self.radar_center,
|
self.radar_center,
|
||||||
self.car_width,
|
self.car_width,
|
||||||
self.car_height,
|
self.car_height,
|
||||||
|
@ -335,8 +336,10 @@ impl RadarObject {
|
||||||
|
|
||||||
pub fn update(
|
pub fn update(
|
||||||
&self,
|
&self,
|
||||||
|
|
||||||
ortho: Matrix4<f32>,
|
ortho: Matrix4<f32>,
|
||||||
offset: Vector2<f32>,
|
offset: Vector2<f32>,
|
||||||
|
player_rotation: impl Into<Deg<f32>>,
|
||||||
rotation: impl Into<Deg<f32>>,
|
rotation: impl Into<Deg<f32>>,
|
||||||
radar_center: Vector2<f32>,
|
radar_center: Vector2<f32>,
|
||||||
car_width: f32,
|
car_width: f32,
|
||||||
|
@ -347,6 +350,7 @@ impl RadarObject {
|
||||||
.fill(&RFactorData::create_car_vertices(
|
.fill(&RFactorData::create_car_vertices(
|
||||||
ortho
|
ortho
|
||||||
* Matrix4::from_translation(radar_center.extend(0.0))
|
* Matrix4::from_translation(radar_center.extend(0.0))
|
||||||
|
* Matrix4::from_angle_z(-player_rotation.into())
|
||||||
* Matrix4::from_translation(offset.extend(0.0))
|
* Matrix4::from_translation(offset.extend(0.0))
|
||||||
* Matrix4::from_angle_z(rotation.into()),
|
* Matrix4::from_angle_z(rotation.into()),
|
||||||
car_width,
|
car_width,
|
||||||
|
@ -368,7 +372,6 @@ impl RenderObject for RadarObject {
|
||||||
|
|
||||||
struct CarPosition {
|
struct CarPosition {
|
||||||
pub position: Vector3<f32>,
|
pub position: Vector3<f32>,
|
||||||
pub orientation: [Vector3<f32>; 3],
|
|
||||||
pub rotation: Rad<f32>,
|
pub rotation: Rad<f32>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -376,13 +379,7 @@ impl CarPosition {
|
||||||
fn new(position: Vector3<f32>, orientation: [Vector3<f32>; 3]) -> Self {
|
fn new(position: Vector3<f32>, orientation: [Vector3<f32>; 3]) -> Self {
|
||||||
Self {
|
Self {
|
||||||
position,
|
position,
|
||||||
rotation: {
|
rotation: Rad(orientation[2].x.atan2(orientation[2].y)),
|
||||||
const DEGREES_IN_RADIAN: f32 = 57.2957795;
|
|
||||||
let xz_val = orientation[2].xz();
|
|
||||||
|
|
||||||
Rad(xz_val.x.atan2(xz_val.y) * DEGREES_IN_RADIAN)
|
|
||||||
},
|
|
||||||
orientation,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -391,7 +388,6 @@ impl Default for CarPosition {
|
||||||
fn default() -> Self {
|
fn default() -> Self {
|
||||||
Self {
|
Self {
|
||||||
position: vec3(0.0, 0.0, 0.0),
|
position: vec3(0.0, 0.0, 0.0),
|
||||||
orientation: [vec3(0.0, 0.0, 0.0); 3],
|
|
||||||
rotation: Rad(0.0),
|
rotation: Rad(0.0),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue