# Physics Impulse rotates ship

Get help using Construct 2

### » Thu Apr 19, 2012 4:46 am

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.

B
5
S
1
Posts: 19
Reputation: 790

### » Thu Apr 19, 2012 11:01 am

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.
Scirra Founder
B
413
S
244
G
92
Posts: 25,104
Reputation: 199,850

### » Thu Apr 19, 2012 5:43 pm

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...

B
5
S
1
Posts: 19
Reputation: 790

### » Thu Apr 19, 2012 8:10 pm

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.
Scirra Founder
B
413
S
244
G
92
Posts: 25,104
Reputation: 199,850

### » Thu Apr 19, 2012 8:38 pm

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.
B
5
S
1
Posts: 19
Reputation: 790

### » Sat Apr 21, 2012 9:29 am

Or is there another way to utilize the center of mass?
B
5
S
1
Posts: 19
Reputation: 790

### » Mon Apr 23, 2012 9:12 pm

bumping this cause I am not sure where to go from here.
B
5
S
1
Posts: 19
Reputation: 790

### » Mon Apr 23, 2012 10:39 pm

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.
B
5
S
1
Posts: 19
Reputation: 790

### » Mon Nov 05, 2012 11:36 am

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..
Tnx
B
5
S
1
G
2
Posts: 15
Reputation: 1,182

### » Sun Mar 17, 2013 2:12 am

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?Kong Ming2013-03-17 02:13:03
B
4
Posts: 4
Reputation: 333

Next