Hello,
I have a rocket launcher in my scene, and what I want is when the player gets close to it, he can press a button (like ‘E’) to use it.
And when He presses the button, a scope appears.
What exactly should I write in my script?
Thanks.
Hello,
I have a rocket launcher in my scene, and what I want is when the player gets close to it, he can press a button (like ‘E’) to use it.
And when He presses the button, a scope appears.
What exactly should I write in my script?
Thanks.
Any help please? :S
I already made the script for displaying “Press E to Use” :
var distance:float;
var Gui : GameObject;
var Player : Transform;
var DetectDistance = 15.0;
function Update ()
{
distance = Vector3.Distance(Player.position, transform.position);
if(distance < DetectDistance)
{
Show ();
}
if(distance > DetectDistance)
{
Hide ();
}
}
function Show ()
{
Gui.active = true;
}
function Hide ()
{
Gui.active = false;
}
So, what is left is a script to show a scope(like Counter strike one) when E is pressed.
What should I write?
Please Help! ![]()
Have you checked unity answers? They have some pretty good answers and scripts and tutorials.