|
Post by coolguyplatinum on Mar 22, 2020 19:13:10 GMT
Using basic scenes movable platforms...How do I make them loop though?
Instead of their default which is point A to point B to point B to point A (left to right then right to left).
I was wondering how do you do a continuous loop? I want it to go a full circle with like total of 5 points...
More like a ferris wheel!
|
|
|
Post by coolguyplatinum on Mar 23, 2020 13:40:32 GMT
It only does whats on the top pic. Im trying to get a full infinite loop like bottom pic.
|
|
|
Post by Chronicman on Mar 23, 2020 15:47:01 GMT
Quite easy to do. Select your moving platform and find the child "mesh". There should be a vPlatform component on it. Find the points array and add a new point. Dupe point b change name to c and place point c where u want it, back in the points array find the respected point and replace the transform field from b to c. Open up the vPlatform script add this at the top of the script public int maxPoints = 3; Find the start method and change if (points.Length < 2) return; to if (points.Length < maxPoints ) return; in the inspector change the max points to how ever many points you added.
If you want it to do a complete circle loop put all the segments in and use the first point as the last point.
|
|
|
Post by coolguyplatinum on Mar 23, 2020 19:23:28 GMT
I edited the script and prefab. It still does like the top pic... Is there a line on the script that still makes it move like the top pic?
|
|
|
Post by Chronicman on Mar 23, 2020 19:28:42 GMT
its still only moving to one point ? In the points array you added your new points right ? I just set it up and mine is working.
|
|
|
Post by Chronicman on Mar 23, 2020 20:00:33 GMT
It does however not fully loop, to fix this simply add public bool loop = false; in the variables region with the int from earlier. Next go to the FixedUpdate function and find
if (!invert)
{
if (index + 1 < points.Length) index++;
else invert = true;
}
else
{
if (index - 1 >= 0) index--;
else invert = false;
}
Replace all of that with
if (loop)
{
if (index + 1 < points.Length) index++;
else index = 0;
}
else
{
if (!invert)
{
if (index + 1 < points.Length) index++;
else invert = true;
}
else
{
if (index - 1 >= 0) index--;
else invert = false;
}
}
save it and change the bool in the inspector to true.
|
|
|
Post by rolfy on Mar 23, 2020 22:05:54 GMT
Since finding my platforms had stopped working after updating to 2018 due to them using .js I was about to try and figure this out myself and find you are on top of it here. I can confirm this works a treat so thanks for that Chronicman
|
|
|
Post by Chronicman on Mar 23, 2020 22:10:22 GMT
welcome =)
|
|
|
Post by coolguyplatinum on Mar 23, 2020 22:51:00 GMT
It works! Thanks alot!
|
|
|
Post by kingceryn on Jul 27, 2020 8:06:25 GMT
Any way to get the rotation to only apply to the platform on one axis? Even when my points are zereoed out on all rotations, the platform object keeps rotating on the X and Z axis, when i need it to only use the Y.
|
|