rotation problem (cap included)

For questions about using Classic.

Post » Wed Jan 13, 2010 2:46 pm

Hi Folks,

this thing is driving me crazy, I already experienced this problem several times:

Normally a sprite rotates around its hotspot, but here it does not and I don't get why. Is it because of the container? I already made sure, that all hotspots of the items in the container are in the same place. My version is 0.99.72

Cab: http://www.runtime-hq.com/files/test.cap

Greetz

maenny
B
2
G
3
Posts: 16
Reputation: 882

Post » Wed Jan 13, 2010 5:20 pm

It looks bugged... post on bug tracker.

Edit: Remove the Physics Behav. The bug is purely on Physics.
B
4
S
2
G
4
Posts: 719
Reputation: 2,938

Post » Wed Jan 13, 2010 7:23 pm

Yes, the hotspot is what is causing the physics object to rotate improperly. Right now Box2D likes it's physics objects to have their hotspots centered. I believe it's an issue that David is aware of.

Anyway, you don't manually move or rotate physics objects or you will get strange results. To rotate a physics object you add torque or angular velocity with the physics actions. Why do you need physics on the cannon anyway, if all you're doing is setting it to immovable and using other methods to move it?
Moderator
B
5
S
2
G
6
Posts: 4,348
Reputation: 10,971

Post » Thu Jan 14, 2010 10:41 am

Well, I need the physics behaviour for other objects to rebounce from the canon. Yet the shooting direction of the canon should be in the hands of the player.
B
2
G
3
Posts: 16
Reputation: 882

Post » Thu Jan 14, 2010 11:08 am

If you're going to use Physics on the cannon, you should use physics to turn the cannon. It's as simple as that.

If you move the cannon in any other way that doesn't use physics, you are going to get strange results.

When two physics objects collide, the physics engine is doing the colliding. It is calculating the force and the acceleration and the collisions within the physics behavior. When you move a physics object another way, by changing the angle or moving it with Drag and Drop or something, then the physics engine doesn't know what is going on. You can push two physics objects into each other, which is something that wouldn't normally happen in the physics engine. Also, if you manually move an object then there is no acceleration or force applied to it in the physics engine, so you won't get accurate collisions.

Long story short, physics doesn't work well with other behaviors or movements. Physics objects only work properly with other physics objects. Hope this helps.
Moderator
B
5
S
2
G
6
Posts: 4,348
Reputation: 10,971

Post » Thu Jan 14, 2010 11:17 am

well, thing is, I already red this problem: physic and other movement don't match. Nevertheless its awkward to let the user rotate the canon with torque. What I do is, when clicked, I disable the physic collisions, the item is moved, then, when the mouse button is released I activate collisions again. Also, for the canon I used another , invisible object for the physic collsion. Now it turns fine and the collsions work. :)

Thanks for the help.
B
2
G
3
Posts: 16
Reputation: 882


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 4 guests