Hi,
New to unity and former flash developer, I’m getting myself started.
A simple question, I’d like to make a simple iphone app that is showing a cube and a ball inside. The ball will bounce inside my cube and the questions are:
How do I make a semi-transparent cube so I can see my ball bouncing inside? Do I make a real cube and apply some semi-tranparent material (which kind of material can I use)? when I tried that the ball is pushed outside the cube, is there a way to tell the cube is empty?
Or do I make 6 planes to shape my cube, but same, what kind of material should I use to see what is inside?
Sorry, it is very basic, but thanks in advance for your hints.
Romu
I came with something working pretty well with 6 planes. I applied a Bouncy mesh collider on each planes. The only problem I encounter is, I add some Forces to the ball to make bounce quicker (gain energy), and after a while the ball can go through a plane!
This shouldn’t be possible and it has probably something to do with framerate?
Is there something somple to do without having a check every “Time”?
Hi,
I’m new to unity (only got the trial yesterday) but is this to do with the physics being updated at a fixed frame rate, ie 60. therefore, when you object is moving at a fast speed, it may be able to pass through the plane between physics updates. Other engines i’ve used update the physics independently of the actual game frame rate.
There maybe a feature within unity to change this update speed, probably at a performance loss.
Apologies if this isn’t the reason, like i said i’m new to unity.
Matt.
Well, romu, you are right, the problem is given by the phisycs not beeing update enough times every second.
Unity by default impones a 0.02Fixed Phisycs framerate, that means that phisycs will run at 50 FPS, indipendently from Graphical FPS, but you can tweak this by going to Menu—>Edit—>Project Settings—>Time.
This will show on the inspector the Time Manager: if you modify the Fixed Timestep Phisycs will play much better BUT I wouldn’t suggest doing this, because even imposing a 0.01 timestep (100updates per second) would be really heavy for a machine, and it’s not needed unless you are working on a phisycs intensive game. Also, the iPhone would suffer from this even more, as phisycs is calculated by the CPU.
If you really need this, but only for a couple of objects, i would suggest to work on a raycasting function that checks if anything is in front…
Just my 2 cents
That’s good to know, thanks a lot.
When you say build a ray casting function, you mean build my own bounce script as I would do in Flash instead of using the built-in one (Bouncy)?