So i always see in some complex code all these calculations whenever i read them i can kinda figure out how it works but not completely
what i cant understand tho is how do experience scripter do these calculations. Where do you start learning them. And how do you even go about learning them and making them.
im nowhere the level of an expert but i figured sooner or later i will have to learn this so might as well learn a bit of it before learning the real thing later so i can prepare and might even help me right now.
This is from a script i modified; calculations like these
game:GetService("RunService").RenderStepped:Connect(function(delta)
if IsEquipped == true then
if char.Torso:FindFirstChild("Right Shoulder") then
char.Torso["Right Shoulder"].C0 = char.Torso["Right Shoulder"].C0:Lerp(CFrame.new(1, .65, 0) * CFrame.Angles(-math.asin((m.Origin.p - m.Hit.p).unit.y), 1.55, 0, 0) , 0.4)
end
if char.Torso:FindFirstChild("Left Shoulder") then
char.Torso["Left Shoulder"].C0 = char.Torso["Left Shoulder"].C0:Lerp(CFrame.new(-1, .65, 0) * CFrame.Angles(-math.asin((m.Origin.p - m.Hit.p).unit.y), -1.55, 0, 0) , 0.4)
end
if char.Torso:FindFirstChild("Neck") then
char.Torso["Neck"].C0 = char.Torso["Neck"].C0:Lerp(CFrame.new(0, 1, 0) * CFrame.Angles(-math.asin((m.Origin.p - m.Hit.p).unit.y) + 1.55, 3.15, 0), 0.4)
end
else
if char.Torso:FindFirstChild("Right Shoulder") then
char.Torso["Right Shoulder"].C0 = char.Torso["Right Shoulder"].C0:lerp(origRightS, 0.4)
end
if char.Torso:FindFirstChild("Left Shoulder") then
char.Torso["Left Shoulder"].C0 = char.Torso["Left Shoulder"].C0:lerp(origLeftS, 0.4)
end
if char.Torso:FindFirstChild("Neck") then
char.Torso["Neck"].C0 = char.Torso["Neck"].C0:lerp(origNeck, 0.4)
end
end
end)
well that is just one of the many calculations i see in scripts and ive always wondered how developers make them and learn them
If by calculations you mean applied maths within code, I would say most developers who choose to learn this would have studied maths at school or within their own free time, and then later experimented to see what works and what doesn’t. However, programmers are notoriously lazy; if it exists elsewhere, they’re more than happy to take it for themselves. For this reason, you more than likely won’t need to learn the extremely complicated maths behind most operations, as you can probably find it already calculated.
If you do want to learn, however, feel free to research maths courses and study online. MIT Courseware is a great resource for university level material discussing maths.
If needed i am willing to learn, i wanted to know how developers think of those calculations and make them. Of course i know theres gonna be a long trial and error for the calculations since its math. But i dont see them much in other games, i was just curious but thanks anyways. I just wanted to know what they’re basing their calculations on.
I’d assume that anybody who’s required to write the maths for a program like the one you posted above would begin by modelling what they want to happen. After that, they’d either sit down with a pen and paper and attempt to create a general solution, or otherwise go straight into programming the solution and seeing what sticks and what doesn’t. They don’t base their calculations on anything per se, aside from their knowledge of topics like Matrices and vectors.
I see so i would need to understand vectors, cframes and such deeper so i could be effective in making calculations. I think i also saw one with tweens so i assumed ill need to learn stuff like this sooner or later. But i guess i shouldn’t spend a lot of time on it if im not gonna need it the much.