#Stack of objets wobble around without joints

1 messages · Page 1 of 1 (latest)

sturdy olive
#

Hey. I need to create a stack of objects and they must move around like a rope, but without joints like in this example (https://www.youtube.com/watch?v=h5BZPXj-bo8). I Can't figure it out how to do it without joints

Noodle Run is a food running game where you control a bowl and collect the ingredients for a perfect ramen noodle soup and feed the boy at the end of each level. How high can it get?
Ramen noodle soup is made by collecting the ingredients on the way. Your mission is to collect as many ingredients as you can to make the highest noodle bowl. There...

▶ Play video
analog ginkgo
sturdy olive
#

exactly like the video. The difference is that my character moves omnidirectional with a joystick

analog ginkgo
sturdy olive
#

polyline? Is it a external asset or something?

analog ginkgo
sturdy olive
#

never heard of it. Can you show me an example?

analog ginkgo
sturdy olive
#

Polyline. I'll take a look at it. Meanwhile I tried to make something simpler and I think I got it. I made a stack of objects and made each object Lerp position to one another and altering the lerp time as the stack goes up

#

as for the rotation, I made every object to lerp the rotation of one another relative to the stack origin and rotated the origin to face the direction of the character movement

#

not exactly how I wanted to solve, but it worked

#
    {
        for (int i = 0; i < bodies.Count; i++)
        {
            float rate = Mathf.Lerp(rateRange.x, rateRange.y, (float)i / (float)bodies.Count);

            bodies[i].position = Vector3.Lerp(bodies[i].position, i > 0 ? bodies[i - 1].position + (-bodies[i - 1].forward * offset) : transform.position, rate);
            bodies[i].rotation = Quaternion.Lerp(bodies[i].rotation, i > 0 ? bodies[i - 1].rotation : transform.GetChild(0).rotation, rate);
        }
    }```
#

        Quaternion directionRotation = Quaternion.Euler(Mathf.Lerp(0, -stackMaxTilt, actualVelocity / speed) + 90, 0, 90);

        bodyStack.localRotation = Quaternion.Lerp(bodyStack.localRotation, directionRotation, turnSmoothTime * Time.deltaTime);``` I put this on the Player's Update method
#

I don't know why they asked me to do this without joints, but I think this is a good result. Thanks for the help!

analog ginkgo
# sturdy olive this is the result

Doubt this will look the same with a ton of objects but look cool nontheless. Why no joints? A lot of connected joints tends to be very unstable so doing it by code might be better solution

sturdy olive
#

they asked me specifically not to use joints. Don

#

Don't know why though

analog ginkgo
# sturdy olive Don't know why though

I think I worded it poorly, I meant that using lot of interconnected joints can cause unstable behaviour and the simulation exploding all over the places, that's likely why

sturdy olive
#

oh, that makes sense

analog ginkgo
#

Surprisingly good, great job