After two days spent writing this script I finally managed to make it work almost in the way I want it to work... The solution I found was to make function check for collisions(I found basic script to do that), from that script I only took general functions:
(example taken from website)
function OnCollisionEnter(theCollision : Collision)\
{
if(theCollision.gameObject.name == "Floor")
{
}
}
Which I still had to convert to C# and then change all variables to what I needed.
But this was the easiest way after couple hours reading through Unity Scripts reference for rayCasting functions(not really helpful) and then through OnCollisionEnter functions: partialy helpful-only thing I did wrong was to call these functions in wrong place...
{
}
}
Which I still had to convert to C# and then change all variables to what I needed.
But this was the easiest way after couple hours reading through Unity Scripts reference for rayCasting functions(not really helpful) and then through OnCollisionEnter functions: partialy helpful-only thing I did wrong was to call these functions in wrong place...
In the end all I needed to add was about two lines of code... Hopefully next scripts won't take me so much time-it may be a good idea to follow a tutorial for most of it :)
No comments:
Post a Comment