Search Unity

  1. Unity 2019.1 is now released.
    Dismiss Notice

Object dropped on a spinning platform

Discussion in 'Physics' started by monsieurtasse, Feb 3, 2015.

  1. monsieurtasse

    monsieurtasse

    Joined:
    Feb 2, 2013
    Posts:
    12
    Hi,

    I am a bit lost and I thank you in advance if you can nudge me in the right direction.

    I am trying to have an object falling on a rotating plate (on Y axis) behave correctly.
    The idea is that the object will move from its point of collision on the rotating platform and rotate along.
    Also, if the rotating speed was to accelarate, it would be ejected from the platform

    How should I proceed?
    Thanks for any help!
     
  2. andeeeee

    andeeeee

    Joined:
    Jul 19, 2005
    Posts:
    8,768
    Hi, welcome to the forum!

    You can rotate an object around an axis without code by using a Hinge Joint. Notwithstanding its name, the hinge can be placed anywhere on the object (in your case, probably the centre of the plate) and a motor force can be set to rotate the object automatically around the hinge.

    Both the plate and the falling objects will also need to have rigidbody components attached as well as suitable colliders that define the shape of the object to the physics engine. With these components in place, the falling objects will land on the plate and respond realistically to its rotation.
     
  3. monsieurtasse

    monsieurtasse

    Joined:
    Feb 2, 2013
    Posts:
    12
    Thank you very much!
    Going to try this and I'll post where I'm at!
     
  4. monsieurtasse

    monsieurtasse

    Joined:
    Feb 2, 2013
    Posts:
    12
    Works like a charm, thank you!
    I will now work on having the player control the rotation of the plate, hope it is compatible with the HingeJoint trick!

    I thought Rotate was enough to have everything behave properly, but I was wrong! I would have never thought of HingeJoint for that use. Thanks again!
     
  5. monsieurtasse

    monsieurtasse

    Joined:
    Feb 2, 2013
    Posts:
    12
    Now, I am struggling with the Hinge properties to control it properly.
    I want the player to be able to rotate to left or right, and be still when there are no input.

    I tried to tweak target velocity and motor force, but the speed is not consistent depending it's positive or negative, and I can't get the hinge to completely stop on any given moment.

    Thank you to anyone for any help once again!

    Edit: I am thinking about a fixed joint between 2 objects, one would the center, the other a "satellite" that the player could control. Going to investigate.
     
  6. andeeeee

    andeeeee

    Joined:
    Jul 19, 2005
    Posts:
    8,768
    How does the player control the rotation? Is it by dragging/flicking the plate or by using keystrokes to change the speed or something else entirely? If you need the plate to stop quickly then you might need to apply some force to act like brakes. If you just want its rotation to gradually die down when the motor is off then you might be able to get away with just increasing the angular drag property.
     
  7. monsieurtasse

    monsieurtasse

    Joined:
    Feb 2, 2013
    Posts:
    12
    Thank you for your time!
    To answer you, in a perfect world, touch control by dragging would be great, but I could settle for the mouse look.

    I found a solution to stop the motor: I simply set "is kinematic" on and off when I want to, that's efficient.

    I want physics for the objects falling, but the plate should behave like a transform.rotate.

    I really thought it would easier be to do all that. I wish something as simple as transform.rotate was compatible with physics.

    edit: Investigating addTorque! *newbie*
     
    Last edited: Feb 10, 2015