How to use uv coordinates

Thanks, no need for help anymore!

What does this mean? You can get the .textureCoord of anything you hit with raycast… now what do you want to do with it? Remember the UV coordinates are only meaningful for a given texture.

I don’t think you want the “uv coordinates”, you just want the coordinates, right? You can use something like

also remember that uv coordinates are not unique on a mesh. an entire mesh can map to a single coordinate theoretically. this is important if you were planning on changing the pixels of a texture, as every part of the mesh that maps to the changed pixel would reflect that change, not just the hit point.

I think I completely misread OP’s original post.

OP if you just need click-to-place or click-to-move in world space coordinates Unity, hit Youtube for some tutorials… it’s super-simple, just that call that @kdgalla notes above, one or two lines of code.

Sorry for explaining poorly, so I want to spawn another circular quad object that I have as a mark on the map where the player should go.

I do this with RaycastHit.texturecoord to get the uv coords and with that try to instantiate a red circle on the map where I clicked. Currently it just goes to the top left of the world not the map even.

https://docs.unity3d.com/ScriptReference/RaycastHit-textureCoord.html

Right, just as Kurt said, UV coordinates would not help you here. UV coordinates live on the surface of a particular mesh, essentially seperately for each triangle. A seperate quad mesh is a completely speparate object with it’s own mesh and completely seperate UV coordinates which may map a different texture onto the surface of that quad. You need to place that quad object in the world at the right position. While it is possible to figure out which worldspace position(s) a certain UV coordinate maps to, it would be total overkill to go that route. When you use a Raycast you already get the hit.point which is the worldspace position of the hit. That’s where the quad should go. Of course when it’s a circle texture on that quad, as long as the pivot of the quad is in the center, it should be spot on. The rotation of the quad may need to be adjusted, but that depends on the quad you’re creating at the hit point. In most cases using the hit.normal vector and Quaternion.LookRotation to construct a rotation should work.

Hey, got it to work with hit.point thank you!