Why when I move the transform closer to the target by dragging it in the editor in the scene view the target start stuttering and moving back?

The script is attached to a transform that move to a target and than when reaching the target the transform become child of the target.

The script is working fine as it is now but if I drag with the mouse in the editor in the scene view the target to the moving transform while the transform is already moving to the target then the transform start stuttering and even moving back a bit like pushed back some forces pushing it back maybe because I’m using lerp in lines 55,56 ? I want to use lerp but maybe it’s making the problem?

Second if I move the target away from the transform instead trying to chase me and reaching me its doing this problems again.

I want that if I’m dragging and make the target closer to the moving transform than just keep the transform moving to the target and become child when they reaching each other and if I drag the target away from the transform make the transform try to chase me reach me and become child too.

using System.Collections; using System.Collections.Generic; using UnityEngine;  public class MoveToTarget : MonoBehaviour {     public enum TransitionState     {         None,         MovingTowards,         Transferring     }      public Transform destinationTransform;     public float speed;     public float lerpTime;     public bool isChild = false;      public AnimationCurve curve = AnimationCurve.EaseInOut(0.0f, 0.0f, 1.0f, 1.0f);     public Transform start;     public Transform end;     public float duration = 10.0f;     private float t;      private Transform originTransform;     private float timer;     private TransitionState state = TransitionState.MovingTowards;     private Vector3 originTrans;      void Start()     {         t = 0.0f;          curve.postWrapMode = WrapMode.PingPong;         originTrans = transform.position;     }      void Update()     {         switch (state)         {             case TransitionState.MovingTowards:                 var v = destinationTransform.position - transform.position;                 if (v.magnitude < 0.001f)                 {                     state = TransitionState.Transferring;                     originTransform = destinationTransform;                     timer = 0;                     return;                 }                 Vector3 moveDir = v.normalized;                 //transform.position += moveDir * speed * Time.deltaTime;                 t += Time.deltaTime;                 float s = t / duration;                 transform.position = Vector3.Lerp(originTrans,                     destinationTransform.position, curve.Evaluate(s));                 break;              case TransitionState.Transferring:                 timer += Time.deltaTime;                 this.transform.position = Vector3.Lerp(originTransform.position, destinationTransform.position, timer);                 if (timer >= 1.0f)                 {                     this.transform.parent = destinationTransform;                     isChild = true;                     state = TransitionState.None;                     this.enabled = false;                     return;                 }                 break;              default:                 this.enabled = false;                 return;         }     } } 

UE4 – Make AI move up and down?

I have this AI character that flys around on the x and y axis in random directions, but is it possible to make the character move up and down randomly? I tried movement input with a lerp and delay but it couldn’t go up and down. If anybody knows how I can achieve this, please let me know. Thank you! 🙂

Gameobject doesn’t move when hits wall

I have a gameobject that moves tile based(It moves 1 unity unit continously when I press button) But when ıt hits a wall, ıt doesn’t move anymore

enter image description here

As you see, When It hits a wall, ıt doesn’t move any direction anymore. Actually I found the problem but I couldn’t find how to solve. The main problem is when cube hits wall, the distance between nextPosition and transform.position never will be <0.0005f But Idk how to solve this.

Those are code that moves cube :

void MovePlayer() {     rb.MovePosition(Vector3.MoveTowards(transform.position, nextPosition, speed * Time.deltaTime));      if (Input.GetKeyDown(KeyCode.W))     {         direction = Vector3.forward;     }      if (Input.GetKeyDown(KeyCode.S))     {         direction = Vector3.back;     }      if (Input.GetKeyDown(KeyCode.A))     {         direction = Vector3.left;     }      if (Input.GetKeyDown(KeyCode.D))     {         direction = Vector3.right;     }      if (Vector3.Distance(transform.position, nextPosition) < 0.0005f)     {         nextPosition = transform.position + direction;     } } 

For games with controllers (ps4, xbox) for fighter games was it intended to use the d-pad to move and do combos or the joystick?

I have been told to ask my question on this site instead. Recently I have many people telling me for Mortal Kombat that I should always use the d-pad to move, while I have always been using the joystick.

(for own curiosity) Was the original intention to use the d-pad, and do most people use it as well?

How to move wordpress to subdomain, keeping only .htaccess and/OR index.php in root domain?

I would like to move all files & folders of the root directory to the subdomain & keep the root directory empty with only the .htaccess file or index.php

I tried to search a lot but fail to get the solution. Only one I got it but that is also not completely working.


It is working perfectly if I will move to the subdirectory, which is also mentioned on wordpress.org but moving to the subdomain is missing.

On this site – Frontpage is working perfectly but the link to the other posts are not working well.

How to move object grid base continuously?

I want to move object continously when I press button just once grid to grid. When I press button to make object move to another direction, it should wait until object is right on the grid and starts to move another direction. Those are my codes. It moves continously when I press once but doesn’t move grid to grid

void GridMove() {           if(Input.GetKeyDown(KeyCode.W))     {         forward = true;         back = false;         left = false;         right = false;      }            if (forward)     {         StartCoroutine(MoveCharacter(Vector3.forward * Time.deltaTime));     }      if (Input.GetKeyDown(KeyCode.S))     {         back = true;         forward = false;         left = false;         right = false;       }       if (back)     {         StartCoroutine(MoveCharacter(Vector3.back * Time.deltaTime));     }      if (Input.GetKeyDown(KeyCode.A))     {         left = true;         back = false;         forward = false;         right = false;               }       if (left)     {         StartCoroutine(MoveCharacter(Vector3.left * Time.deltaTime));     }       if (Input.GetKeyDown(KeyCode.D))     {         right = true;         back = false;         forward = false;         left = false;       }       if (right)     {         StartCoroutine(MoveCharacter(Vector3.right * Time.deltaTime));     }             }   private IEnumerator MoveCharacter(Vector3 direction) {           float elapsedTime = 0f;      originPos = transform.position;     targetPos = originPos + direction;       while (elapsedTime < timeToMove)     {         transform.position = Vector3.Lerp(originPos, targetPos, (elapsedTime / timeToMove));         elapsedTime += Time.deltaTime;         yield return null;     }       transform.position = targetPos;         } 

enter image description here

How do I move forward when an impending doom was stopped by accident?

I’m having an issue in a campaign I am running where an impending doom that was part of a front was stopped by the players pretty much by dumb luck.

In order to both prevent any of my nosy players from getting behind the front info, and to make this simpler I will use a made up example of the same issue I am facing:

My front has the impending doom:

The Dark Serpent Deorcaþexe is awoken by King Cyndemund’s meddling.

And I have an early portent:

King Cyndemund’s scouts retrieve the tomes of arcana.

This portent comes to pass, and the players meet a suspicious pair of travelers staying at the same inn. The pair some sort of box that they are heavily guarding. The players reason that although they look suspicious, many people look suspicious and it just isn’t very important so they will ignore them.

Now this is fine, ignoring my front is something I can totally deal with. This is certainly not the first time this has happened.

However short while later when the party is a bit strapped for cash they decide that they remember these suspicious travelers and figure that they must have something valuable. So they attempt to steal the box, things go south and they end up murdering the travelers. They find that the box contains some boring old books not gemstones and burn the evidence. The party wizard uses charm person to pin the crime on an old man also staying in the inn. They use the reward money to pay off their debts and the party leaves the town later that week.

So now with the tomes destroyed my front obviously has to change, but I am a bit conflicted. Usually when the party ignores a front I want to increase the danger. As far as the party seems to think these travelers were unimportant and I was being stingy with distributing loot. I could make another way for King Cyndemund to access the magic he desires. However I also don’t want to railroad anything, we are playing to find out, and "Oh you destroyed the tomes, but it turns out there was a second copy!" is not really in line with my principles.

So what is the right path here? Do I consider the front resolved even though the players ignored the portents? Do I repair the front and ignore the players actions because they were incidental?

What is the slowest a character can move while still moving?

Stacking various slow effects, such as difficult terrain, prone, etc. Assuming a 30 ft movement, and the character will dash if possible, but there movement must be greater than zero in the end result. Also, for this experiment, it should not be done on a grid, and movements less that 5 feet or fractions of a number of feet are still considered movement.