Hello Guest

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Toomuchbob

Pages: [1]
1
Support / 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?

Pages: [1]