Adress feedback

- Rewrite 2 * PI to TAU
- Some comment formatting
This commit is contained in:
juliancoffee 2021-09-15 20:48:42 +03:00
parent d86c9f2678
commit 44962958d8
2 changed files with 3 additions and 6 deletions

View File

@ -866,7 +866,6 @@ impl<'a> PhysicsData<'a> {
// Oddities can occur on the intersection between multiple
// colliders, but it's not like any game physics system
// resolves these sort of things well anyway.
//
// At the very least, we don't do things that result in glitchy
// velocities or entirely broken position snapping.
let mut tgt_pos = pos.0 + pos_delta;

View File

@ -23,7 +23,7 @@ pub enum DebugShape {
impl DebugShape {
pub fn mesh(&self) -> Mesh<DebugVertex> {
use core::f32::consts::PI;
use core::f32::consts::{PI, TAU};
let mut mesh = Mesh::new();
let tri = |x: Vec3<f32>, y: Vec3<f32>, z: Vec3<f32>| {
Tri::<DebugVertex>::new(x.into(), y.into(), z.into())
@ -42,8 +42,7 @@ impl DebugShape {
for i in 0..SUBDIVISIONS {
// dot on circle edge
let to = |n: u8| {
const FULL: f32 = 2.0 * PI;
let angle = FULL * f32::from(n) / f32::from(SUBDIVISIONS);
let angle = TAU * f32::from(n) / f32::from(SUBDIVISIONS);
Vec3::new(radius * angle.cos(), radius * angle.sin(), 0.0)
};
@ -80,8 +79,7 @@ impl DebugShape {
for i in from..to {
// dot on circle edge
let to = |n: u8| {
const FULL: f32 = 2.0 * PI;
let angle = offset + FULL * f32::from(n) / f32::from(TOTAL);
let angle = offset + TAU * f32::from(n) / f32::from(TOTAL);
let (x, y) = (radius * angle.cos(), radius * angle.sin());
let to_edge = Vec3::new(x, y, 0.0);