High Speed Collision
I try to build a game with high speed collision.
At first, I built a simple ground with no friction (ice type) with a flatten cube (ice type) and a another cube for hitting the flatten cube.
Each time I try to collide the reaction is not natural, I set different parameters but the result is at low speed is acceptable (well the hitter cube become a bit mad...), at average speed not consistent, and high speed there is just a little reaction of the flatten cube and the hitter cube goes in a crazy behaviour.
The setup is classical i think, for the flatten cube, mass 1kg, gravity on, collision detection continuous dynamic, the same for the hitter cube.
I started to build a script but I'm a very beginner and I'm just bamboozled ...
using UnityEngine;
public class CollisionController : MonoBehaviour {
// Use this for initialization
public void OnCollisionEnter(Collision col)
{
// "Puck" est un palet heurté par la crosse "Stick_Simple"
if (col.gameObject.name == "Puck")
{
Transform puck.transform();
}
}
// Update is called once per frame
void Update () {
}
}
I followed some videos but still I don't find the adequate solution. What should I do?
Thanks very much for your help and tips
Is this actually compiling (not causing an error reported in the editor console view?)
Transform puck.transform();
Setting that aside, the interaction you're describing sounds like simple physics stuff, but I can't see anything from here about the objects involved.
If the entire engine is at default settings, and you've obviously taken care about continuous collision detection (that's good), we'll need to consider what the reaction looks like (I'm not sure I picture that).
If a slow speed interaction is good but high speed isn't, you may need to consider changing some of the parameters in project settings for bounce, or the fixed timestep, but be conservative and careful here (remember what your previous working settings were).
In my own struggle with this kind of thing (bouncing of a 3 in version of a ping-pong ball), I had to resort to attenuating material bounce and drag, or adding 'reverse' forces under specific circumstances to get things right.
Under the hood, keep in $$anonymous$$d, the physics engine is typically using floats which have limitations on precision, so some of the intermediate calculations are become too small or too large for floats to work in real-time physics, so extreme scales are often fudged in games.
@JVene The script doesn't work at all, it is just a try and I deactivated in the scene.
It is a game of hockey so it might be a bit like ping pong how the high speed collision works. At the moment I'm working on drag, I had a better result but actually it crashes unity and I have to rebuild the colliders ... (why there is no incremental save?)
What do you mean by "or adding 'reverse' forces under specific circumstances to get things right." ?
Thank you very much for help
Your answer
![](https://koobas.hobune.stream/wayback/20220612171208im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Collision Detection Not Working (Unity 5.2.3) 5 Answers
Check if collision between the model and two different objects is happening at the same time 0 Answers
New Hierarchy Son Script 0 Answers
OnTriggerEnter getting called more than once 0 Answers
I need the functionality of both OnTriggerEnter and OnCollisionEnter in unity 1 Answer