how do i get the location of an object, and set another object to its location.

I have one last big factor to my game, Click to Move/Attack, i need a script that can get the location of my mouse marker i made (it sits on the ground where ever i point my mouse [mouse hit position]) and on a right click event, i need it to set another object to that exact point. by doing this i can work the logic editor to have the player track to that point and stop tracking when the reach it.

thank you for your time. ~Aaron

what about using worldPosition of mouse marker and then telling other object to set its position to that. I used that in one of my scripts and I believe I got the idea from a bullet hit spawn script.

i would love to do what your talking about but im so new to python i dont understand the process of doing what you told me, unless you redirect me to some documentation, but i would really love to have the piece of code you speak of. maybe you could make me a simple .blend example? i would love you for that.

OK I tried that. Main problem was mouse only gives two positions (x and Y). world position needs 3. I tried setting the third to 0 which did move it but then discovered because the mouse looks at screen coordinates, cube really moved far away. I myself am not fully python orient as I am still learning. I can look for the bullet hit script but not sure if this would help. If I think of anything else will let you know. You can look here http://www.blender.org/documentation/blender_python_api_2_62_0/info_overview.html, this has helped me a lot.

i dont even know where to begin looking though the information on that page. i figured it would be easy to tell python to get the x coordinate of an object, and tell another object to set its world coordinate with that same number. im really lost as to why this would be so difficult but there are no documents on python that express how to move or set the location of an object, though i have seen a script on youtube for blender 2.49 that tells how to get one axis location of an object and even check to see if that objects location is more or less or equal to a specified number. do you know anyone on this site that i could ask directly? because i cant seem to come across anyone who knows the simple location aspects of blender python code. :frowning:

This is for 2.4 and not quite what you are looking for. I have not played with it yet but will later.
http://wiki.blender.org/index.php/Doc:2.4/Tutorials/Game_Engine/Resources/BGE_Tutorials/Python_Tutorials/Position_To_Mouse
See if this helps and I will try later myself to see if I can it to work with 2.6 and will let you know as this is interesting to know.

Still no good. Close but still reading high mouse readings. I got no errors in the console which means script works with 2.6 python which is a good thing. Don’t give up though, maybe someone will see this post as well that knows than I do.