Need final rendered position of pusher collision object

Pusher collisions are messy behind the scenes, but cleaned up for the final render. If one calls getPos() on an object that is being positioned using pusher collisions, the reported positions reflect the behind-the-scenes noise, and not the cleaned up render position.

I need that clean and screen accurate position, but do not see any way to acquire it. I have checked the Panda3D source code, and it looks like one could grab that cleaned up position at the end up collisionHandlerPusher.cxx, in line 254 where net_shove is applied as a position.

Is there some reason that Panda lacks the ability to acquire the screen-accurate position in this situation? Would adding a hook to expose that position somehow break pusher collision? Is there some reason not to make this available to the user, as .getFinalPusherPos or whatever you like?

If not, I would suggest that this information be exposed to the user. Please, please, please.

Alternately, I suppose it is possible that the Panda cognoscenti have some double-secret procedure for wheedling and wrangling this information from the engine. If there is a known approach for this, some method for screening out the noise to reveal the cleaned-up final position, can it be publicly revealed? Although such a method would sort of be doing it the silly way, working around a limitation instead of removing it.

While I welcome responses, I don’t seem to be very good at the forum back-and-forth these days. I do apologize for that. I post this now only after much hesitation, because I know how I am.

I’m not quite sure that I agree with the premise that this post is based on. What do you mean exactly by “behind-the-scenes noise”? Every shove is supposed to push an object fully out of a particular “into” solid (each polygon counts as a different solid here). It’s theoretically possible that this shove pushes the “from” object into a different solid, which it will then be shoved out of in the next frame, is that what you mean? You could run the traversal several times, but there’s strictly speaking no guarantee that it will ever fully resolve, because there may not be a solution that pushes the object fully out (eg. if you put an object inside a box that’s too small to contain it).

The new object position is the one it will be rendered at - there is no hidden “final” position. But, depending on your task sorting, it’s possible you’re grabbing the position from a frame ago. Or it’s one of those situations where it needs a few frames to fully resolve.

Perhaps understanding your use case a bit better will help us give some advice for how to best address your problem.

1 Like