Hello Guest

Author Topic: Unknown Identifier: GetTileAtPosition  (Read 3322 times)

Toomuchbob

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 1
    • View Profile
Unknown Identifier: GetTileAtPosition
« on: January 22, 2013, 02:48:45 pm »
Maybe I'm just doing this wrong, but I'm looking for a raycast to get a tile and then place a prefab at the location of that tile.
Code: [Select]
function Update()
{
if(Input.GetMouseButtonDown(0))
{
var ray : Ray = Camera.main.ScreenPointToRay(Input.mousePosition);
var hit : RaycastHit;

if(Physics.Raycast(ray, hit, 1000))
{
print(hit.point);
print(Input.mousePosition);
print(hit.transform);

if(hit.transform.tag == "TileMap")
{
print("Yes!");
Resources.Load("TileMap");
GetTileAtPosition(hit.point);

var createGrunt : GameObject = Instantiate(Resources.Load("SpriteGrunt", GameObject), hit.point, transform.rotation);
}
}
}
}

I feel like I have no clue what I'm doing.  How do I properly use GetTileAtPosition?