Help with getting force on impact

I’ve been trying to get accurate results of the force when the part hits an object.

Using this code doesn’t give accurate results of force:

local partVelocity = part.AssemblyLinearVelocity
local hitVelocity = hit.AssemblyLinearVelocity
local force = (partVelocity - hitVelocity).Magnitude

It would return the speed of the part but when the part is sliding on the ground, it would return high numbers.

To prevent this, I tried using the kinetic energy force but I’m not very good at this so this is what I got:

local part = script.Parent

local function OnTouched(hit)
	local partVelocity = part.AssemblyLinearVelocity
	local hitVelocity = hit.AssemblyLinearVelocity
	local relativeVelocity = (partVelocity - hitVelocity)

	local partMass = part.AssemblyMass

	local force = 1/2 * partMass * relativeVelocity * relativeVelocity
	
	local normalForce = partMass * workspace.Gravity * math.cos(0)
	local kineticFriction = math.cos(force.Magnitude) * normalForce

	print(kineticFriction)
end

script.Parent.Touched:Connect(OnTouched)

Not sure if I’m doing this right. Can someone help me?

Secondary/high school physics!

Friction = F * μ.
The equation gives the maximum friction so you’ll probably need to clamp it so it doesn’t send your part flying backwards.
μ is a constant that is dependent on the material.
F is the reaction force (the force applied to a part to stop it from phasing through a surface) and will always act against the direction of movement.

On a flat surface F is simply its mass * gravity (F = ma), also known as the weight.
On a sloped surface is a little bit more complicated. You’ll need to multiply the weight by cos(theta) to get the component that is perpendicular to the surface (the reaction force!). theta is the angle between the floor and the normal.

Nothing to do with kinetic energy!

Not in highschool so this is a bit complicated. I’ve never learned about theta.
Saw this formula but I don’t know how to get the adjacency: Cos(θ) = adjacency/hypotenuse

just to double check do you want to work out the friction or…?

adjacency: sqrt(hypotenuse^2 - opposite^2)

image

Here is what I’m trying to achieve:

Not sure if this is understandable but I’m trying to do something like this:

i have no idea what you want here…

Oh. You know how a part being dragged on the ground, it would return the velocity like:
local partVelocity = part.AssemblyLinearVelocity.Magnitude

Well, I was thinking of making it depend on the angle it has hit.

So a part moving while on a surface, I would want it to return from a range of 0 to 1, just like the Dot product.

When the part hits the ground.

It would return a number from the range of 0 to 1 depending on the angle it has hit.

A part that hits a wall at a 90 degree angle would return 1:

A part that hits a wall at a bit of an angle would probably return 0.4 or something:

After I calculate the angle from a range of 0 to 1, I would multiply it by the speed:
Force = speed * angle