I’m trying to create a floating hamburger boss that gravitates towards players, bobbing towards and past them. I tried achieving this by using a BodyPosition with a low max force.
What is happening
This has generally worked, whoever there are several cases were the boss will get stuck circling the player (if the player steps to the side of the bosses’ path). I find that this makes me feel nauseous, my players to feel nauseous and makes the boss way harder than it needs to be.
What I tried and am considering
I tried limiting the bosses’ velocity so the player can break the cycle, but found that it just makes the circling slower. I’m considering switching to using a spring constraint from the boss to the player and using another spring to restrict cross movement, whoever this would be a major change. I’d love to know, would this be worth doing? Or is there a better solution?
Details
I have another BodyPosition that only applies force on the Y axis to keep the boss in the air.
I have a BodyGyro which keeps the boss facing the nearest player.
I want the difficulty to come from dodging attacks, not time.
I didn’t think the script was needed but I can certainly provide it. Glad you mentioned it, there was a lot more than I had recalled.
function(self, time, step)
if self.ClosestCharacter ~= nil then
local dirX, dirY, dirZ = CFrame.new(self.PrimaryPart.Position,
self.ClosestCharacter.HumanoidRootPart.Position):toOrientation()
local dir = CFrame.Angles(0, dirY, 0).LookVector
-- The direction is multiplied by a fixed value, followed by the mass of the boss.
-- getDelta is a simple linear interpolation function (results in 50 every time).
local force = dir*
(self.PrimaryPart.Position -
self.ClosestCharacter.HumanoidRootPart.Position).Magnitude/
getDelta(self._ForceGoodAmplitude, self._ForceBadAmplitude, self._DamageDelta)*self.PrimaryPart:GetMass()
-- If looking away from the target.
if self.PrimaryPart.Velocity:Dot(dir) < 0 then
-- Multiplied by 4.
force = force*self._Catchup
end
self.BodyForce.Force = force
self.BodyGyro.CFrame = CFrame.fromOrientation(
-- Limit angle.
math.rad(math.clamp(math.deg(dirX), -Controller._AngleLimit, 0)),
dirY,
0)
end
end
I think that the concept of an enemy spinning around the player is pretty cool and more challenging. I don’t really know how to code and script, but I think that in order for the players to not feel nauseous, there should be a “focused” camera angle between you and the enemy. For example, when you triggered a fight with an enemy, there should be a key or option where you always have the camera facing them. This way, the players don’t have to constantly spin their mouse all the time just to see an enemy. The cameras will instead do the work for them.
So if you want the burger to swoosh past the character you need to get a magnitude from burger to character then offset the mag by character then multiply it by like 10 to 15 then Randomize x and z this will create a location that fans out behind the player and the burger can fly there then require target do it again.
No worries. I don’t have time to test any of these potential solutions as of yet (paid work comes first!). So feel free to make whatever edits you need!