Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Moving plattforms

Discussion in 'Scripting' started by Nemo67, Jun 2, 2017.

  1. Nemo67

    Nemo67

    Joined:
    Jun 2, 2017
    Posts:
    1
    I actualy want to make a 3D first person platform game with Unity.
    I'm a beginner with Unity and C# coding .

    I've got a litte problem with moving platforms, perhaps you could help me ?


    I've got a square platform in the air that is rotating on the x axis.


    The platform use mesh colider and my camera is on the standart firstpersonneplayer script (using rigid body with gravity).

    The problem is when the square platform rotate, the firstpersonplayer don't follow the platform movment and the player falls.


    So how can i do to make the player follow the platform movment ?

    Is this something to do with the child and parent object concept ? When the player walk on the rotating platform he became the child and the platform became parent and move according to it? How to code this in C# ?


    Hope you can bring some helps to a very new comer ;-)

    Perharps you know the link to good tutorial about this problem on youtube ?
     
  2. Matt-Roper

    Matt-Roper

    <Of The Graphics> Unity Technologies

    Joined:
    Oct 27, 2015
    Posts:
    106
    Hey,

    Yes you could use something like OnTriggerEnter, and when the players enters the trigger set them as a child to the spinning object; this is probably the easiest way...