2 Physics Problems

emjlr3

Change can be a good thing
Reaction score
395
Problem 1:

Want to find the final vector components of a unit who is sliding one way, and gets hit another way (or the same way) with another force

So say we got Bob

He’s sliding add 45 degrees at a speed of 5 m/s and has mass 100 kg

sin(45deg) = x/5
cos(45deg) = y/5

x=3.53 m/s
y=3.53 m/s

So there are my x and y components

Now big bad projectile Nancy comes along, and hits Bob while going at say, 130 degrees, traveling at a speed of 10 m/s, and has a mass of 75 kg

This is where I get screwed up, it’s easy to map this out on paper for me, but to code it in the WE is a different story
I need my angle theta, so I can find my x and y components, I then need to decide their sign, and add them to my other x and y components to get the new slide angle and speed....any help? Also, I can get what angle Bob is sliding at, but how can a constantly decide what theta is, if say Bob is sliding at 80 degrees, or 240 degrees, etc.

Problem 2:

Say I got Bob sliding across the ground here, moving a velocity Vo. Now Bob would slide indefinitely if it were not for a little thing called sliding friction, which acts against the velocity Bob is traveling at. How can I use, Bob’s mass m, his velocity Vo, and the coefficient of friction between Bob and the ground, u, to determine at was speed Bob decelerates at, if left alone to do so.....?

Thanks guys!
 

Flare

