Hi,
I’m trying to call PickRandomPoint() in a C# script from a javascript …
namespace com.eliotlash.core.util {
static class MeshExtensions {
public const int ENTIRE_MESH = -1;
/// <summary>
/// Picks a random point on a mesh.
/// This requires a lot of expensive setup so don't call in a tight loop.
/// Instead, call the one that returns an array with the # of random points you want to pick.
/// </summary>
/// <returns>The random point.</returns>
public static Vector3 PickRandomPoint(this Mesh mesh) {
return PickRandomPoint(mesh, ENTIRE_MESH);
}
}
}
the above code is in the Plugin folder and my .js can see it.
I thought this would call it …
#pragma strict
import com.eliotlash.core.util;
private var spawnPointPos: Vector3;
function Start ()
{
spawnPointPos = PickRandomPoint(mesh);
}
Also tried …
spawnPointPos = MeshExtensions.PickRandomPoint(mesh);
spawnPointPos = com.eliotlash.core.util.MeshExtensions.PickRandomPoint(mesh)
(mesh) is generated somewhere else …
Any help would be appreciated, thanks.