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. Voting for the Unity Awards are OPEN! We’re looking to celebrate creators across games, industry, film, and many more categories. Cast your vote now for all categories
    Dismiss Notice
  3. Dismiss Notice

Creating a platform that acts as if it's on water

Discussion in 'Scripting' started by mrCharli3, Jul 28, 2018.

  1. mrCharli3

    mrCharli3

    Joined:
    Mar 22, 2017
    Posts:
    956
    I am trying to create a 1x1 platform for my player to jump on, that acts as if its floating on top of water when the player jumps on it. By that I mean making the platform kind of rotate around it's center pivot depending on where the player is standing. I.e if the player is on the left side of the platform, it will slowly tip left.

    Can this be achieved using Joints or do I need to write custom code for this?
     
  2. hippocoder

    hippocoder

    Digital Ape Moderator

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    Depends on the result you're asking for:

    • Physics if you want to use forces or have a rigidbody player that isn't kinematic
    • Animator if you want to use a blendtree with x and y to blend to orientation
    • Code, simply create a LookRotation toward a point with some %
    And so on.
     
    mrCharli3 likes this.
  3. mrCharli3

    mrCharli3

    Joined:
    Mar 22, 2017
    Posts:
    956
    Thanks. For physics, should I be looking at hinge joints? I'ts what I've been trying with but no real success yet.
     
  4. SparrowGS

    SparrowGS

    Joined:
    Apr 6, 2017
    Posts:
    2,536
    Just a rigidbody that get more upward force the more it goes below y of let's say 0 (buoyancy)

    you can fix it on the x and z if you want to keep it "in place" but have it float.