Trouble getting into physics

Hello,

i have recently bought a 3d engine, having only slightly lower price as unity, and after two weeks of work noticed, that it had features missing i absolutely need… so here i am, struggling with the unity demo :wink:

physics are the most important part for me. i like to do more the kind of sport games, so currently i am testing the demo by trying to build a airhockey game.

i do have major problems in understanding whats going on with the physics. are there any good tutorials out there covering this topic in detail? already searched, but didn’t find any.

i have tried several ways to achieve a airhockey type game.

one simply modelling everything in modo, export to fbx and use mesh colliders, this method worked best, but i ran into trouble with a) the collision detection with the table, and b) the puck collided with the table ‘under’ the collision box, so it first went completely through the table and then stopped. i have noticed, that on import you can either recalculate the normals or keep them, both looked completely different. the table might not be a 100% perfect closed body. infact it is, but they way it was modelled, i could understand, if some software has problems in trying to find out whats outside. could this be the cause of the collision trouble? although i tried a blender modelled simple version of the table, which had some new surprises for me :wink:

one other was, to simply lock y movement and use capsule colliders without gravity and without collision to the table surface. this had very odd movements, on collision, the puck started to move, but then went on very slow without stopping again. i tried changing the physics material, but didnt change anything.

on both attempts, the mallet was set up as kinematic rigid body and positioned by mouse movements. the collision with the puck was always far away from realistic. do i have to work with forces, to get the puck moving correct?

The collision detection is far from perfect especially for fast moving objects.
And you should try to avoid using mesh colliders as much as you can and use capsule colliders or box colliders in different combinations).
I would suggest using configurableJoint to limit the movement of the disc (rather than “real” collision with the table) and there is a script in the wiki that prevents objects from passing through other objects for the mallet (although it is still not 100% working for fast moving objects).
as for the slow moving object, you can either raise the sleep velocity in the physics settings , or you can check for the velocity in the Update function and stop it yourself if it is under a certain velocity.
a very common mistake could be in the scale of your scene, try to make everything much smaller, the scale plays a very big factor in how physics behave.

another thing you gotta know is that when you manipulate transforms that effects physics you need to do that inside FixedUpdate functions and not Update functions

and its always loads of trial and error.
Good luck

thanx for the reply,

what exactly is the correct scale?

i have modelled everything in modo with exact scales, but import default is a scale to 0.01, which i did not change. so if the tables length was modelled in modo with 2.5 meters, it ends up with a size of 2.5 in unity, but what is 2.5? meters? miles? inches? anyway, i’ll give the rest of your suggestions a try, thanx.

meters !

thanx, slowly i get everything up working, but i had to cheat a little in the form that actually no mesh objects at all are used as collision objects. it’s all done by using unitys predefined collision objects.

as soon as i use mesh colliders, everything acts crazy. i think that there is something wrong with the normals, although neither recalculating them or not does change anything.

can i display the normals of a object within unity, or maybe even change them?

Basically, no. (You could write a script to draw gizmo normals in the editor.)