Hey Forums,
I got the following issue:
I’m instantiating objects from a list of spawning points to 5 randomly picked locations and write them into an array.
These Objects have triggers and can be clicked with the E key. When they get clicked my aim is to tranform their Position to 5 set objects in the world, where the order ist always 1, 2, 3, 4, 5.
The order of clicking said instantiated Objects doesnt matter, they just get moved into the slots one by one.
I can’t figure out how to get the clones to move to my target locations (Objects with different position)
Currently I have this:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class ImprisonBandits : MonoBehaviour
{
bool CheckE;
bool CatchBandit;
public int banditnumber;
public GameObject[] JailSpots;
public GameObject bandit;
void Start()
{
CatchBandit = false;
banditnumber = 0;
}
void OnTriggerStay(Collider other)
{
if (other.tag == "Player" && CheckE == true)
{
CatchBandit = true;
}
}
void Update()
{
if (Input.GetKeyDown(KeyCode.E))
{
CheckE = true;
}
else
{
CheckE = false;
}
if (CatchBandit == true)
{
bandit.active = false;
}
}
}
But sadly that doesnt quiet help.