Skip to content

Camera position one frame too late #5

@einarnordengren

Description

@einarnordengren

This is maybe not very relevant to the defold-pbr itself, but it is to the test project.

When calling PBR.set_camera_world(go.get_world_position("/camera")) in the update function, the PBR extension will get the camera position one frame after each render leading to lighting calculations being a bit off when moving the camera.

I had to do two things to fix this: 1) Call PBR.set_camera_world after the camera gets its new position. 2) Use go.get_position instead of go.get_world_position as go.get_world_position is lagging behind one frame. Posting a message and setting the position using go.get_position in on_message worked for me. Maybe there's a better way.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions