In my 3D world, I have a bunch of cubes, and I want a sphere to move around this world.
Basically what I want to know is how to make the sphere turn right or left randomly.
This is what i've got:
This has the sphere always moving forward, and when it runs into a wall, it keeps turning left until it's not touching the wall anymore. But this code will make him go in 'circles' because it is only turning left, and I want to make it randomly choose to go left or right when it hits the wall. I've tried randomly choosing a number from 1 to 2, but because it is held against a wall, it chooses a number too many times and causes it to just 'jitter' in one place.
Can someone help me out?
-Thanks
Basically what I want to know is how to make the sphere turn right or left randomly.
This is what i've got:
MoveEntity player,0,0,0.1 If EntityCollided(player,walltype) Then TurnEntity player,0,3,0 EndIf
This has the sphere always moving forward, and when it runs into a wall, it keeps turning left until it's not touching the wall anymore. But this code will make him go in 'circles' because it is only turning left, and I want to make it randomly choose to go left or right when it hits the wall. I've tried randomly choosing a number from 1 to 2, but because it is held against a wall, it chooses a number too many times and causes it to just 'jitter' in one place.
Can someone help me out?
-Thanks