How to replicate state from the controller WITHOUT using commands?

Options
I'm currently trying to integrate some Virtual Reality SDKs with Bolt networking, and am having quite a bit of trouble. I have my "throwable" objects set up so that when a player hovers their hand over the object, the owner of that object (in this case the server) receives a control request Event, and hands control over to that user via "AssignControl()". That seems to be working.

Maybe I'm not understanding the use of the word "controller", but I can not figure out how to let client players pick up objects. Only the server (owner) is able to grab and throw them. I don't want to use commands because there's no actual "controls" being sent; the object should just follow the hand via parenting, and then is dropped via un-parenting. I just want the transform to be replicated from the controller to everyone else. When the object is set as the child of the controller's hand, I want that transform state to be replicated to everyone else. In other words, I want no part in an authoritative model. The easy solution would just be to transfer ownership to the player holding the object, but this is impossible in Bolt. I've gone as far as to consider destroying/instantiating a brand new throwable object every time a player wants to pick it up just to make them the owner, but this is far less than ideal.

How do I let the controller of an object have authority over it without resorting to commands? Or, if I have to use commands, what should I even be putting in the Input/Response structs? Do I need to somehow incorporate the parent/child relationship into a command? Does Bolt replicate parent/child changes automatically with Transform?

Any help is much appreciated.

Comments

  • stanchion
    stanchion mod
    edited March 2017
    Options
    Personally I have been able to get throwing an object working for SteamVR (owner or non owner).
    https://hastebin.com/fetoyuwaxi.http
    https://hastebin.com/ereqonawex.cpp

    You cannot replicate a value from a controller, replications only happen from the owner.

    Yes you could destroy and instantiate and have a "dummy" in between, but this is not necessary.

    Yes you have to use commands, the command I have for my pickupable ball just has Input for position, alternatively just input nothing if you just want it to be in front of where the player is looking ala Half Life

    Not sure what you are asking in respect to parenting, I don't recommend Bolt Entities ever have a parent.
  • Rapskalian
    Options
    Thanks for the reply.

    I've tested out your example code and it doesn't seem to be working. Do I have to be setting anything inside of ExecuteCommand()? Just using QueueInput(input) should be enough to get it to sync the controller's changes to the owner? Right now the owner of the object is not receiving the position updates from the controller.

    Could you explain why parenting should be avoided a little more, and in your SteamVR tests did you use the default parent-to-hand attachment flag?

    Appreciate your help.
  • stanchion
    Options
    Yes there should be a transform.position = cmd.input.position in there

    I don't remember anything about flags, I based it off of the VRTK example for picking up objects
  • Rapskalian
    Options
    So is there no state being replicated through the State object anymore? How would the position be synced if, for example, there was no controller set yet?
  • stanchion
    Options
    It should be replicated through the state, and use SetTransforms to apply the transform