0

Problem with gradual rotation

Crystalius 3 years ago updated 2 years ago 3

Hi!

What's wrong here? Want my object to always look at position but not always locked, not like with Transform.LookAt.

When target object changes position instantly, I want that object to rotate there gradually (speed just depends on lerp time) and I think I got that right but somewhy the rotation isn't correct.
It becomes better when I move my target at long distances from the object I want to rotate.

Tried other stuff too, every other solution I've tried returns me the same bad result.

When I am close and in front of target object, it rotates only slightly but looks like it is trying..


Help would be very appreciated 
Bolt Version:
Unity Version:
Platform(s):
Scripting Backend:
.NET Version (API Compatibility Level):

Basically, you need to reproduce this in bolt:

Put it on the object you want to rotate, set the target to the, well, target, and give it a go!

  1. <span class="typ">Quaternion</span><span class="pun">.</span><span class="typ">LookRotation</span><span class="pun">(</span><span class="pln">target</span><span class="pun">.</span><span class="pln">position </span><span class="pun">-</span><span class="pln"> transform</span><span class="pun">.</span><span class="pln">position</span><span class="pun">);</span>
  2. <span class="pln"> transform</span><span class="pun">.</span><span class="pln">rotation </span><span class="pun">=</span><span class="pln"> </span><span class="typ">Quaternion</span><span class="pun">.</span><span class="typ">RotateTowards</span><span class="pun">(</span><span class="pln">transform</span><span class="pun">.</span><span class="pln">rotation</span><span class="pun">,</span><span class="pln"> q</span><span class="pun">,</span><span class="pln"> speed </span><span class="pun">*</span><span class="pln"> </span><span class="typ">Time</span><span class="pun">.</span><span class="pln">deltaTime</span><span class="pun">);</span>

based on https://answers.unity.com/questions/587956/rotate-towards-target.html

Thanks for reply! 

I think this is the correct translation of C# example to Bolt but it's still the same

Note: code in GIF is different but exactly the same happens with code above
Note2: smaller cube is the object I want to rotate

Funny mistake, I thought minus sign is just a dash instead :D 

Solved