Stops copies me!
Reaction score
662
I'm not too sure, but I think that Bob's new angle would be (Nancy's movement angle) - (Bob's movement angle). Not really sure what you are asking for though :(

This link might be of some use (doesn't show give precise angles, but it simulates a collision, and allows you to control the mass ratio of each projectile)

Collision Simulator

Here's another link to something regarding movement and collision (i think its Vile1's intended (or previously intended before he paused work on AoM) system for knockback)

Knockback Formula thing

Dunno if its allowed to be used by others or not, just saw it and thought I might let you know incase its of any help in your angle-mass-speed question
 

emjlr3

Change can be a good thing
Reaction score
395
I have worked out number 2, though i would still like to hear peoples thoughts on it
 

Pyrogasm

There are some who would use any excuse to ban me.
Reaction score
134
Well, velocity is not a factor in determining the force of friction in the real world. F_f = F_N*µ; the Normal Force on an object multiplied by the coefficient of friction. I'd do it like this:
JASS:
globals
    real GRAVITY = 9.8
    real FRICTION = 0.20
endglobals

struct Object
    unit U = null
    real M = 12.00
    real V = 350.00
    real Angle = 3.14159
    real A = 0
    boolean FrictionOn = false
    real X
    real Y

    method ApplyFriction takes boolean Flag returns nothing //Called maybe depending on terrain type
        if Flag and not this.FrictionOn then
            set this.A = this.A-this.M*GRAVITY*FRICTION
            set this.FrictionOn = true
        elseif not Flag and this.FrictionOn then
            set this.A = this.A+this.M*GRAVITY*FRICTION
            set this.FrictionOn = false
        endif
    endmethod

    method Move takes nothing returns nothing //Called periodically
        set this.V = this.V+this.A
        set this.X = this.X+this.V*Cos(Angle)
        set this.Y = this.Y+this.V*Sin(Angle)
        call SetUnitX(this.U, this.X)
        call SetUnitY(this.U, this.Y)
    endmethod
endstruct

//Whatever else

As for your first question... I couldn't tell you unless you answered me this: is the collision elastic, inelastic, or perfectly inelastic? Do Bob and Nancy move as 1 projectile afterward, or as 2 separate ones?
 

Steel

Software Engineer
Reaction score
109
Emjlr3 you probably know this already but is it just an elastic collision (unless you are doing some crazy stuff). Did plenty of these years back in physics.

Wikipedia is usually alright explaining things, I found their example to actually be pretty perfect. Check it out: http://en.wikipedia.org/wiki/Elastic_collision

Should be just fine, it's fairly simple. If you haven't figured it out, I'll sit down and hammer out the code with/for you.
 

soulreaping

New Member
Reaction score
17
Well you need to write the equations of the law of conservation of momentum because it's an elastic collision so momentum is conserved.

Momentum is: p = mv where m is the mass, v is velocity.

It goes like this:

Code:
p1i + p2i = p1f + p2f

Where i is the initial momentum and f is the final momentum.

So if you do it on both axises it goes like this:
Code:
X-axis:
m1*v1*cos(ang) + m2*v2*cos(ang) = m1*u1*cos(ang) + m2*u2*cos(ang)

Y-axis:
m1*v1*sin(ang) + m2*v2*sin(ang) = m1*u1*sin(ang) + m2*u2*sin(ang)

From this you can find both final velocity, and then using the trigonometric function atg to find the angel.

Also you can use the law of conservation of energy, to find the velocity but momentum is the way to go.

EDIT:
I just remembered: The angel between 2 masses that collide an elastic collision is always 90 degrees.
 

emjlr3

Change can be a good thing
Reaction score
395
collisions would be inelastic for my purposes, which is how things tend to work in real life, at least for the application I am basing this from, cars colliding

btw Pyro, that is what I came up with for Part 2

**For part 1, I believe I need to find the x and y components for the velocity of each part, but again, relating those velocities as positive and negative, as well cs coming up with the theta I need eludes me.

anyhow, once I have the components

I can then use v = m1v1 +m2v2/m1+m2
for x and y
I can then again use SOHCAHTOA to get my final velocity, "hypotenuse" of my triangle. But i still need the angle they will travel after hitting..

**
May have got something, gotta get off the comp now, but if anyone cares to look, here is what I got

  • speed = acceleration to knockback at
  • mass = mass of "thing" doing the knocking
  • angle = angle to knockback at, in radians
  • u = unit to knockback
  • d.ang = current angle u is being knocked at, in radians
  • d.vel = current velocity of u
  • m = mass of u

JASS:
    local real theta
    local real velx1
    local real vely1
    local real velx2
    local real vely2
    local real new_ang
    local real new_vel
    
        set angle = bj_RADTODEG*angle
        set theta = ModuloReal(angle,90.)
        set vely1 = Sin(angle)*speed
        set velx1 = Cos(angle)*speed
        if angle<=90. then
        elseif angle<=180. then
            set vely1 = -vely1
        elseif angle<=270. then
            set vely1 = -vely1
            set velx1 = -velx1
        else
            set velx1 = -velx1
        endif  
        
        set angle = bj_RADTODEG*d.ang
        set theta = ModuloReal(angle,90.)
        set vely2 = Sin(angle)*d.vel
        set velx2 = Cos(angle)*d.vel
        if angle<=90. then
        elseif angle<=180. then
            set vely2 = -vely2
        elseif angle<=270. then
            set vely2 = -vely2
            set velx2 = -velx2
        else
            set velx2 = -velx2
        endif   
        
        set velx1 = ((mass*velx1)+(m*velx2))/(mass+m)
        set vely1 = ((mass*vely1)+(m*vely2))/(mass+m)
        set new_vel = SquareRoot(velx1*velx1 + vely1*vely1)
        set new_ang = Atan(vely1/velx1)*bj_RADTODEG
        
        if new_ang<0. then
            set d.ang = new_ang + 360.
        else
            set d.ang = new_ang
        endif
        set d.ang = d.ang*bj_DEGTORAD
        set d.cos = Cos(d.ang)
        set d.sin = Sin(d.ang)
        set d.vel = new_vel


at the end, d.cos and d.sin will be the angle the unit u will be knocked back at now, in radians, and d.vel is the new velocity of the knocked back unit u
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Staff online

      • Ghan
        Administrator - Servers are fun

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top