NextGen Needs Math Help - How hard an actor collides with another?

RedlerTechRedlerTech Member Posts: 1,583
edited November -1 in Working with GS (Mac)
Hey Guys,
I'm in need of some math help please. I'm trying to figure out the force in which one object strikes another. I've tried out some equations involving linear velocity; but nothing has worked. Any help is appreciated.

Thanks,
Matt :D

Comments

  • mangaroomangaroo Member Posts: 419
    why not refer the speed at which the object(s) is going when it overlaps?
  • RedlerTechRedlerTech Member Posts: 1,583
    I tried this ^^^ @Mangaroo. The problem being, it's not just X linear velocity it's both X&Y. I'm having trouble thinking of the equation.
  • DreamLabDreamLab Member Posts: 2,127
  • RedlerTechRedlerTech Member Posts: 1,583
    No, I appreciate the help though :D http://en.wikipedia.org/wiki/Magnitude_(mathematics)
  • mangaroomangaroo Member Posts: 419
    im not sure, its not my strong point but perhaps square the x and y moments then add them then square root that figure to get a figure! hopefully that figure will be right...makes sense to me but i was more bio ;)
  • RedlerTechRedlerTech Member Posts: 1,583
    haha, no i don't think so. It reminds me too much of the pythagorean theory. I'm not finding distance, basically I'm finding the overall velocity the player is at when it collides with the enemy.
  • mangaroomangaroo Member Posts: 419
    i think its the same, make sure to x-1 for negative y/x velocity
  • RedlerTechRedlerTech Member Posts: 1,583
    can you like write out the equation please?

    Thanks
  • mangaroomangaroo Member Posts: 419
    sorry bro not in the right state of mind for that for a few reasons, 4 am is the legit defence :P

    wait its what i described before lol - no need to x-1! squaring will cover you ;) see what i mean :P
  • RedlerTechRedlerTech Member Posts: 1,583
    haha sorry it's 11PM here in Florida, USA :D
  • outasiteoutasite Member Posts: 417
    This is a momentum problem. This will also allow you have have different objects more 'powerful' then others. Example: beach balls VS bowling balls

    P = MV
    Momentum = mass X velocity

    And we are looking for its momentum in both the x and the y.
    I believe its usually calculated separately (P(x) and P(y)), but ehh.

    So we can do:
    mass (self attribute) X magnitude(velocity.x, velocity.y)

    Maybe?
  • mangaroomangaroo Member Posts: 419
    i think square root((linearX * linearX)+(linearY * linearY))?

    edit: outasite sounds legit
  • RedlerTechRedlerTech Member Posts: 1,583
    mangaroo said:
    i think square root((linearX * linearX)+(linearY * linearY))?

    edit: outasite sounds legit

    What exactly is the purpose of the root in this case?, If that works, couldn't we do linearX+linearY?
  • outasiteoutasite Member Posts: 417
    You want the overall velocity when it hits? So the combine value of the x and the y?
    That it pythagoreans. Use vectors...

    A^2 + B^2 = C^2 C is what U want.

    C = [(velocity.x)^2 + (velocity.y)^2]^.5
  • RedlerTechRedlerTech Member Posts: 1,583
    outasite said:
    You want the overall velocity when it hits? So the combine value of the x and the y?
    That it pythagoreans. Use vectors...

    A^2 + B^2 = C^2 C is what U want.

    C = [(velocity.x)^2 + (velocity.y)^2]^.5

    Wow, I'll try this out :D BRB
  • mangaroomangaroo Member Posts: 419
    NextGenEntertainment said:
    What exactly is the purpose of the root in this case?, If that works, couldn't we do linearX+linearY?

    brain does not process, sorry bro think i used up my last energy on the last one but good luck give it a try, im SURE one of the two will work and wont take long to try out!
  • outasiteoutasite Member Posts: 417
    you guys type to fast hah. by the time i post something there are already 17 posts ahead of me... :P
  • RedlerTechRedlerTech Member Posts: 1,583
    @Outasite: I am trying your strategy now :D
  • mangaroomangaroo Member Posts: 419
    NextGenEntertainment said:
    Wow, I'll try this out :D BRB

    its the same as my equation ...

    square root((linearX * linearX)+(linearY * linearY))

    C = [(velocity.x)^2 + (velocity.y)^2]^.5

    ...i think? to the power of 0.5 is same as square root is my feeling, i think nextgen you think he means multiply by 0.5?

    ^ = to the power
  • mangaroomangaroo Member Posts: 419
    that sounds cleaner, guessing it does the same thing? never really understood what magnitude meant from the wiki description
  • RedlerTechRedlerTech Member Posts: 1,583
    So basically, if I get this math correct:

    I am constraining self.Power Of Strike to [ self.Motion.Linear Velocity.X pow(2)+ self.Motion.Linear Velocity.Y pow(2]pow(.5)

    Is this correct?

    Thanks Again,
    Matt
  • RedlerTechRedlerTech Member Posts: 1,583
    Thank You Everyone, I'm going to turn the behavior that Outasite told me & try TSBs. See which one is smoother.
    tshirtbooth said:
    To get total vel.
    Magnitude(Lin.vel.y , Lin.vel.x)

    Thank You All,
    Matt
  • RedlerTechRedlerTech Member Posts: 1,583
    Hey TSB & Outasite,
    I just tried both ways & did a debug by having the actor display self.Power Of Strike & both times it constantly stayed at 0 while I was moving the actor all around with the arrow keys?
  • tenrdrmertenrdrmer Member, Sous Chef, Senior Sous-Chef Posts: 9,934
    tshirtbooth said:
    To get total vel.
    Magnitude(Lin.vel.y , Lin.vel.x)

    This is the clean and easy way of getting a value for speed. (its also the same as all of the square rooting and such that has also been posted in this thread.

    If you are not getting a value from this then you simply are not doing it correctly. The only thing I would do differently is Magnitude(LinearVelocity.X,LinearVelocity.Y) But that just cause im anal about some things. either should work.:)
  • RedlerTechRedlerTech Member Posts: 1,583
    Got it everyone :D Thank you
  • mangaroomangaroo Member Posts: 419
    thanks for confirming tenrdrmer - helps me wrap my head around magnitude
  • outasiteoutasite Member Posts: 417
    outasite said:
    P = MV
    Momentum = mass X velocity

    So we can do:
    mass (self attribute) X magnitude(velocity.x, velocity.y)

    Maybe?

    tenrdrmer said:
    This is the clean and easy way of getting a value for speed. (its also the same as all of the square rooting and such that has also been posted in this thread.

    If you are not getting a value from this then you simply are not doing it correctly. The only thing I would do differently is Magnitude(LinearVelocity.X,LinearVelocity.Y) But that just cause im anal about some things. either should work.:)

    Ya... I don't know why I posted Pythagoras formula even after I posted a magnitude formula.... Sorry if that was confusing.
    outasite said:
    You want the overall velocity when it hits? So the combine value of the x and the y?
    That it pythagoreans. Use vectors...

    A^2 + B^2 = C^2 C is what U want.

    C = [(velocity.x)^2 + (velocity.y)^2]^.5

Sign In or Register to comment.