~starkingdoms/starkingdoms

ref: 3f9784408f5c43e366106d0f547d80d9b33ffa37 starkingdoms/server/src/mathutil.rs -rw-r--r-- 299 bytes
3f978440 — ghostlyzsh attaching and despawning modules works 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)
}