This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use bevy::{ | |
log::debug, | |
math::{Dir3, Vec3}, | |
}; | |
fn map_range(from_range: (f32, f32), to_range: (f32, f32), s: f32) -> f32 { | |
to_range.0 | |
+ (s - from_range.0) * (to_range.1 - to_range.0) | |
/ (from_range.1 - from_range.0) | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pub fn determine_next_heel_stage_surface( | |
rapier_context: &Res<RapierContext>, | |
root_position: Vec3, | |
root_rotation: Quat, | |
cast_origin_forward: f32, | |
cast_origin_down: f32, | |
cast_distance: f32, | |
cast_max_angle: f32, | |
) -> Option<StageSurfaceData> { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// Determine the next "step down" stage surface for a character. | |
/// | |
/// # Parameters | |
pub fn get_step_down_floor( | |
rapier_context: &RapierContext, | |
query_filter: QueryFilter, | |
root_source_translation: Vec3, | |
root_source_rotation: Quat, | |
wall_cast_origin_local_neg_y: f32, | |
wall_cast_distance: f32, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// translate and rotate a point around anhter | |
pub fn rotate_point_around_pivot( | |
point: Vec3, | |
pivot: Vec3, | |
rotation: Quat, | |
) -> Vec3 { | |
// Translate the point to the origin | |
let translated_point = point - pivot; | |
// Apply the rotation |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// determine next linear velocity for a character. | |
/// "with body" means veloicity is applied to the body. | |
// TODO move to avian3d_lib | |
pub fn determine_next_step_linear_velocity_for_rigidbody_with_body( | |
spatial_query: &SpatialQuery, | |
query_filter: SpatialQueryFilter, | |
start_root_global_translation: Vec3, | |
start_root_global_rotation: Quat, | |
body_shape: SharedShape, | |
body_local_translation: Vec3, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { ValueOf } from 'type-fest'; | |
/** | |
* a "type map" is a map of type tag/ discriminator to type. | |
* https://javascript.plainenglish.io/tagged-union-types-in-typescript-leveraging-type-safety-and-flexibility-be0e60145815 | |
* | |
* type maps are useful for creating event maps or action maps. | |
* | |
* Actions as in Redux action: https://redux.js.org/tutorials/fundamentals/part-2-concepts-data-flow#actions | |
*/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function pickValueOfRecordUsingOrder< | |
TKey extends PropertyKey, | |
const TOrder extends ReadonlyArray<TKey>, | |
const TInputRecord extends Record<TOrder[number], number>, | |
TResultArray extends { | |
[X in keyof TOrder]: TInputRecord[TOrder[X]] // any value can be selected | |
}, | |
>( | |
input: TInputRecord, | |
order: TOrder |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
interface HasGetValue<TValue> { | |
getValue: () => TValue | |
} | |
function transformArray< | |
TInputs extends Array<HasGetValue<unknown>>, | |
TOuptuts = { [X in keyof TInputs]: ReturnType<TInputs[X]['getValue']> } | |
>( | |
inputs: TInputs | |
): TOuptuts { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"deploy-update": "zip -r function.zip . -x \".git/*\" -x \".gitignore\" -x \"./node_modules/aws-sdk/*\" -x \"./node_modules/events/\" -x \"./node_modules/ieee754/\" -x \"./node_modules/jmespath/\" -x \"./node_modules/querystring/\" -x \"./node_modules/sax/\" -x \"./node_modules/url/\" -x \"./node_modules/uuid/\" -x \"./node_modules/xml2js/\" && aws lambda update-function-code --function-name ComicPagePublish --zip-file fileb://function.zip" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
:: creates a .gif from an input file | |
:: supports drag and drop | |
ffmpeg -y -i %~1 -vf "fps=12,scale=640:-1:flags=lanczos,split[s0][s1];[s0]palettegen[p];[s1][p]paletteuse" -loop 0 %~1.gif |
NewerOlder