alright im having some trouble on how to interact using the e key with a raycast anyone help me get started on hte raycast and input? i can do the functions no problem.
Like I said in the comments, this is a very vague question. Without context, it’s hard to give an accurate answer. For starters, are you raycasting from the mouse position, or from a gameObject in the scene? Here is a generic answer using the Camera.main.ScreenPointToRay method :
#pragma strict
function Update()
{
// -- Check if the E key has been pressed down on this frame --
if ( Input.GetKeyDown( KeyCode.E ) )
{
// -- Key has been pressed, now Raycast --
// variables used in raycast
var mouseRay = Camera.main.ScreenPointToRay( Input.mousePosition );
var rayHit : RaycastHit;
// raycast command
if ( Physics.Raycast( mouseRay, rayHit, 1000 ) )
{
Debug.Log( rayHit.collider.gameObject.name );
}
}
}