How to use BodyPosition and BodyGyro?

Alright so I’m not 100% sure if this is all I need to achieve this, but currently I’m trying to use BodyPositions and BodyGyros to prevent the player from spinning/rotating and keep them on the same z axis. I’m trying to achieve this

it’s from street fighter this clip however I found another game made in the same style on Roblox and heres a clip from that

And then heres my version LOL

Anyways I’m pretty sure I can use BodyPosition and BodyGyro, but haven’t been able to get it right yet so any help would be great.

1 Like

I think using a Dot product would work. It will return a value between -1 and 1 based on the degrees of 2 points. Here is a reference:

Referance

image

You could try a check to make sure its not within a certain range of degrees e.g.

local pos1 = Vector3.new(1, 2, 3)
local pos2 = Vector3.new(5, 2, 3)
local dot = pos1:Dot(pos2)

if not dot > -.4 and dot < .4 then --or something like this (im tired)
      --set the body gyro if point 2 is not within a certain angle
end
local hrp = hrp -- put the humanoid root part path here

local bp = Instance.new("BodyPosition", hrp)
bp.Position = hrp.Position + hrp.CFrame.LookVector * 10
bp.MaxForce = Vector3.new(math.huge, math.huge, math.huge)

delay(.25, function)
  bp.Parent = nil
end)
1 Like

Ight tried this, but doesn’t really do anything besides make it worse actually lol

1 Like