KX_Camera.getScreenVect() returns incorrect results if called after camera has been moved on the same frame. #43800
Labels
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
4 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender#43800
Loading…
Reference in New Issue
No description provided.
Delete Branch "%!s(<nil>)"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
System Information
Windows 7 64-bit
Intel HD Graphics 4000
Blender Version
Broken: 2.72
9e963ae
Files
getScreenVect_Error.blend - Contains a camera that runs a script that prints the result of two calls to getScreenVect()
Description
The getScreenVect() method returns an incorrect screen vector if called after the camera has been translated on the same frame. The attached file demonstrates this by calling getScreenVect on a camera twice in the same frame: once before it is moved, and once after it is moved. Since the camera is not rotated, the returned values should be identical, but they are not.
Note: It's necessary to use a Delay sensor instead of an Always sensor to call the script since the BGE takes 1 frame to set the initial camera projection matrix.
Changed status to: 'Open'
Added subscriber: @mobious
Added subscriber: @JorgeBernalMartinez
I think that it is due to when you call the second getScreenVec the physics have not been evaluated yet.
For example, if you use the post_draw call then the physics have been evaluated and you will obtain the right values:
you will obtain the following:
Does it work for you?
Hi Mobious,
Have you checked that the solution proposed works for you? Thanks for your time.
Checking the vector during a post_draw call isn't really a valid solution since the scene has already been rendered at that point, so any changes I make are not shown.
My current solution is just to save the untransformed screen vector at the start of the frame before the camera has moved at all:
Then whenever I need to use it, I just apply the current camera transformation:
This issue was referenced by
465a5d29c0
Changed status from 'Open' to: 'Resolved'
Closed by commit
465a5d29c0
.