Consider the following.
I'm loading an XML file containing some (static) world data, for example trees and rocks on certain places.
This produces tiles of which the world is composed (for ease think of a 2d map, so only x en y coordinates exist), so while running the application we see a world in which we can travel.
But, now I would want to add object to the world dynamically, like when i click a certain button and then click a certain spot on the map I want a mesh to be drawn on that position.
Ofcourse I would need to know the x and y coordinates of the point specified.
Here comes the question, what is a good why of getting the coordinates of the point clicked ON the map, should we come up with our own coordinate system, or how should we handle this?
Coordinate system/ dynamically placing objects on the map
-
- Posts: 17
- Joined: Sat Mar 24, 2007 5:03 pm
- Location: Holland
Coordinate system/ dynamically placing objects on the map
Common sense is what tells you the world is flat.
If I understood it properly, you should do something like this:
1) Get a ray using getRayFromScreenCoordinates.
2) Make it collide with your level.
3) Place a new object on the collission coordinates.
________
Justin bieber
1) Get a ray using getRayFromScreenCoordinates.
2) Make it collide with your level.
3) Place a new object on the collission coordinates.
________
Justin bieber
Last edited by LLDD on Sun Feb 20, 2011 7:48 am, edited 1 time in total.
-
- Posts: 17
- Joined: Sat Mar 24, 2007 5:03 pm
- Location: Holland