[QUESTION] - Is this a bad idea?

Hello guys,
If i attach a plane (not too big) to player without rendering it and get mouse click position via this panel, is this a bad idea for performance?

1 Like

Hi NEUERA_ENTMT,

What you’re suggesting sounds very similar to how the Chessboard sample works.
Rather than actually attaching the collision plane, you could just do the calculations based on the current z of the player?
Assuming the orientation of the plane is staying the same, I think this should work in the same way as what you’re suggesting.
Check out the PointAtZ function defined at the top of the Chessboard sample.

You’ll need to test it but at least based on what you described it shouldn’t harm performance at all.

First of all thank you guys for reply,

What you’re suggesting sounds very similar to how the Chessboard sample works.

Oh thanks i did not know that i’ll definetly check this!

you could just do the calculations based on the current z of the player?

Im not sure how to do this actually, maybe i can use getElevation? or can i get Z pos at X,Y on ShaderTerrainMesh? or should i use GeoMipTerrain?

You’ll need to test it but at least based on what you described it shouldn’t harm performance at all.

Yes i’ll try, just wanted to ask before we go any further.

1 Like

I suppose that my question is… why not just use Panda’s built-in “Plane” class, which has notionally infinite extent, and thus not worry about reparenting an object to the player?

(See this thread for more)

However, to answer your question, I would expect what you describe to be very fast indeed!

Just note that, whether with a plane of your own or Panda’s “Plane” class, you’ll only be getting a flat surface–it wouldn’t take into account your heightmap, or any other things that may affect the height at which the player might expect to click. If that’s as intended, then well and good however!