Question by
djgraff1 · Nov 01, 2017 at 06:11 PM ·
movementprojectiletower-defense
moveTowards not working
the moveTowards function is not working in my script:
I have tried making it keneitic an adding force. I also have added speed in the inspector.
This is whats inside my Update function:
if (target != null)
{
Action(target);
GameObject TemporaryBulletHandler;
TemporaryBulletHandler = Instantiate(Sphere, Bullet_Emitter.transform.position, Bullet_Emitter.transform.rotation) as GameObject;
Rigidbody TemporaryRigidBody;
TemporaryRigidBody = TemporaryBulletHandler.GetComponent<Rigidbody>();
float step = speed * Time.deltaTime;
pos = Vector3.MoveTowards(transform.position, target.position, step);
TemporaryRigidBody.MovePosition(pos);
Destroy(TemporaryBulletHandler, 10.0f);
the sphere that gets created does not move.
Comment
Your answer
Follow this Question
Related Questions
Occasional NavMeshAgent gets stuck and goes the wrong direction 1 Answer
Movement following the A* algorithm 0 Answers
,I'm having trouble rebounding multiple projectiles with the same tag off a game object. 0 Answers
Enemy AI using pathfinding to avoid obstacles 1 Answer
Restrict Movement Changing Mid-air With CharacterController 0 Answers