In my game, I am attempting to create a custom character with a different camera angle, however the problem is that the character is distorted when moving due to the camera moving forward only after the character is moved. I need to be able to move them simultaneously so I don't get this problem, but I'm not sure how I could achieve this.
This is the camera assignment. It is in a coroutine.
function aC()
while wait() do
Workspace.CurrentCamera.CameraSubject = char.Head;
Workspace.CurrentCamera.CoordinateFrame = CFrame.new(char.Head.Position + Vector3.new(6, 1, -5), char.Head.Position + Vector3.new(-4, 0, -5));--;char.cameraPosition.Position, char.cameraSubject.Position);
end
end
This is the character movement script:
cameraModule.createMovement = function()
local gyro = Instance.new("BodyGyro", game.Workspace[game.Players.LocalPlayer.Name].Torso);
local velocity = Instance.new("BodyVelocity", game.Workspace[game.Players.LocalPlayer.Name].Torso);
local mouse = game.Players.LocalPlayer:GetMouse();
local maxspeed = 10000;
local speed = 15;
local upward = 4500;
gyro.maxTorque = Vector3.new(400000, 400000, 400000);
velocity.maxForce = Vector3.new(maxspeed,upward,maxspeed);
velocity.P = 50000;
assignCamera = coroutine.wrap(aC);
assignCamera();
mouse.KeyDown:connect(function(key)
--Movement
if key == "w" then
velocity.velocity = Vector3.new(velocity.velocity.X+speed,upward,velocity.velocity.Z);
elseif key == "a" then
velocity.velocity = Vector3.new(velocity.velocity.X,upward,velocity.velocity.Z-speed);
elseif key == "d" then
velocity.velocity = Vector3.new(velocity.velocity.X,upward,velocity.velocity.Z+speed);
elseif key == "s" then
velocity.velocity = Vector3.new(velocity.velocity.X-speed,upward,velocity.velocity.Z);
end
end)
mouse.KeyUp:connect(function(key)
--Movement
if key == "w" then
velocity.velocity = Vector3.new(velocity.velocity.X-speed,upward,velocity.velocity.Z);
elseif key == "a" then
velocity.velocity = Vector3.new(velocity.velocity.X,upward,velocity.velocity.Z+speed);
elseif key == "d" then
velocity.velocity = Vector3.new(velocity.velocity.X,upward,velocity.velocity.Z-speed);
elseif key == "s" then
velocity.velocity = Vector3.new(velocity.velocity.X+speed,upward,velocity.velocity.Z);
end
end)
end

1 comment
I tried that earlier after Quenty told me about it, but I still have the problem.