GameLogic with Python

Hi,

How do I get properties of an object like size?
I am writing a Python code for a CUBE object so that the cube follow mouse movement. For this, I need to get the size property of the CUBE object. FI konw that obj.getSize() works for Blender-Python API but it is not working for GameLogic.

Can somebody tell me a good reference for the Python API for GameLogic?

Thanks in advance.

Hello

This?
http://www.blender3d.com/documentation/pydoc_gameengine/PyDoc-Gameengine-2.34/GameLogic-module.html

there is no getSize() for gamelogic but if im not mistaken you can calculate the size yourself with either getOrientation() or getVertex() :frowning:

well, this is the code for max “wideness”(not really sure what to call it)

import GameLogic

cont=GameLogic.getCurrentController()
owner=cont.getOwner()
mesh=owner.getMesh()
arlen=mesh.getVertexArrayLength(0)

for i in range(0,arlen):
	vpos=mesh.getVertex(0,i).getXYZ()
	for n in range(0,3):
		if vpos[n] > owner.max:
			owner.max=vpos[n]
		if vpos[n] < owner.min:
			owner.min=vpos[n]

max=owner.max-owner.min
print max

but why do you need to find size? there are a couple different ways i can think of to “grab” and move an object. if you gave me some details i’ll write a script for you :wink:

I have couple of objects that I would like to grab and move with mouse (on+left+move) combination.
Following is the script I found from this forum that works fine for a ‘Plane’ but does not work for an arbitrary mesh. I found it is because a ‘Plane’ mesh has attributes of xsize and ysize but not other meshes like ‘Cube’ or ‘Sphere’.

if mover.isPositive() and mleft.isPositive():
w = float(Rasterizer.getWindowWidth()/2)
h = float(Rasterizer.getWindowHeight()/2)
x = (mmove.getXPosition() - w) / wowner.xsize
y = (mmove.getYPosition() - h) / h
owner.ysize
pos = owner.getPosition()
owner.setPosition([x, y, pos[2])

If you can teach me a simpler way to grap and move an arbitrary mesh object, that would be much appreciated.

Thanks in advnace