Im looking for formula for calc impact force from speed and mass of flying object.
This i need becouse soon i gona start writing 2d physical engine.
Printable View
Im looking for formula for calc impact force from speed and mass of flying object.
This i need becouse soon i gona start writing 2d physical engine.
the second law of newton should help you out in normal cases (no light speed involved)
you just need to invert it to get the force that's neccesary to stop the object
why don't you use the momentum equations? You can either have a completely elastic collision or an inelastic collision. Of course, there are some that are in between, where it's just a coefficient that is a property of the two materials involved multiplied by the final velocity.
How to check if line is crossed by another line and on what coordinates.
VB Code:
Type tPoint X As Double Y As Double End Type Type tLine B As tPoint E As tPoint End Type Function Intersect(L1 As tLine, L2 As tLine, Optional ByRef Pin As tPoint) As Boolean 'pin is used byref to return the point of intersection Dim a1 As Double Dim b1 As Double Dim a2 As Double Dim b2 As Double Dim i As Boolean Dim t As tPoint 'determine the formula y = a * x + b for each line a1 = (L1.E.Y - L1.B.Y) / (L1.E.X - L1.B.X) b1 = L1.B.Y - L1.B.X * a1 a2 = (L2.E.Y - L2.B.Y) / (L2.E.X - L2.B.X) b2 = L2.B.Y - L2.B.X * a2 If a1 = a2 Then 'test if the lines are parallel If (b1 = b2) Then 'test if the lines start from the same point on the y axis If L1.E.X < L1.B.X Then t = L1.B L1.B = L1.E L1.E = t End If If L2.E.X < L2.B.X Then t = L2.B L2.B = L2.E L2.E = t End If If L2.B.X <= L1.B.X And L1.B.X <= L2.E.X Then 'pick the first point that is on both linesections Pin = L1.B i = True ElseIf L1.B.X <= L2.B.X And L2.B.X <= L1.E.X Then Pin = L2.B i = True Else 'the linesections do not match Pin.X = 0 Pin.Y = b1 End If Else 'no intersection at all Pin = t End If Else 'intersection in one point Pin.X = (b2 - b1) / (a1 - a2) 'calculate the intersection Pin.Y = a1 * Pin.X + b1 i = (la.B.X <= Pin.X And Pin.X <= la.E.X) Or (la.E.X <= Pin.X And Pin.X <= la.B.X) 'test if the intersection is on one of the lines End If Intersect = i End Function