New answers tagged

0

You had the right keyword: lerp. To be more precise, Quaternion.Lerp. Example from docs.unity3d.com: using UnityEngine; public class Example : MonoBehaviour { // Interpolates rotation between the rotations // of from and to. // (Choose from and to not to be the same as // the object you attach this script to) Transform from; ...


0

We can think of the x, y input on the joystick as just another vector in our game world. Transforming it through the pivot lets you match the plane of rotation to the orientation of the pivot. How's this work for your use case? public class JoystickMatch : MonoBehaviour { public Transform pivot; public float radius = 1f; void Update() { ...


1

I used the method @DMGregory suggested and rotated the joint before setting the limits. Since the joint limits rotation and also cannot be disabled I created a script that rotates and then adds the joint. public class ConfigJoint : MonoBehaviour { private ConfigurableJoint joint; [SerializeField] private Rigidbody connectedBody; [Header("...


0

I solved my problem guys. Trick was to set origin correctly var degrees = (Math.atan2((aimingPoint.x - xDownPoint).toDouble(), -(aimingPoint.y - yDownPoint).toDouble()) * 180.0 / Math.PI - 180.0f).toFloat() powerIndicator.setOrigin(powerIndicator.width/2,0f) powerIndicator.rotation = degrees


1

Okay so the goal is to be able to rotate a rectangular, which I'll call sprite, to line up with an arbitrary point in 2D space, which I'll call target. Rotating sprite to line up with target can be achieved through the Transform.LookAt method provided by Unity, however this alignment will be based upon sprite's center, and we would rather have the target ...


0

I fixed the problem by editing my model and with 3dsmax and change it's position.


Top 50 recent answers are included