Is it possible, through python, to get the coordinates of an object? I’m thinking a tuple is how it would normally happen. I would want this to be updated fairly often. I’m asking this because I have not found an easy way to do this. I have come from a pygame heritage so i am more used to doing things myself.
Ok, thanks. Since i’m starting simple, i thought I’d try a cube. I see that worldPosition is the correct way of getting it (coordinates), but i don’t know how to get there. It isn’t really that clear. Once you learn the basics, you can kinda work of api references, but if you dont’ even know how t o apply them…
Anyway, so far i’ve got
import Blender obj=Blender.Object.Get("Cube") print str(obj) obj(applyRotation(45))
I did apply rotation because it’s a more visible result than something printing [0, 0, 0]
Do not use the module Blender, use the module GameLogic.
You can get/set the position just by
pos = KX_GameObject.position
rotation with KX_GameObject.orientation
Just search this forum for some scripts (e.g. mouse script). They can be a guidline.
Thank you. Now to build a simple FPS with a template of some kind. Or maybe asteroids. Or 3d pong. Or something.