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. Dismiss Notice

Bug Weird physics

Discussion in 'Physics' started by Programer_YEAA, Aug 4, 2022.

  1. Programer_YEAA

    Programer_YEAA

    Joined:
    Jun 3, 2022
    Posts:
    91
    I have a system where you control a worm. That worm is made up of meny spheres. The first sphere moves to my mouse, the second sphere moves to the first sphere, the third sphere moves to the second sphere etc. When I use the MovePosition and the spheres get crushed, it results in the spheres acting weird. They try to follow the bal in front of it but does so badly. But when I use velocity. It works fine. Do you have eny ides on what is happening?
     
  2. knobblez

    knobblez

    Joined:
    Nov 26, 2017
    Posts:
    223
    Are you using Lerp or just moving their positions every frame? Not sure what you mean "and the spheres get crushed". Is that part of the game or are you saying when the spheres overlap each other? I would use Lerp and see how that works. Have sphere 2 check sphere 1 for it's position before and after Lerp. If sphere 1 has changed position since start of Lerp, then set that as the new target position after reaching current target position. If no change in position, return;. That way they won't behave like a train and run into each other... Unless that's what you want to happen.
     
    Programer_YEAA likes this.