Fix my physics?

This forum is currently in read-only mode.
From the Asset Store
Simple yet very life-like rag doll made with Physics!
  • Hey, I've had this stuck for a few months and have not been able to figure out collisions.

    It's a top-down 360 spaceship movement with a loose-drifting movement and I need the ship to bounce correctly.

    I have 8 Variables for the ship.


    MovSpeed = How much push the engines are giving

    XPos = X Position

    YPos = Y Position

    XMov = The movement from the engines along the X plane

    YMov = The movement from the engines along the Y plane

    XMovEx = The movement from external forces along the X plane

    YMovEx = The movement from external forces along the Y plane

    I needs to make the ship bounce when it collides with another object. But not some arrbitrary amount. If a heavy & slow object pushes against the ship then the ship gets moved out of the way (Like a bulldozer) or if a extremely fast yet small object hits then the appropriate force would be applied to the ship.

    If anyone can help me on this that'd be just outstanding!

    I hope I made some sense.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Whoops, didn't upload the file. It's in the upload section.

  • Is this a custom physics engine you're making?

    I've tried many times and it's the bounces that get me.

    If there was a way to use the ball behaviour's bounce code in custom engines then i'd have no problem, finding normals from raster images is a pain in the bum

    But with you're code, if it's a custom one, I think you'd only need one set of X and Y movement variables, because as soon as something hits it, you could just alter the one set of X and Y variables accordingly.

    eg: Xcomponent = 50

    then he runs into something: Xcomponent = -20

    etc, so it would just look like he bounces off it, you would of course have to set the Ycomponent ones too obviously.

    I'm no maths genius but for working out the weight of things and how they will affect your movement on collisions (this is assuming that somehow we got the bounces working) you would need a Mass variable for each object (if this is custom, if using the physics behavior, just use it's mass field) and then you can work out the momentum, which i believe is Speed * Mass

    You can easily work out the Speed by using the system function distance(0, 0, Xcomponent, Ycomponent). Then again i could be completely wrong

    I wouldn't know how to change your movement variables once they collide, but i'm pretty sure you'd have all the numbers there that you need, if i was you i would just play around with it until i got it right. Like i said i'm no maths genius, i'm sure there's someone here who is though and might be able to shed some more light on the whole thing.

    P.S. Hi Devs

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)