rotation problem (cap included)

This forum is currently in read-only mode.
  • 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

  • It looks bugged... post on bug tracker.

    Edit: Remove the Physics Behav. The bug is purely on Physics.

  • 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?

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

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • 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.

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

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