~starkingdoms/starkingdoms

ref: 760e6e6cf56e1a7c33811f1fbe1c4fd70a95d8af starkingdoms/server/src/mathutil.rs -rw-r--r-- 299 bytes
760e6e6c — core API CI builds (fix) 2 years ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
use bevy::math::{vec2, Vec2, Vec3};

pub fn rot2d(uncast: Vec2, angle: f32) -> Vec2 {
    vec2(
        uncast.x * angle.cos() - uncast.y * angle.sin(),
        uncast.x * angle.sin() + uncast.y * angle.cos(),
    )
}

pub fn v3_to_v2(downgrade: Vec3) -> Vec2 {
    vec2(downgrade.x, downgrade.y)
}