Trouble with vehicles rigidbody/rotation in PUN

Options
Lotte
Lotte
I have some trouble with my vehicles and Photon (Unity).
In my game there are lots of vehicles like cars, boats, tanks, helicopters, aircrafts and usable animals.

The player can get into the vehicle.
Position, rotation and rigidbody velocity get serialized very nice.

All of the vehicles are working fine except the boats and cars.

Once a car or boat was used by master or remote player and another player wants to drive these (used) vehicles, the rigidbody or something else seems to be confused.
The second player can drive the car but if he steers the car tips.
If a second player enters a (used) boat, the boat tips to upside down.

I really couldn't figure out why this happens.

So I wanted to ask if someone else has or had the same problem or any ideas where I should take a look at.

(Unity 4.6.9, Photon v1.20, Game: Eve of Destruction REDUX - www.eod-game.com)

Comments

  • vadim
    Options
    You did not provide any details. How vehicle and players are controlled and synchronized? What happens when player starts driving? Do parent relationships between player and vehicle exist?
    What is special about boats and cars compared to other vehicles?
  • Do you have any source code we can reference? You need to be more specific.
  • Lotte
    Options
    Yes of course there's source code, but it's tooooooooooo much and makes no sense to post all the stuff.
    My question was more addressed to people who may have had the same problem and point me to any direction cause it seems to be a rigidbody problem.

    Btw.
    vadim said:

    What is special about boats and cars compared to other vehicles?

    There is a difference with boats/cars to the other vehicles and I will have a look at that. Maybe this was the help I needed :)
  • Lotte
    Options
    Problem fixed!
    vadim's
    What is special about boats and cars compared to other vehicles?
    pointed me to the solution!

    For any user who may find this thread with the same problem:
    my cars and boats use a script with a variable 'centerOfGravity / centerOfMass'.
    This var wasn't reset when a player left the vehicle wich caused the trouble!
    So a simple RPC fixed it!

    Thanks :)