Hello, I’m trying to make something similar to odmg or web swinging. My problem is that orbiting up and down does not work. In this video, the player fully orbits above and below a bridge/tower thing
This is what I have so far: (Only holding W)
Compared to the other video, it just stays above the part and doesn’t go below and then up. It makes the movement in my game feel very weird…
I’m using a body velocity instance to move the player.
Failed attempts:
local moveVector = input.MoveVector
if false then
--This is the main one im using but it was disabled for testing
local circleConstant = self.OrbitCircle
velocity.Velocity = (CFrame.new(torso.Position, goal) * CFrame.Angles(circleConstant * -moveVector.Z, circleConstant * -moveVector.X, 0)).LookVector * self.OrbitSpeed
elseif nil then
local posDelta = torso.Position - goal
local tangentialVelocity = posDelta.Unit:Cross(Vector3.new(-moveVector.Z, -moveVector.X, 0)) * self.OrbitSpeed
local centrifugalForce = tangentialVelocity.Magnitude ^ 2 / posDelta.Magnitude
velocity.Velocity = tangentialVelocity
elseif not true then
local radialVector = (torso.Position - goal)
local cross = (radialVector):Cross(Vector3.new(-moveVector.Z, -moveVector.X, -moveVector.Z))
velocity.Velocity = ((cross.Unit + (goal - torso.Position).Unit)/2).Unit * self.OrbitSpeed
else
local settings = self.OrbitStuff
if settings.NeedsStartAngle == true then
settings.NeedsStartAngle = false
settings.CurrentRotation = 0
end
settings.CurrentRotation += math.pi * 2 * deltaTime
settings.StartAngle = math.atan2(torso.Position.Z - goal.Z, torso.Position.X - goal.X)
local delta = goal - torso.Position
local orbitGoal = CFrame.new(goal + Vector3.new(0, 0, math.max(delta.Magnitude * 0.925, 1))) * CFrame.fromAxisAngle(Vector3.yAxis, settings.StartAngle + settings.CurrentRotation)
velocity.Velocity = (orbitGoal.Position - torso.Position).Unit * self.OrbitSpeed
end