I am making an airdrop plugin for a mars themed map and want to make it have kinda like a boost back effect when it lands. I basically just need the heli rocket effect to play at the bottom of the drop when it touches ground. I made this so far but there are two problems, 1. the effect happens on where the signal was and not on the drop. 2. the effect doesn't play when the airdrop lands. Can anybody help me?
Vector3 Getplayervector(Vector3 pos)
{
float x = pos[0];
float y = UnityEngine.Random.Range(350, 450);
float z = pos[2];
return new Vector3(x, y, z);
}
Vector3 Getdropvector(Vector3 pos)
{
float x = pos[0];
float y = 0;
float z = pos[2];
return new Vector3(x, y, z);
}
void Spawnplayerdrop(Vector3 pos)
{
Vector3 position = Getplayervector(pos);
Vector3 effectpos = Getdropvector(position);
BaseEntity supplydrop = GameManager.server.CreateEntity("assets/prefabs/misc/supply drop/supply_drop.prefab", position, new Quaternion(0f, 0f, 0f,0f));
supplydrop.Spawn();
SupplyDrop drop = supplydrop as SupplyDrop;
drop.GetComponent<Rigidbody>().drag /= config.settings.fallspeed;
drop.RemoveParachute();
if (config.settings.useboostback == true)
{
if (drop.transform.position.y == 0)
{
Effect.server.Run(effect, effectpos);
Puts("dropped");
}
}
}