Hi,
I finally got the cube moving within a confined area but after colliding with two walls in quick sucession it breaks through - as seen here at 21- seconds : http://screencast.com/t/NjczNzYxMWQt
I was told the best way to avoid this would be to start again and use physics but the problem is im not too sure where to start and I dont want to recreate that mistake.?
The code currently used is:
var speed : int = 20;
function Awake()
{
//print ("no collision as of yet");
}
function Update ()
{
transform.position += transform.forward * Time.deltaTime * speed;
}
function OnTriggerEnter (hit : Collider)
{
var rot = Quaternion.FromToRotation(Vector3.forward, hit.transform.up);
transform.rotation = rot;
transform.rotation.eulerAngles += Vector3(0, Random.Range(-90,90), 0);
}
It only seems to work with planes as the walls , if I try cubes or box collides the cube object seems to fly up instead of doing any bouncing? Thanks