-
unity billiardC#/Unity 2019. 1. 20. 20:37
designed simple billiard table objects based on real size.
At first time, I considered scale unit as meter. So the table size was 2.72*1.5 width.
First problem I had was that the ball didn't bounce off from the wall of the table and stuck.
As a solution I tried to applying physics material as well as OnCollisionEnter with following codes in order to enforce
the ball to bounce off.
void Bump(Collision bump)
{
Vector3 direction = transform.position - bump.gameObject.transform.position;
direction = direction.normalized * 1000000;
bump.gameObject.GetComponent<Rigidbody>().AddForce(direction);}
But both didn't work. The problem was the scale. Too small scale made absolute speed too slow that ball get stuck
to wall.
So I multiplied 100 times bigger scale and now struggling with friction of both ball and table.
balls' get slow too rapidly or proceeds eternally which makes difference with reality.
'C# > Unity' 카테고리의 다른 글
20FEB19 NavMeshAgent (0) 2019.02.20 19FEB19 길찾기-A* algorithm (0) 2019.02.19 13FEB19 terrain (0) 2019.02.13 06FEB19_GameObject.Find() (0) 2019.02.07 particle system (0) 2019.02.05