Fixed sprite rotation
parent
6406fd8786
commit
0289031c88
|
@ -48,10 +48,10 @@ fn vertex_main(
|
||||||
vertex.position.y * scale
|
vertex.position.y * scale
|
||||||
);
|
);
|
||||||
|
|
||||||
// Apply rotation
|
// Apply rotation (and adjust sprite angle, since sprites point north)
|
||||||
pos = mat2x2(
|
pos = mat2x2(
|
||||||
vec2(cos(instance.angle), sin(instance.angle)),
|
vec2(cos(instance.angle - 1.5708), sin(instance.angle - 1.5708)),
|
||||||
vec2(-sin(instance.angle), cos(instance.angle))
|
vec2(-sin(instance.angle - 1.5708), cos(instance.angle - 1.5708))
|
||||||
) * pos;
|
) * pos;
|
||||||
|
|
||||||
// Correct for screen aspect, preserving height
|
// Correct for screen aspect, preserving height
|
||||||
|
|
|
@ -227,7 +227,7 @@ impl Radar {
|
||||||
(radar_size / -2.0 - 10.0) + d.y,
|
(radar_size / -2.0 - 10.0) + d.y,
|
||||||
)
|
)
|
||||||
.into(),
|
.into(),
|
||||||
angle: 0.0,
|
angle: to_radians(90.0),
|
||||||
size,
|
size,
|
||||||
color,
|
color,
|
||||||
sprite_index: sprite.get_index(),
|
sprite_index: sprite.get_index(),
|
||||||
|
@ -245,7 +245,7 @@ impl Radar {
|
||||||
(radar_size / -2.0 - 10.0) - d.y,
|
(radar_size / -2.0 - 10.0) - d.y,
|
||||||
)
|
)
|
||||||
.into(),
|
.into(),
|
||||||
angle: to_radians(90.0),
|
angle: to_radians(180.0),
|
||||||
size,
|
size,
|
||||||
color,
|
color,
|
||||||
sprite_index: sprite.get_index(),
|
sprite_index: sprite.get_index(),
|
||||||
|
@ -263,7 +263,7 @@ impl Radar {
|
||||||
(radar_size / -2.0 - 10.0) - d.y,
|
(radar_size / -2.0 - 10.0) - d.y,
|
||||||
)
|
)
|
||||||
.into(),
|
.into(),
|
||||||
angle: to_radians(180.0),
|
angle: to_radians(270.0),
|
||||||
size,
|
size,
|
||||||
color,
|
color,
|
||||||
sprite_index: sprite.get_index(),
|
sprite_index: sprite.get_index(),
|
||||||
|
@ -281,7 +281,7 @@ impl Radar {
|
||||||
(radar_size / -2.0 - 10.0) + d.y,
|
(radar_size / -2.0 - 10.0) + d.y,
|
||||||
)
|
)
|
||||||
.into(),
|
.into(),
|
||||||
angle: to_radians(270.0),
|
angle: to_radians(0.0),
|
||||||
size,
|
size,
|
||||||
color,
|
color,
|
||||||
sprite_index: sprite.get_index(),
|
sprite_index: sprite.get_index(),
|
||||||
|
|
Loading…
Reference in New Issue