Hello!
I have an R6 gun and i want to make the torso “Attached” to the camera. Kinda like this:
I know pretty much about the math, and i think i have to use math.asin, but i never used it and i dont know how to work with it.
I’d like it to be serversided.
Thanks!
1 Like
Are you looking for something like this?
Eh, then it must be something wrong with the code the other guy posted. TBH I don’t really understand his math.floor method so I will use my own method introducing my own resource [Insert Shameless advertising]
Now you can add constraints in the form of angles so it looks more realistic
New script using my module workspace:WaitForChild(script.Parent.Parent.Name)
local camera = workspace.CurrentCamera
local mouse = game.Players.LocalPlayer:GetMouse()
local waistConstraints = {
[&…
Replication is up to you though just send over the CFrame orientation values and tell the client or server to tween depending on your scenario.
Kinda yeah, but it shouldnt follow the mouse, it should follow the camera, on the y axis only.
Tried using CameraSubject? It should work!
What do you mean? CameraSubject won’t rotate the torso…
My bad, didn’t see the first line
No problem! Can happen to everybody.
Well unfortunately my method only works for looking for a position which in this case is a mouse hit position through the code snippet below:
waistController:LookAt(mouse.Hit.Position)
Perhaps you can replace the mouse.Hit.Position with your conditions
such that it uses the cameras look at vector instead
local camera = workspace.CurrentCamera
local cameraLookVector = camera.CFrame.LookVector
And to constrain it so it only looks up and down you can just set the yaw settings the module to zero.
local waistConstraints = {
["YawLeft"] = 0;
["YawRight"] = 0;
["ElevationAngle"] = 45;
["DepressionAngle"] = 45;
}
1 Like
If you want only the Y axis, then instead of Mouse.Hit
you can try using Vector3.new(Character.PrimaryPart.Position.X, Camera.CFrame.Position.Y, Character.PrimaryPart.Position.Z)
.