Fixed radar arrow
parent
129b134114
commit
7e41383ea9
|
@ -294,11 +294,9 @@ impl Radar {
|
|||
let q = Point2::new(0.0, 0.0) - self.last_player_position;
|
||||
let m = q.magnitude();
|
||||
if m > 200.0 {
|
||||
let player_angle = q.angle(&Vector2::new(0.0, 1.0));
|
||||
|
||||
let position: Point2<f32> =
|
||||
Point2::new(radar_size / 2.0 + 10.0, radar_size / -2.0 - 10.0)
|
||||
+ ((q.normalize() * 0.865) * (radar_size / 2.0));
|
||||
let angle = clockwise_angle(&Vector2::new(1.0, 0.0), &q);
|
||||
let position = Point2::new(10.0 + (radar_size / 2.0), -10.0 - (radar_size / 2.0))
|
||||
+ Rotation2::new(angle) * Vector2::new(0.915 * (radar_size / 2.0), 0.0);
|
||||
|
||||
if state.vertex_buffers.ui_counter as u64 > UI_SPRITE_INSTANCE_LIMIT {
|
||||
// TODO: no panic, handle this better.
|
||||
|
@ -311,7 +309,7 @@ impl Radar {
|
|||
bytemuck::cast_slice(&[UiInstance {
|
||||
anchor: PositionAnchor::NwC.to_int(),
|
||||
position: position.into(),
|
||||
angle: -player_angle,
|
||||
angle,
|
||||
size: 10.0,
|
||||
color: [1.0, 1.0, 1.0, 1f32.min((m - 200.0) / 400.0)],
|
||||
sprite_index: arrow_sprite.get_index(),
|
||||
|
|
Loading…
Reference in New Issue