decentraland / decentraland/sdk
SDK7: Player entity position is not being updated correctly on every frame
- Dominant language
- No language data
- Stars
- 4
- Forks
- 5
- PR merge metrics
- No merged PRs in 30d
Description
When checking the player's position every frame (example code below) there are frames in which the system receives the same player position as the previous frame, even though the player is constantly moving...
### Example Code to reproduce the issue
```
let lastPlayerPos: Vector3 | undefined = undefined
export function playerPositionCheckSystem (dt: number) {
if (!Transform.has(engine.PlayerEntity)) return
const playerPos = Transform.get(engine.PlayerEntity).position
const moved = playerPos != lastPlayerPos
console.log(`player moved? ${moved}`)
lastPlayerPos = playerPos
}
engine.addSystem(playerPositionCheckSystem)
```
One example scene that suffers from this is the [avatar-swap test scene](https://github.com/decentraland-scenes/sdk7-goerli-plaza/tree/main/avatar-swap), affecting its character animations while moving.
### Possible Different Causes
- The renderer is sending wrong values on some frames
- The scene runtime / kernel is not reading the new values on every frame
- The system is being called twice in the same frame for some reason
Contributor guide
Research direction
Start with the playerPositionCheckSystem entry point, the Transform access on engine.PlayerEntity, and engine.addSystem in the reported example. Reproduce the behavior in the linked avatar-swap test scene while checking whether repeated positions come from the renderer or scene runtime. Done means player positions update on every frame and the affected character animations behave correctly while moving.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- game-dev
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100