Realistically throwing an object

I am a newbie to anything physics-related and not particularly special at math so I just wanted to ask how I could create an actually good throwing effect from one position to another position?

(good is subjective but just assume I mean that it should be convincing of real physics)

It would be from one position vector/CFrame to another like shown below, think of it as a specific position vector in front of the hand to the center of the other’s torso.

I am not trying to rely too hard on Roblox physics as I want to adapt this for ranged weapons as well like a catapult or bow & arrow. I might consider BodyForces or anything like that however.

I would like to NOT rely on public modules even if FastCast helps me in this scenario. I wouldn’t know how to do anything like this otherwise if I had to rely on a module.

4 Likes

Well… I don’t actually understand what your question is. I think I do, but I want to make sure.
You are asking the devforum to provide you with a subjectively good method of throwing objects, that relies on non Robloxian, realistic physics, without making use of widely shared and recommended modules that already exist? You also want to do all this without an extensive knowledge of Physics, CFraming Maths etc??? It seems to me that you are asking for the goose that lays the golden egg. Unfortunately, realistic physics is difficult, because it emulates nature. And maths and nature are two things that are very very complicated when put together.
BUT I am editing this answer to continue the thought and actually provide you with some good resources.
Here are the resources.

this next bit not so relevant, but still semi relevant
PhysicalProperties

And, I know you don’t particularly want to go the route of FastCasting, but Raycasting is pretty useful for what you are doing.
and of course
Collision Detection
These are just the basics, and things such as BodyThrusts and BodyMovers are also helpful in certain instances.
And overall, simply studying up on all that math you were talking about, will help you create a better physics simulation than anything Roblox currently has.

2 Likes

I probably expected too realistic but let’s just say, physics good enough to be in a game then. I wouldn’t say provide me with a subjectively good method, I want to think of it objectively and that it is standard to what I should do if I were to implement any ranged weapon or throwing system, I don’t mean a very specific way to do it but an explanation that helps me learn how it is done usually so I can make it myself.

The simplest method would just be to set the Velocity property on the part along the vector in the direction you want to throw. The object will naturally follow that trajectory. If it seems too fast, lower the gravity.

You can very easily experiment with this by simply spawning a part on the Baseplate, pressing Run, then set the part’s Velocity to something like (50, 50, 0) and see it fly!

1 Like

If you want to make that just use a bullet drop equation and specfiy the graivty parameter as your wish, that would work just fine. The bullet drop equation I use seems to fit this trajectory.

Here would be an example of my bullets trajectory

Just uses a linear equation with a bullet drop equation added to it

https://gyazo.com/c39450eda67f3c3ce554c12a0b2b2aa4

Bullet drop equation

local Velocity = v.InitialVelocity - (Vector3.new(0,Gravity,0) * v.ElapsedTime)
local PositionNow = v.StartCFrame.Position + (Velocity * v.ElapsedTime)

IntialVelocity has to be a velocity, not a scalar number like speed.

2 Likes

Here’s some pseudo-code that I derived from a wikipedia article about Bezier Curves a few months ago.

function GetQuadPoints(p0,p1,p2,pts)
    --[[
        p0 = origin
        p1 = destination
        p2 = offset of the curve
        pts = how many partitions of the curve (more points = more smooth, but higher computation time)
    ]]--
    local points = {}
    local disttable = {}
    
    local dif;
    
    for i=1,pts do
        local a = i/pts
        local pos = (1-a)^2 * p0 + 2 * (1-a) * a * p2 + a^2 * p1
        points[i] = pos
        if i == 1 then
            dif = p0-points[i]
        else
            dif = points[i-1]-points[i]
        end
        local dist = math.abs(dif.x)+math.abs(dif.y)+math.abs(dif.z)
        disttable[i] = dist
    end

    return points
end
1 Like

I sort of want a fixed trajectory and I have issues with velocity sometimes which is why I don’t use it. For example, I used this particular code for example:

local subtraction = (part2.Position - part1.Position)
part1.Velocity = subtraction.Unit * subtraction.Magnitude

But, it hardly even throws it towards the object, I have to give it a multiplied force to make it actually bump into the other part.