Which applies a force to the character, using a BodyForce, this code will always push the player “forward” of the characters rotation, e.g. if they are facing downwards, they’ll be pushed downward, if they are facing forwards, they will be pushed forwards.
Edit: Vector3.new(0, gravMas * forceVector.Y, 0) always faces upwards, since it doesn’t get affected by rotation.
Changing vectorToWorldSpace to vectorToObjectSpace will do what I intend, however only in 180degrees, in the other 180degrees it pushed the player the opposite way.
Any help would be appreciated. If you need me to explain more, please lmk.
Here you go. Let me know if something doesn’t work.
local down = Vector3.new(0, -1, 0) -- put this at the top of the script so it only needs to run once.
local force = player.Character.PrimaryPart.CFrame.RightVector:Cross(down).Unit * forceMultiplier
This seems to work correctly, so map X direction to -Y, how would I go about doing this for the Z direction?
(I don’t mean to come off as ungrateful, its 3am for me right now ahaha, thanks for all the help so far)
I’m still not sure I follow. Can you explain in other terms? So this code gives you a constant forwards in the case of doing a front flip. What else do you need to do?
I don’t have a huge understanding of CFrames, I don’t exactly follow where the consistent X is coming from, afaik, the only thing consistent is Vector3.new(0, -1, 0)
The above code works for the Z force, using edited negative/positives for positive/negative Z Force.
The consistent X is because you are rolling forward. Your whole torso is rotating along the X axis (left/right), so the X axis is consistently pointing in one direction.