Feb-03-2017, 07:27 PM
(Jan-29-2017, 04:47 AM)hsunteik Wrote: I have two question
1)how to find the object given the location of the object?
Let's say I draw a cube at coordinate x y z ,4 5 3 respectively.
I want Python to print "cube" when I search the coordinate 4,5,3.
How would I do it?
I can use a variable to keep track the coordinate of every object in the game,but I have infinite amount of object generated in the game scene(using infinite procedural generation)
2)how to find the location of the object given the object name?
Note:I am using OpenGL
Note2:there must be something in OpenGL(or pygame) I can use to keep track of the location of all object in the game scene.
Is there?
You've got the conversation backward. You don't ask python/pygame/opengl anything. Because they don't track anything. You do. Instead of asking those things a question, you tell them things. You have some objects, and you tell those libraries where to display those objects. Nothing moves, unless you tell it to. So there's nothing in opengl/pygame to track where things are... because you should already have that information. Otherwise, how are you displaying it in the first place?