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

Make an object fall at a fixed speed

Discussion in '2D' started by Gonzasmpl, Oct 29, 2018.

  1. Gonzasmpl

    Gonzasmpl

    Joined:
    Jul 30, 2018
    Posts:
    55
    Hi!, I have been thinking about how to do this but i didnt reach anywhere. Basicaly i want objects to fall at a fixed speed, but them as well should being able to collide using the physics engine. Changing the transform of the object over time or its rigidbody2d.velocity is not an option because it makes the collisions looks awful.
    If you know how can i solve it or you came up with something that could work let me know. Thanks!
     
  2. Vryken

    Vryken

    Joined:
    Jan 23, 2018
    Posts:
    2,106
    Use a kinematic RigidBody and move it via script using MovePosition.
     
  3. deliquescator

    deliquescator

    Joined:
    Apr 30, 2016
    Posts:
    57
    I assume you don't want it to slow down? You can always just use the gravity in the rigidbody's properties which will make it fall at terminal velocity depending to gravity and drag.
     
  4. vakabaka

    vakabaka

    Joined:
    Jul 21, 2014
    Posts:
    1,153
    not working too ?
    if (rigidbody.velocity.y < maxSpeed) rigidbody.velocity = new Vector2 (rigidbody.velocity.x, maxSpeed);
     
    Last edited: Oct 29, 2018
    ow3n likes this.
  5. Gonzasmpl

    Gonzasmpl

    Joined:
    Jul 30, 2018
    Posts:
    55
    Thanks! now it is working fine.