I want to make so the player faces a certain direction on button press so then I can play an animation.
I’m making a dodge system for a top view shooter, everything almost done expect animation.
My other scripts require AutoRotate to be disabled and dodge is using walk speed 0 to “disable” player movement while BodyForce pushes the player around.
I was trying to mess around with vectors and body gyros but I just can’t quite figure it out.
So I’m asking for help in understanding it or at least make a way to make it work.
fixed it.
my main problem is this damn bodygyro,
I know that you can make them follow parts but that ended up in trashbin after my poor implementation.
Then I readout that you can set up the direction or an angle manually and that’s what I need help with.
I want to set up a separate gyro that activates after special input lets say after pressing D player would go to the right side of the screen, problem is I don’t know how to make character face a direction that player is now moving towards.
As of now its a humanoid, script disables all inputs and tells player character to move 15 studs in one direction. it turns on auto rotate for a moment then it gets disabled again, and I want to achieve similar transmission but with the use of bodygyro.
Oh that’s a rather interesting way to do that But uhh… prone to issues.
Here’s an example of making them face right using whatever body gyro you have. It requires the camera to be present. This is based on your current top-down camera setup.
You’ll have to make sure all the variables are defined properly below.
local facingRightDirection = camera.CFrame:VectorToWorldSpace( Vector3.new(1,0,0) )
local currentPosition = humanoidRootPart.Position
local targetPosition = Vector3.new(
currentPosition.X + facingRightDirection.X * 100,
currentPosition.Y,
currentPosition.Z + facingRightDirection.Z * 100
)
gyro.CFrame = CFrame.new(currentPosition, targetPosition)
I cant figure out camera wariable mind expanding on it ?
p.s. that code was not writen by me. other programer wrote it from scratch to somewhat show me how i could make a dodge system.