#Local raycast problem
36 messages · Page 1 of 1 (latest)
Hand position
make sure the ray happens after the hand has repositioned and on the smoothest transform if it is a PredictedObject ^^
I’ll give that a go, thanks
The hand is not a predicted object , it is not networked itself, It is however a child whose parent is attached to a platform moved by the server.
With that in mind, how do I tell when a transform has been moved on the client, is it as simple as ‘previous pos, new pos’ or is there a better way?
theres LateUpdate
and [DefaultExecuteionOrder(100)]
put that attribute above ur class , itl determine order of execution
Ok, will try this morning. I did try LateUpdate with no joy, but haven’t come across the order 100
No joy with that. My focus is on the Platform’s Network Transform, I’m doing a few tests with its settings. I also thought about forcing a low tick rate with a TimeManager to see if it slows the jitter, might help as a clue?
Just adjusted the interpolation on the parent platform’s Network Transform and it had a noticeable affect on my problem. I don’t think playing with those settings will cure it, but it helps show the root of the problem (hopefully)
hmm , if your player is visually smooth on the platform , casting a ray from the hand should be smooth too , mybe its the cursor that is lagging behind?
how are you syncing the platform?
NTs by default iirc move in Update, configurable to LateUpdate if you want. But that shouldnt affect raycast at all since thats just normal unity things.
So the platform’s position is updated on the server and the NT then updates the clients. The player is locally parented to the platform at OnStartClient. The NT on the player has Synchronize Parent and Client Authoritive ticked
I don’t think so, before the platform moves the ray and cursor produce solid results.
Is the issue that the raycat is providing weird results after the platform moves?
I place the cursor at the hit.point of the raycast, in the Update() It jitters about once the platform moves so I assume it’s related. Im not sure which event happens first etc.
I had an idea to use the platform as the source transform for the ray with a local offset to the player’s hand.
what is jittering?
Sorry, shakes about, constantly.
What shakes though?
It will be the ray’s hit.point in world space. As said, solid until platform moves, then gets steadily worse as we move.
I guess as this ray is cast locally by a player but the platform the player is parented to is updated by the server, there is some kind of delay or something causing the ray hit point to shake about.
I feel like something else is happening.
assuming you are just moving the platform with a NT
It might be the hand of the player (that the ray is cast from, is a child of the player attached to the platform, could that be an issue?
Yeah possibly the start position is off. This could create a different hit position, for usr.e
is there a Fish version of Update() or LateUpdate() etc that I should be using?
@quasi dune not exactly. There is timemanager.onupdate/lateupdate ect
but thats just so you can execute things in order of update before or after tick. before/after can be set in the timemanager component
In other words, you do not have to use it, but if you want to have your updates run before or after the tick, you can use those events
That sounds like it’s worth a go, I’ll give it a try tomorrow. Do I need to add a TimeManager component to the Network Manager or can I just use base.TimeManager.update ? Thanks
I tried a few versions of the timeManager updates (late, fixed etc) I added a TimeManager component to my game scene and set the Physics Mode to Time Manager, all no joy. It looks more like its to do with the chain of parent to children objects, with the parent platform getting positional updates from the server, but the child player parts including the hands that shoot the ray, all being moved locally on the client. The Unity Physics Ray uses world space and I wonder if I need some kind of offset. The shaking does get worse as I move away from the origin, but that could also just be a cumulative effect of positional errors.
I don't think it has anything to do with the transform syncing. More likely to be where you're casting to and from. The problem is almost definitely locally not with the network
ok, I'll keep thinking. I had this rig working fine without networking and the problem only occurs once the platform gets moving. I'll let you know if I find the issue.