playerposition only updating when surging or teleporting
I brought this up in the Discord and thought I would create an issue here.
When using bolt.playerposition() the values only update when I either use surge or I teleport. It does not change when I use dive.
bolt.onswapbuffers(function (event)
local x, y, z = bolt.playerposition():get()
print(x, y, z)
end)
https://github.com/user-attachments/assets/a0ca2445-8dc4-4f96-8b42-98efb6c03fd4
Yeah, I'm not sure, but I expect it's due to the graphics pipeline being different somehow. Can you share a screenshot of all of your graphics settings? I'm hoping there'll be a way for me to replicate this so that I don't have to get you to do all the debugging of the internals.
Only read on if you're interested in technical details...
The existence of the playerposition function is a bit misleading about how much information Bolt really has access to. You might think it's reading it from client memory or the camera transforms or something, but in fact it's crazier than that. It's to do with this silhouette:
The game draws this in front of any object that obscures part of the player model, and, crucially, it does it ONLY for your player model, not for anyone or anything else. It's a redraw of the same vertices but with a different shader, no textures, and a different depth function. All that means Bolt can recognise it and figure out the world position of the model, then store it away for when playerposition is called.
The game has a texture (or "Surface", in Bolt API terms) that it draws the silhouette to near the end of each frame, then it draws that image to the screen. It does this every frame even if no part of the silhouette is actually visible. Bolt tries to keep track of that surface. In src/library/gl.c, the texture ID is stored as player_model_tex, and the function drawelements_handle_3d_silhouette is called any time something is drawn to this surface.
I can think of two things that could be happening.
- something other than the player model is being drawn as a silhouette for some reason, and its position is overriding the player position.
- Bolt is looking at the wrong texture.
I don't know of any conditions that would cause either of these to happen, yet.
Thanks for adding some context, I was actually curious how it works.
Here's my graphics settings, I'll try messing with them in the meantime to see if I can get it working...
In additional options -> accessibility options with high contrast mode or always on with silhouette I can get it to update for NPCs when I move my camera around. I imagine that's just because it's using the same process as on the player, but thought I would mention it
Interesting, high contrast mode does indeed make it pick up on other players sometimes, but it seems to still be my own position if I'm the only player nearby.
Entity highlights don't change the behaviour for me though. Those entity highlights are drawn in the same way as the player silhouette, so they actually would get picked up - except the player silhouette is always done first, as far as I know, and so Bolt ignores every such texture after the first one per-frame.
I hopped to a different character and had no issues - same interface, same settings, but different cosmetics. It looks like my outfit is the problem, specifically the Renegade Chestpiece override. Removing it fixes the issue.
Another cosmetic that does it is the Radiant Crusader Platebody
That's very strange. Yes, I get the same thing when I use the renegade chestpiece, but why? It's literally just a normal model, it doesn't mess with overlays or silhouettes?
I'll have to have a good look into this at some point. In the meantime, sounds like you have a workaround at least.
Anyway, not related to this, but it'll save you some trouble at some point in the future: having Bloom set to "high" prevents gameview overlays from being rendered correctly. I'm not sure how, but it fuzzes them to the point of being almost invisible.