Python Forum
How to find the location of an object and object at a given location?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to find the location of an object and object at a given location?
#16
(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?
Reply


Messages In This Thread
RE: How to find the location of an object and object at a given location? - by nilamo - Feb-03-2017, 07:27 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  [PyGame] Rect object penetrates wall on one side Jan_97 4 2,783 Dec-30-2021, 11:08 PM
Last Post: Jan_97
  [PyGame] object has no attribute 'add_internal' djwilson0495 7 8,445 Feb-26-2021, 05:06 PM
Last Post: nilamo
  Location of the objects that are moving rturus 1 2,239 Feb-01-2021, 05:44 PM
Last Post: nilamo
  [PyGame] why the position of the object is different? syafiq14 1 2,025 Nov-24-2020, 03:22 PM
Last Post: metulburr
  [PyGame] object's movement to left leave shadow on the screen Zhaleh 3 3,336 Aug-02-2020, 09:59 PM
Last Post: nilamo
  I can't control the speed of the turtle object Hesper 1 2,699 Apr-10-2020, 01:37 PM
Last Post: deanhystad
  open cv ->pygame: turn image into location Gamedeveloper 1 2,176 Jan-20-2020, 05:00 PM
Last Post: michael1789
  rect object not loading BlueClaw 2 4,291 Dec-11-2019, 04:25 PM
Last Post: BlueClaw
  beginner - object has no attribute gean 2 3,869 Nov-07-2019, 02:02 PM
Last Post: gean
  [pygame] Moving an object at angles SheeppOSU 3 8,793 Oct-24-2019, 08:05 PM
Last Post: SheeppOSU

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020