I am trying to code a 3D reticle system.
I am using a VR controller’s position/rotation and raycasting forward from the controller’s position/rotation.
For testing purposes, I have the script spawning a yellow dot at each raycast hit point.
Now the issue I am running into is that, the faster I move the controller, the larger the space between each raycast hit point.
Here’s an image of the raycast hit points, I started with a slow movement from left to right and speed-ed up at the center.
Ideally I would like this to be a line, or at least have an even spacing between the raycast hit points.
I am doing the raycast and placing the yellow dots in the Update function.
I am not sure what’s causing the spacing between points, other than its relative to the controller movement speed.
Is it a refresh rate limit on Update? a limit on the raycaster? or the VR controller position tracking losing precision when moving it fast?
Yes of course. Update runs once per frame. The game can only update a finite amount of times per second. This is what is referred to as the framerate of the game. Your computer cannot run Update an infinite number of times, because that would mean it is doing an infinite amount of work.
What is it you hope to do with this collection of points? Do you want to draw a line with it? If so look into the LineRenderer component. You can use your points in that LineRenderer and it will “connect the dots” for you.
Thanks, guess I have some homework to do on Update.
The dots were just for testing and visualizing where/when the raycast were hitting as I was noticing jittering on the movement of the raycast hit point when moving the controller fast and I was worried it wouldn’t be precise enough.
Initially I was only placing a single object, as a reticle aka crosshair where the raycast hits to be used for aiming and shooting.