I am trying to make a basic movement script for a game, however, I do not possess the brainpower in order to figure this out, so, my question is as follows:
How do I get the way a part is facing, and then move the part 1 stud in this direction?
I am trying to make a basic movement script for a game, however, I do not possess the brainpower in order to figure this out, so, my question is as follows:
How do I get the way a part is facing, and then move the part 1 stud in this direction?
you would need to use CFrame for this
but to move a part 1 stud in the direction it’s looking at you can do it like this
Part.CFrame = Part.CFrame + Part.CFrame.LookVector * 1
https://developer.roblox.com/en-us/api-reference/datatype/CFrame
part.Position += part.CFrame.LookVector * step
Wow thanks, much simpler than I imagined haha
Say I wanted to make a movement script and needed to convert the CFrame into a Vector3 value, how would I do this?
Example, the Humanoid:Move() function needs a vector 3 to tell it where to move.
I need to get the way the part is facing, convert that into a Vector3 and move a stud in its direction.
Edit: I have found a solution that involves trigonometry.
You know about CFrame.Position And CFrame.Rotation, right?
Yes, I used CFrame.Orientation to get the Y orientation and used trigonometry to find the X and Z, then I just moved 1 stuff forward in that direction. Or something along those lines as I am not looking at my script currently.