How can I get an object's CURRENT location?
I have a paddle object which moves left and right along the X axis. I used the getLocation() function to print the location of the paddle every time it moves, but I always get the initial location of the paddle.
My question is, how can I get the current(changed) location of the paddle?
Not enough information. You're going to have to show us how you store and manipulate the paddle position already; in other words, post your code.
It sounds like you're copying an object, perhaps because it is passed by value instead of reference or pointer, or perhaps because you're assigning it to an object, expecting this to act as it would it some other languages and just refer to the same thing. We can't tell without seeing some relevant code.
The paddle is manipulated by logic bricks inside the blender game engine. However, here is the code for printing the location
import GameLogicimport Blenderimport ospaddle = Blender.Object.Get ('Paddle')ball = Blender.Object.Get('Ball')cont = GameLogic.getCurrentController()me = cont.getOwner()bounce = cont.getSensor("moveRight") #get the sensor that checks for input in the #right directionif(bounce.isPositive()): #is the right key pressed? print paddle.getLocation()
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement