Hi, I am trying to make a simple program in which the player will spawn cubes by clicking on a location on the scene, such as the grassy scene on the panda3d hello world tutorial. However, I cannot find any threads or anything on the docs about how to do this. the closest thing I can find is how to click on 3d objects and get the object name, but I didn’t see any way to return the location of the mouse click. Any help will be greatly appreciated, thank you!
If you’re using a ray-cast to detect the object being clicked on, then the location of the click is the point at which the ray “collides with” the target. If you’re using Panda’s built-in collision system, this should be available in the related “Collision Entry” via the “getSurfacePoint” method.
In the manual, this is covered in more detail on the page for “Collision Entries”, I believe; it should be found here.
entry.getSurfacePoint(nodePath) might help, thank you for your advice!