-
Notifications
You must be signed in to change notification settings - Fork 6
Vector Utilities
Swifter edited this page Oct 9, 2024
·
6 revisions
You should know about what vectors are mathematically. Here is a great resource where you can learn about them: https://www.youtube.com/watch?v=fNk_zzaMoSs&list=PLZHQObOWTQDPD3MizzM2xVFitgF8hE_ab
"Vectors" are not a special class in ReMapper, they are just an array of values. ReMapper provides a couple types for vectors:
-
rm.Vec3-[number, number, number] -
rm.Vec4-[number, number, number, number]
-
rm.areVectorsEqualwill simply check 2 vectors of the same length against each other to see if their elements are all equal.
rm.areVectorsEqual([1, 2, 3], [1, 2, 3]) // true
rm.areVectorsEqual([1, 2, 3], [0, 0, 0]) // falseYou may also provide a third parameter leniency which will describe the maximum difference between numbers that are allowed for them to still be considered "equal".
rm.areVectorsEqual([2, 3], [2, 3.5], 0.5) // true
rm.areVectorsEqual([2, 3], [2, 3.5], 0.25) // false-
rm.magnitudewill calculate the magnitude of a vector.
rm.magnitude([1, 0]) // 1
rm.magnitude([1, 1]) // 1.414..-
rm.distancewill take in two vectors A and B and return the magnitude of(B - A).
rm.distance([1, 0], [3, 2]) // 2.828...-
rm.normalizewill take in a vector and return a vector in the same direction with a magnitude of 1.
rm.normalize([3, 1, 4]) // ~ [0.588, 0.196, 0.784]-
rm.dotProductwill take in 2 vectors and give the resulting dot product.
rm.dotProduct([1, 0], [0, 1]) // 0-
rm.crossProductwill take in 2 three-dimensional vectors and give the resulting cross product.
rm.crossProduct([0, 0, 1], [1, 0, 0]) // [0, 1, 0]It is worth noting that the cross product operates using the right-hand rule, while unity is in left-hand space. https://en.wikipedia.org/wiki/Right-hand_rule#/media/File:Right-hand_rule_for_cross_product.png
- Info
- Difficulty
- Beatmap Objects
- Gameplay Objects
- Walls
- Basic Notemods
- Note Iterators
- Basic Events
- V3 Events
- Custom Events
- Heck Tracks and Animation
- Easings
- Point Types
- Point Utilities
- Heck Animation Baking
- Heck Animation Settings
Non-Vivify Models
Vivify