Search Unity

Please. Need help in rotating physicaly player with planet he is on.

Discussion in 'Scripting' started by battou, Jan 28, 2015.

  1. battou

    battou

    Joined:
    Jan 25, 2011
    Posts:
    222
    Hi. finishing my planet generator. Have Quad Tree quadsphere, realistic point gravity (able to launch objects on circle and eliptical orbits using speed and gravity and ect.). Last problem is that when player on the planets surface and planet is rotated - player dont folow planets rotion, so ground slides under player so to say. Any one encauntered such problem? Adding friction about 50 to physics material fixing player position but its then impossible to move player uphill using forces. Please, I will be grateful for any help or advice.
     
  2. QuinnWinters

    QuinnWinters

    Joined:
    Dec 31, 2013
    Posts:
    494
    Perhaps make it so that if the player object is grounded it becomes a child of the planet, that way it's now rotating with the planet. If the player object becomes ungrounded (by jumping or something) remove it as a child of the planet.
     
  3. TiG

    TiG

    Joined:
    Feb 28, 2011
    Posts:
    311
    There are various ways to solve this. However you should give more details. Is the planet rotating naturally or is it rotated with user input? Is the planet a rigidbody? Is the gravity big enough to provide sufficient amounts of friction? How does the player move around? As a rigidbody or char controller or by other means?
     
  4. battou

    battou

    Joined:
    Jan 25, 2011
    Posts:
    222
    Planet and player are rigidbodies. Planet constantly rotating. For now I'm calculating needed velocity vector and power for player to move with surface point around planets rotation axis, so player stays put, but if planet rotating fast enaugh then there is jitter.( I need to make it the way so I can retain speed even after lifting up and gradualy gaint it and lose it, so just parenting is not an option.