Bge 2.56 api

Hi there,

lets move from 2.49b to 2.56.

import bge
controller = bge.logic.getCurrentController()
own = bge.logic.getCurrentController().owner

What are the python codes for this things:

  • Set/Get Location
#set location for local
own.localPosition = [0.0,1.0,2.0]

#get local location doesnt exist

#set location in world 
own.worldPosition = [0.0,1.0,2.0]

#get world location
pos = own.position

  • Set/Get Rotation
#set rotation for local
 own.localOrientation = [[0.0,1.0,2.0],[0.0,1.0,2.0],[0.0,1.0,2.0]]
 #get local orientation doesnt exist
 #set rotation world 
 own.worldOrientation = [[0.0,1.0,2.0],[0.0,1.0,2.0],[0.0,1.0,2.0]]
 #get world rotation
 ori = own.orientation
  • Set/Get Scale
#set scaling for local
 own.localScale = [0.0,1.0,2.0]

#get local scaling doesnt exist
#set scalingin world 
 own.worldScale = [0.0,1.0,2.0]

#get world scaling
  scale= own.scaling
  • Set/Get Parent
#set parent

#get parent
parent =

Thx ppl.

i have copied your parent thing

[/B] Usefull links:

Greets Equal

Here is the new API from
You can find your methodes in the types library.
Use CRTL+F to search.

The API reference is a great place to find the appropriate properties/methods your looking for. For help on converting 2.49 scripts to 2.5, you can take a look at this:

Thx,for the help guys, i gonna check that out and imrovedit my post, so anyone will faster know how to. Because i see this API right now more as a giant wall of text , that is usefull once you have reache your destination, but otherwise you kinda lost a bit.

greets equal

Use the search function. I don’t even know 1% of the total Api, but i can find what i need just searching. And now many names are predictable. Mostrly you will need KX_GameObject and KX_Scene. Look at the functions in this classes and 80% of your problems will be gone

import bge
controller = bge.logic.getCurrentController()
own = bge.logic.getCurrentController().owner
scene = bge.logic.getCurrentScene()

#set location
own.worldPosition = [0.0,1.0,2.0]

#set orientation
own.worldOrientation = [0.0,1.0,2.0]

object = scene.objects[“Cube.001”]

#set parent

#get parent
parent =

#for get, they should work on the opposite side of the equals (thing = own.worldPosition)
#apart from parent

updated, and again thx for your help.

greets equal

sorry, change .worldPosition and .worldOrientation for .position and .orientation, they are both the same but .position is newer
i think its the newest code.

I thought the other API are newer.
Description:The object’s position. [x, y, z] On write: local position, on read: world position
Deprecated since version use: localPosition and worldPosition.
Type : mathurils.Vector

Description:The object’s orientation. 3x3 Matrix. You can also write a Quaternion or Euler vector. On write: local orientation, on read: world orientation
Deprecated since version use: localOrientation and worldOrientation.
Type : mathutils.Matrix

Description:The object’s scaling factor. [sx, sy, sz] On write: local scaling, on read: world scaling
Deprecated since version use: localScale and worldScale.
Type : mathutils.Vector

im confused a bit now…

greets equal

yeah, use the world pos and world orientation, i thought originally they were newest, then oldest but i was right XD