Hi all,
I’m having a problem with a simple collision / gravity setup.
I have a sphere with a rigid body component so are using Unity Physics. Collision Detection is set to Continuous Dynamic and set to use gravity.
I have made a basic enclosed area with cubes (like a simple maze, and sat the sphere inside). Each wall is a child of an empty game object simply called Maze (so I can reference them collectively). There is a box collider set on each of the walls.
I have written a script which simply rotates the maze using the left and right arrow keys (this seems to work, see below).
//rotates the object
var speed = 50.0;
function FixedUpdate () {
var z = Input.GetAxis("Horizontal") * Time.deltaTime * speed;
transform.Rotate(0, 0, z);
}
This script is attached to the Maze object.
When I hit play, the sphere drops appropriately and lands on the bottom wall (sphere has a z constraint so it doesn’t roll off the side) . Then when I hit the left and right keys the maze is rotated correctly.
The problem I’m having is that the ball sometimes rolls along the rotated wall as it is supposed to, and other times it doesn’t. Sometimes, after the sphere has initially hit and stopped, the maze can be rotated straight through the sphere. It seems to take a few seconds and then the sphere operates under gravity again, and falls as it should.
The things I have tried is increasing the mass of the sphere, changing the script from Update to FixedUpdate, changing the box colliders to mesh colliders, and changing the collision from Continuous Dynamic to Dynamic.
In the stats this scene is running at between 60 and 70 fps so doesn’t seem to be a performance issue. I’m obviously doing something wrong. Any suggestions would be appreciated.
Best Regards
Chris
hm well makes kind of sense as the path from where the error originates is just said package... I found one source which claims that deleting the package folder can solve the issue. I guess you can still reinstall the package if you should indeed need it. Another thing you can try is to follow [this description here][1]. This should add nunit as a package in your project using nuget. [1]: https://www.lambdatest.com/blog/setup-nunit-environment-with-visual-studio/
– Captain_Pineapple