bge KX_GameObject.localPosition affect KX_GameObject.worldPosition instead #44847

Closed
opened 2015-05-26 11:27:33 +02:00 by Olm-e · 11 comments

System Information
Operating system and graphics card
any (tested on lenovo R400 with Intel and on AMD 4core with Nvidia GTX460

Blender Version
Broken: 2.73, 2.74 and 2.75 testbuild1

Short description of error

when setting Object.localPosition, it sets Object.worldPosition instead

https://www.blender.org/api/blender_python_api_2_62_release/bge.types.html#bge.types.KX_GameObject.localPosition

Exact steps for others to reproduce the error
Based on a (as simple as possible) attached .blend file with minimum amount of steps

attached .blend demonstrate that trying to steer the default cube on local Orientation based on a localPosition speed doesn't work, the movement is linear and the cube is rotating on itself instead of turning following a curve ... localPosition-bug.blend

**System Information** Operating system and graphics card any (tested on lenovo R400 with Intel and on AMD 4core with Nvidia GTX460 **Blender Version** Broken: 2.73, 2.74 and 2.75 testbuild1 **Short description of error** when setting Object.localPosition, it sets Object.worldPosition instead https://www.blender.org/api/blender_python_api_2_62_release/bge.types.html#bge.types.KX_GameObject.localPosition **Exact steps for others to reproduce the error** Based on a (as simple as possible) attached .blend file with minimum amount of steps attached .blend demonstrate that trying to steer the default cube on local Orientation based on a localPosition speed doesn't work, the movement is linear and the cube is rotating on itself instead of turning following a curve ... [localPosition-bug.blend](https://archive.blender.org/developer/F180114/localPosition-bug.blend)
Author

Changed status to: 'Open'

Changed status to: 'Open'
Author

Added subscriber: @Olm-e-9

Added subscriber: @Olm-e-9

Added subscriber: @Sergey

Added subscriber: @Sergey
Member

Added subscriber: @JorgeBernalMartinez

Added subscriber: @JorgeBernalMartinez
Jorge Bernal self-assigned this 2015-05-29 10:20:43 +02:00
Member

I confirm the bug.

I confirm the bug.
Member

Changed status from 'Open' to: 'Archived'

Changed status from 'Open' to: 'Archived'
Member

I was mistaked. This is not a bug.

localPosition is the object's position relative to its parent and is the same as worldPosition when there is no parent. If you want to move the object along its local axes, create a movement vector, rotate it by the object orientation matrix, then add it to the objects position.

You can replace

obj.localPosition[1] = obj.localPosition[1] + speed

by

obj.applyMovement((0,speed,0),True)

Thanks for reporting

I was mistaked. This is not a bug. localPosition is the object's position relative to its parent and is the same as worldPosition when there is no parent. If you want to move the object along its local axes, create a movement vector, rotate it by the object orientation matrix, then add it to the objects position. You can replace ``` obj.localPosition[1] = obj.localPosition[1] + speed ``` by ``` obj.applyMovement((0,speed,0),True) ``` Thanks for reporting
Author

Changed status from 'Archived' to: 'Open'

Changed status from 'Archived' to: 'Open'
Olm-e reopened this issue 2015-05-29 20:42:21 +02:00
Author

Well ...
1 : I I know multiple manner to do the same effect, it's not the point, but thanks, this add another,
2 : so either it must be renamed "relativeParentPosition" or it has to be added with emphasis in the blender documentation, because it is not coherent with the internal blender usage where you have local and world axis that have nothing to do with parenting... and then it still lacks a function localPosition coherent with the blender interface :
if you play with local axis in the blender interface you would have the described behaviour, not the one you describe.
and it is not coherent with basic physics principles of relativity, and so confusing both with interface and intuitive understanding...

in conclusion : to me it is a bug, somewhere, and not a wrong assumption of my part: spending one day to understand what the behaviour of that function is, and having yourself confirming the bug in the first place is well the proof that there is one. Please give better arguments if you have on the contrary,

tks

Well ... 1 : I I know multiple manner to do the same effect, it's not the point, but thanks, this add another, 2 : so either it must be renamed "relativeParentPosition" or it has to be added with emphasis in the blender documentation, because it is not coherent with the internal blender usage where you have local and world axis that have nothing to do with parenting... and then it still lacks a function localPosition coherent with the blender interface : if you play with local axis in the blender interface you would have the described behaviour, not the one you describe. and it is not coherent with basic physics principles of relativity, and so confusing both with interface and intuitive understanding... in conclusion : to me it is a bug, somewhere, and not a wrong assumption of my part: spending one day to understand what the behaviour of that function is, and having yourself confirming the bug in the first place is well the proof that there is one. Please give better arguments if you have on the contrary, tks
Member

Changed status from 'Open' to: 'Archived'

Changed status from 'Open' to: 'Archived'
Member

well, my confirmation was done quickly between 2 day-job tasks. But I'm with you that the bge api documentation has to be improved.
I add this request as my particular TODO for the modifications that I want to do for this part of bge api (among others like reference or .copy(), etc).

Apart from this, I close the report as it is not a bug (localPosition works as intended).

Thanks for taking your time reporting.

well, my confirmation was done quickly between 2 day-job tasks. But I'm with you that the bge api documentation has to be improved. I add this request as my particular TODO for the modifications that I want to do for this part of bge api (among others like reference or .copy(), etc). Apart from this, I close the report as it is not a bug (localPosition works as intended). Thanks for taking your time reporting.
Sign in to join this conversation.
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
3 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#44847
No description provided.