korlibs / korlibs/korge

Off-center rotation with Circle and RoundRect.

Open
#392 2 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Kotlin
Stars
3k
Forks
148
Avg merge
13h 44m
Merged PRs (30d)
1

Description

New project, Korge 2.3.3 with below code:

```kotlin
suspend fun main() = Korge(virtualWidth = 640, virtualHeight = 400, bgcolor = Colors.WHITE) {
val test = circle(radius = 20.0, fill = Colors.BLACK) {
position(320.0, 200.0)
anchor(0.5, 0.5)
}

test.addUpdater { dt ->
test.rotation(test.rotation + 120.degrees * dt.seconds)
}
}
```

Calling ```anchor(0.5, 0.5)``` should place the transform origin to view's center, right? Yet resulting motion is off-center. Furthermore, the wobble radius increases with the window size. The problem also appears when same transformation applied to a RoundRect, but doesn't when SolidRect or Image is used.

Edit: I think this is the same issue with #379.

Contributor guide

No contributing guide indexed for this repository

Research direction

Reproduce the issue with the provided Kotlin example, then compare rotation and anchoring for Circle and RoundRect against SolidRect and Image. Start by tracing the anchor and rotation behavior used by these shapes; done means Circle and RoundRect rotate around their centered anchors without window-size-dependent wobble.

Written by the indexing model from the issue text.

Assessment

Tech stack
kotlin
Domain
game-dev
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.