How can I get an object's CURRENT location?

Started by
3 comments, last by Zahlman 14 years, 7 months ago
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?
Advertisement
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.
"In order to understand recursion, you must first understand recursion."
My website dedicated to sorting algorithms
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()
Please don't cross-post.

This topic is closed to new replies.

Advertisement