Skip to content

Bug: sprite.angle not match pymunk body.angle #1887

Closed

Description

@fe11x

Bug Report

When set angle for sprite, then add it the pymunk, now find the real collision shape in pymunk not match with arcade.
code as below:

self.physics_engine = arcade.pymunk_physics_engine.PymunkPhysicsEngine(damping=1, gravity=(0,-900))
sprite = arcade.SpriteSolidColor(width=self.width, height=20, center_x=self.width/2, center_y=30, color=RED)
sprite.angle = -10    # here critical
self.physics_engine.add_sprite(sprite,
                               friction=1,
                               collision_type="conveyer",
                               body_type=arcade.PymunkPhysicsEngine.STATIC)
self.physics_engine.space.debug_draw(self.draw_options)

1
In above pic, the red rect is drawn by arcade, while the grey rect is drawn in pymunk, you can see they don't not match.

Activity

  1. changed the title [-]sprite.angle not match pymunk body.angle[/-] [+]Bug: sprite.angle not match pymunk body.angle[/+] on Aug 25, 2023
  2. cspotcode commented on Aug 26, 2023

    @cspotcode
    Collaborator

    Is this because arcade 2.6.17 rotates counter-clockwise, and pyglet rotates clockwise? arcade 3.x.x changed to rotate clockwise, which matches pyglet.

  3. pushfoo commented on Aug 26, 2023

    @pushfoo
    Member

    Is this because arcade 2.6.17 rotates counter-clockwise, and pyglet rotates clockwise?

    This is probably the cause. I tried replicating the issue on 2.6.17, but the PymunkPhysicsEngine.debug_draw method doesn't exist in that version.

    @fe11x Can you please do the following?

    1. Tell us how you installed arcade
    2. Run arcade in the terminal and paste the output here
  4. fe11x commented on Aug 28, 2023

    @fe11x
    Author

    my way installing arcade @pushfoo

    $ python3 -m pip install arcade==3.0.0.dev20
    $ arcade
    
    Arcade 3.0.0.dev20
    ------------------
    vendor: Intel
    renderer: Mesa Intel(R) UHD Graphics (CML GT2)
    version: (4, 6)
    python: 3.8.10 (default, Nov 14 2022, 12:59:47) 
    [GCC 9.4.0]
    platform: linux
    pyglet version: 2.0.8
    PIL version: 9.4.0
    
  5. einarf commented on Sep 26, 2023

    @einarf
    Member

    This still a valid issue?

  6. einarf commented on Jan 16, 2024

    @einarf
    Member

    Closing this for now. Rotations are indeed clockwise now mathing pyglet. You can simply negate the rotation angle when passing it to pymunk.

  7. Cleptomania commented on Apr 10, 2026

    @Cleptomania
    Member

    Going to re-open this, as we should be auto-handling the negation in the built-in PymunkPhysicsEngine. Namely during the add_sprite and set_rotation functions of it we are not doing this, however when syncing the sprite values to the Pymunk bodies we do. This means generally the sprite is displayed with the correct rotation, but the initially set rotation in pymunk is flipped.

  8. added theissue type on Apr 10, 2026
  9. pvcraven commented on Oct 8, 2026

    @pvcraven
    Member

    Closing as fixed by #2840. The pymunk engine now negates the angle when adding a sprite and in set_rotation, so sprite.angle and the body's angle match.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions