How the aim point is found through the lookvector on the attachment and not the camera direction. Print("Local fire") - will print indicating this is the direction the gun is firing in aimDir Local aimDir = (self.aimPoint - tipPos).Unit This function should hold the answer to the question above, I found it by looking for a function for firing the weapon which was well named the same :fire(origin, dir, charge) with the parameters matching up from raycasting needs an origin and direction, therefore it should be correct. Why the guns dont shot where the camera looks? RunService:UnbindFromRenderStep("tempBinding") RunService:BindToRenderStep("Before camera", - 1, beforeCamera) Local biggestDot,pos = getBiggerFromTable(dotArray)Ĭamera.CFrame = CFrame.lookAt(camera:GetRenderCFrame().Position,pos) Local dotArray = getDotProductOfPositions(characters,camera:GetRenderCFrame().LookVector,camera:GetRenderCFrame().Position) Local characters = getCharactersArray(camera:GetRenderCFrame().Position) If v:IsA("Humanoid") and v.Health > 0 and v.Parent:FindFirstChild("HumanoidRootPart") and (v. - plrPos).Magnitude greatestNumber then Local function getCharactersArray(plrPos)įor _, v in workspace:GetDescendants() do Local function printDicctionary(table) for i, v in pairs(table) do warn(i) warn("") warn(v) end end This is the local script (inside the tool) local RunService = game:GetService("RunService") Why? i try read the gun code and i could not get it, and the camera is always on scriptable, how i can fix this? why the guns dont shot where the camera looks? devforum-uploads.s3./uploads/original/5X/b/1/1/d/b11df3a666f3bd71678412e0202799a16fe83dc6.mp4Īs you can see on the video, the camera faces the dummy, but the actual gun keeps shooting at the original camera cframe and when you stop shooting the camera cframe returns back to the original cframe.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |