Help with flying system

So, im making a flying mechanic similar to Marvel: New Journey’s. Everything is fine BUT i cant seem to make the Body Gyro turn to the player’s direction when moving

Here is what i currently have:

External Media

As u can see it only rotates according to the camera’s CFrame

What i wanted to do:

External Media

Here, the player rotates to the camera’s CFrame WHEN not moving and it rotates to the player’s direction when Moving.

I dont know how to achieve this tho.

2 Likes

It should be in this file.

Flight.rbxl (28.6 KB)

Ill check it once im in my laptop. Thank you so much! Ill just understand how it works and ill implement it.

I checked the place, and the fly. The fly only moves with the camera’s cframe but not where the characters direction

Look at the code used in this Roblox Gear
It is what I based the flying system for Neverland Lagoon from.

1 Like

Ill try to understand the code. Thanks for the help

1 Like

I tried to implement the momentum code to my fly script and it rotates based on my move direction, yes. But it doesnt rotate based on camera’s cframe.

here is the momentum code:

Momentum = (hrp.Velocity + (hrp.CFrame.lookVector * 50))
v3.CFrame = CFrame.new(Camera.CFrame.LookVector, Momentum) -- this was CFrame.new(Vector3.new(0,0,0), Momentum) but i changed it thinking it will follow along with the camera but it didnt work.

--incase you need the velocity mover function, here it is:

local function u2()
	if Humanoid.MoveDirection == Vector3.new(0, 0, 0) then
		return Humanoid.MoveDirection
	end
	local v12 = (Camera.CFrame * CFrame.new((CFrame.new(Camera.CFrame.p, Camera.CFrame.p + Vector3.new(Camera.CFrame.lookVector.x, 0, Camera.CFrame.lookVector.z)):VectorToObjectSpace(Humanoid.MoveDirection)))).p - Camera.CFrame.p;
	if v12 == Vector3.new() then
		return v12
	end
	return v12.unit
end

v3 is the bodyGyro

Here’s a video

External Media

BodyGyro is deprecated. I would recommend using AlignOrientation with Mode set to OneAttachment.

Play my place, and once loaded, double jump to start flying.
Tell me if the flying I am using is what you are trying to achieve.

I played it and yes, The movement of the player is what i want to achieve. I tested mine again and it seems similar to the flying system in marvel games. Thanks for the help!

Yeah, ill remake it once i study AlignOrientation.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.