I was examining the code in this bunnyhopping system in hopes of making a movement system similar to this.
However, I want to combine the vertical and horizontal vectors when the player is moving both forwards and sideways.
The code I had referred to combines the vertical and horizontal components to find a wishdir through trigonometry, something that I don’t want. And I have absolutely no idea what piece of code does this in the system.
So for example, if the horizontal speed was 10, and the vertical speed was 15, I want the combined speed to be 25 (10+15), not 18 (trigonometry).
Trigonometry is the natural result of adding the horizontal vector and vertical vector because when you add them up, what you can visualize is yeah, a triangle hence the Pythagoras theorem used.
Replace horizontal component with horizontal vector, and vertical component with vertical vector. When you combine normally through addition you form this diagram and create the new vector known as the resultant.
If you do not want to simply add these two horizontal and vertical components together, basically increasing the wishSpeed even further than normal then you can as you said with combined magnitudes.
--Code in the post before, speed is the resultant magnitude
function AirMove()
--Other code stuff
wishDir = Vector3.new(wishDir.X, 0, wishDir.Z)
local wishSpeed = wishDir.Magnitude --perform trigonometry vector resultant math
--Code in the post after
function AirMove()
--Other code stuff
wishDir = Vector3.new(wishDir.X, 0, wishDir.Z)
local wishSpeed = wishDir.Z+wishDir.X --Your idea
I cannot guarantee this will work, because this will definitely increase the speed and potentially break other calculations within the code.