Physics Impulse rotates ship

0 favourites
  • 10 posts
From the Asset Store
Game Character Ship AI voiceover sound library provides you with more than 370+ sound files.
  • I have this ship i have impulsing around the world..it works good but every impulse starts the ship rotating... this is what I have:

    Apply Physics impulse 2 at angle Ship.Angle at image point 0.

    So image point 0 is center of ship, i can jet int he right direction but it starts spinning the ship when I do. I can set the Ship physics behavior Prevent Rotation to Yes. This stops the impulse behavior but it is my understanding it will stop it from rotating when being struck as well...is there another way to make the impulse not cause the ship to rotate but other than that let it rotate as normal?

    Oh keyboard on space released does the above Impulse Command

    and

    Left arrow down Rotate 5 degrees counter-clockwise

    right arrow down rotate 5 degrees clockwise.

  • If you apply forces or impulses anywhere on the object other than the center of mass, you'll set the object rotating (as per the laws of physics).

    The center of mass is not usually the middle of the object for any object which does not have a rectangular collision mask. Try applying the impluse/force at CenterOfMassX/Y.

  • Not sure how to do this in construct speak. I thought maybe I wanted to apply the impulse force not to the Ship.Angle but to the angle created by the center of mass:

    Angle(0,0, CenterOfMassY, CenterOfMassX)

    this didn't seem to be right...

  • It should be something like Ship.Physics.CenterOfMassX/Y. You can also get it by browsing to the ship object in the floating object panel, and double-clicking the expression name.

  • This is what I found

    Apply Physics impulse 2 at angle Angle(0,0, Ship.Physics.CenterOfMassY, Ship.Physics.CenterOfMassX) at image point 0.

    The result though are not quite what i was hoping for.

  • Or is there another way to utilize the center of mass?

  • bumping this cause I am not sure where to go from here.

  • actually i fixed this by changing the collision poly of the ship to be a bounding box. A quick fix to be sure but works. Now wish I could make the physics object bounce off solids and off the edge of the world.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Hi there!! I was looking for help with a ship physics, and came across this post!

    I was wondering did you manage to get what you wanted? And if so - Any chance you could explain it to me.. I find myself in the same position..

    Any help you could give would be most helpful...

    Tnx

  • I've encountered the same problem and was wondering if anyone has a solution. I get what Ashley is saying about center of mass, but I don't see how you can apply force to that point since you only seem to be able to apply force to image points and not expressions, which wont be exactly on the center of mass for irregular collision polygons. I saw in the update notes for r61 that setting it to a physics-object's origin does it to the center of mass instead, but this doesn't seem to work for me. Does anyone have more info about this?

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