Help with Advanced Math

Hello there,

I have recently been trying to override Roblox’s physics engine – specifically when it comes to mechanics – so that I may incorporate my own physics.

I want to do this mainly because Roblox does not have any sort of mass and gravity mechanic to where I can assign a mass value to an object, then generate a gravitational field as a result of that mass. I can do this with lerping and such, however that method is far too complex when all I would have to do is incorporate a few lines of math that would not only be magnitudes more efficient than lerping, but also produce a much more consistent and realistic result.

My problem is that I need my script to not only find the acceleration vector of an object that enters a given area, but also integrate that acceleration vector twice. I need to do this so that I may represent the initial acceleration of the object entering the area in addition to the acceleration a given force causes on that object as a position vector function. If I am able to get the position vector function, then I will be able to precisely calculate the position and other physical traits of that object at any exact time.

The above calculation is exactly what I need the script to do. I can’t simply integrate by hand like above, and plug it into my script since I have different force equations. I would have to input several different functions for r(t) for each equation of force that I use. That would be extremely tedious, and not to mention inefficient since any time I’d want a unique force equation, I’d have to calculate it by hand before implementing it into the game.

That being said, is there any way someone has figured out how to integrate in their scripts? If so, what would you recommend? I don’t think Roblox has any built-in calculus functions, and I feel like writing my own would be the last resort since it would be nowhere near efficient.

Thanks!

2 Likes

This module has an integral method along with other calculus things that you might need

3 Likes

I did some reading on this module’s Calculus feature. Thank you for this! This will help me out with my scalar integrals. However, when it comes to vector calculus, I very rarely need to take an integral over a closed bound. In this case, I cannot take a definite integral of my vectors as the bounds of my integral are not defined.

My bounds would be somewhere along the lines of [something, t], to where I would get a function of ‘t’ as a result of my integration. If I use defined boundaries such as [a,b] (where ‘a’ and ‘b’ are integers), then it is impossible for me to get a position function given force – it would be equally impossible for me to re-use my integration to predict the object’s behavior further in its path without integrating again.

I really appreciate this though!

yeahhhh no I don’t think anyone has created an antiderivative method on Roblox simply because of how remote calculus is to the majority of Roblox developers. This is as much help as I can provide.

1 Like

Ah no worries, it was a big help regardless. I’m sure there are some physics devs on here somewhere who may be able to help!

2 Likes