Improbable Icon

Physics issues in VR

v9-1-1

#1

When a player holds an item in their hand, the object tracks fine from the players perspective. To other players, the entity moves uncontrollably. See gif below.

Also, when the player throws the object too hard (which in VR seems to be instinct :slight_smile: ), the physics simulation gets messed up (object flies back and for on the the screen only to settle in one area and jitter in place). Entities are kinematic when picked up and gravity turned off and returned to gravity on and not kinematic when dropped.

It’s hard to troubleshoot these issues since I need to upload to the cloud to have 2 computers connect at once (1 vr and 1 non-vr) and I’m not able to see the state of rigidbodies in the cloud. Suggestions on a better workflow for VR are welcome.


#3

I vaguely remember having had a similar issue. In my case that was caused because I had physics applied to the object and also updating the position from a script based on the SpatialOS determined position.

Another suggestion that I can give you: have you tried updating the position in FixedUpdate or LateUpdate? FixedUpdate is recommended when you want the position applied after Physics calculations and LateUpdate is a bit of a trial and error as this is the last moment before rendering occurs.


#4

Hi, I agree with @draconigra comments, double check its being set to Kinimatic on the owner too.
If that fails, a little more detail on your pickup commands might be needed :slight_smile: Who has the auth over the picked up object? Is it retained on the fsim?

Re workflow, I’ve found the following setup reasonable:

  • Mirror the projects worker as Briang described here. This will allow you to see the Worker and Client in two editors, check their properties etc. It takes a little time to set-up but it’ll be well worth it
  • Use Clumsy to simulate packet loss / lag
  • Use “spatial local worker launch UnityClient default” to launch a second client (write a unity editor button with this to save typing it)
  • A script to allow you to switch between spec and VR players if needed. I think the VR example had this if I remember correctly. I find having two VR Clients running on the same comp via the same VR input useful, however, as this will mirror your actions on the remote player, allowing you to test ‘remote’ player actions from a local player’s perspective.
  • Don’t bother with the cloud deployment unless i’m testing on a remote machine

Hope that helps
Laurence


#5

Looks to me like it’s not being set to kinenatic on a non-player prefab. As in I’m Player A, I pick up a ball and it’s correctly set to kinenatic, but my prefab on Player B’s client is not setting the ball to kinenatic.
It’s either that or, like said above, the script you’ve got which “attaches” the ball to the hand is updating too often/not often enough.


#6

Thanks for the ideas, I will give them a try