简体   繁体   中英

Ball sticking to sidewalls in android unity 3d?

I try to run roll a ball game Unity 3d example in android device, The ball is sticking to the sidewalls and also ball is moving very slowly when the ball is in contact with sidewalls. Help me regarding this issue?

Here is my accelerometer code for ball moving

Screen.sleepTimeout = SleepTimeout.NeverSleep;

curAc = Vector3.Lerp(curAc, Input.acceleration-zeroAc, Time.deltaTime/smooth);

GetAxisV = Mathf.Clamp(curAc.y * sensV, -1, 2);

GetAxisH = Mathf.Clamp(curAc.x * sensH, -1, 2);

Vector3 movement = new Vector3 (GetAxisH, 0.0f, GetAxisV);

rigidbody.AddForce(movement * speedAc*2f);

Thanks In Advance

I had a similar problem when building a pinball game. I was not using accelerometer, but the ball behavior was the very same.

Just check out the physic material of yout objects. Ball, walls and either floor has to be checked. As I don't know exactly what kind of game you are building, I recommend you to try out every parameter.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM