#Local raycast problem

36 messages · Page 1 of 1 (latest)

stiff pumice
#

what are you casting from? hand position , player transform , camera transform?

quasi dune
#

Hand position

stiff pumice
#

make sure the ray happens after the hand has repositioned and on the smoothest transform if it is a PredictedObject ^^

quasi dune
#

I’ll give that a go, thanks

quasi dune
#

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.

quasi dune
#

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?

stiff pumice
#

theres LateUpdate

#

and [DefaultExecuteionOrder(100)]

put that attribute above ur class , itl determine order of execution

quasi dune
#

Ok, will try this morning. I did try LateUpdate with no joy, but haven’t come across the order 100

quasi dune
#

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)

stiff pumice
#

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?

floral kelp
#

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.

quasi dune
# floral kelp how are you syncing the platform?

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

quasi dune
floral kelp
#

Is the issue that the raycat is providing weird results after the platform moves?

quasi dune
#

I had an idea to use the platform as the source transform for the ray with a local offset to the player’s hand.

floral kelp
#

what is jittering?

quasi dune
#

Sorry, shakes about, constantly.

floral kelp
#

What shakes though?

quasi dune
#

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.

floral kelp
#

I feel like something else is happening.

#

assuming you are just moving the platform with a NT

quasi dune
#

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?

floral kelp
#

Yeah possibly the start position is off. This could create a different hit position, for usr.e

quasi dune
#

is there a Fish version of Update() or LateUpdate() etc that I should be using?

floral kelp
#

@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

quasi dune
#

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

quasi dune
#

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.

floral kelp
#

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

quasi dune
#

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.