I’m working on a VR game, and I’m really struggling here, i want to have blade and sorcery physics-based style movement and i don’t even know where to begin, I already added in hand movement, so now its a matter of perfecting the body.
There’s a few issues i can’t figure out
- How can i make the body walk when you tilt the left joystick
- How can i adjust the body with real life movement without breaking in game movement
Also I’m not asking for code, simply help with designing a system which i can then translate into code, the reason I don’t want to use open source systems is because I prefer starting from scratch, and it makes it more customizable for me.
I’m kinda new to VR development so I really don’t know what to do with these, here’s what i have so far:
https://gyazo.com/055f889093a1a86d49d3a707f7ed7ff2
As you can see, the body is all weird and janky, and it’s completely misaligned with the head, this is my code:
local Player = game:GetService("Players").LocalPlayer
local Character = Player.Character
local Humanoid = Character:WaitForChild("Humanoid")
local Camera = workspace.CurrentCamera
Camera.HeadLocked = true
-- Services --
local VRService = game:GetService("VRService")
-- Functions --
local function CreateHand(Hand)
local Part = Instance.new("Part")
Part.Shape = Enum.PartType.Ball
Part.Size = Vector3.new(0.3,0.3,0.3)
Part.Anchored = true
Part.Massless = true
Part.CanCollide = false
Part.CanTouch = false
Part.Parent = Character
Part.Transparency = 0.5
Part.Material = Enum.Material.ForceField
Part.Color = Color3.fromRGB(72, 0, 255)
Part.Name = Hand.."HandDisp"
return Part
end
local function CreateIK(Name,T,C,E)
local IK = Instance.new("IKControl")
IK.Parent = Character.Humanoid
IK.EndEffector = E
IK.ChainRoot = C
IK.Target = T
IK.Name = Name
IK.SmoothTime = 0
IK.Priority = 50
return IK
end
-- Hands --
local RightHandCF = nil
local handOffsetR = VRService:GetUserCFrame(Enum.UserCFrame.RightHand)
handOffsetR = handOffsetR.Rotation + handOffsetR.Position * workspace.CurrentCamera.HeadScale
RightHandCF = handOffsetR
local RightHand = CreateHand("Right")
local LeftHandCF = nil
local handOffsetL = VRService:GetUserCFrame(Enum.UserCFrame.LeftHand)
handOffsetL = handOffsetL.Rotation + handOffsetL.Position * workspace.CurrentCamera.HeadScale
LeftHandCF = workspace.CurrentCamera.CFrame * handOffsetL
local LeftHand = CreateHand("Left")
-- ArmIK --
local IK1 = CreateIK("RightArmIK",RightHand,Character:WaitForChild("RightUpperArm"),Character:WaitForChild("RightHand"))
local IK2 = CreateIK("LeftArmIK",LeftHand,Character:WaitForChild("LeftUpperArm"),Character:WaitForChild("LeftHand"))
game:GetService("RunService").RenderStepped:Connect(function()
-- Alignment --
handOffsetL = VRService:GetUserCFrame(Enum.UserCFrame.LeftHand)
handOffsetL = handOffsetL.Rotation + handOffsetL.Position * workspace.CurrentCamera.HeadScale
LeftHandCF = workspace.CurrentCamera.CFrame * handOffsetL
handOffsetR = VRService:GetUserCFrame(Enum.UserCFrame.RightHand)
handOffsetR = handOffsetR.Rotation + handOffsetR.Position * workspace.CurrentCamera.HeadScale
RightHandCF = workspace.CurrentCamera.CFrame * handOffsetR
LeftHand.CFrame = LeftHandCF * CFrame.fromOrientation(math.rad(90),0,0)
RightHand.CFrame = RightHandCF * CFrame.fromOrientation(math.rad(90),0,0)
end)
All help is greatly appreciated