Just updated to Unity 5 last night, tried importing the Unity 4 project I was working on (the space shooter tutorial…I am still a beginner,) fixed a few small errors right away, but when I run the game I get this error in the console:
I can play the game just fine until the Asteroid object passes right through the ship harmlessly. The player ship can still destroy the asteroids (maybe because I used a capsule collider for the asteroid and the laser bolt, not a mesh collider,) but the game is still broken.
The player’s control code usesGetComponent<Rigidbody>to access the player’s Vector3 and rotation values. Is that what is causing my problem? If so, then what should I replace it with now that I am using Unity 5? If not, then what kind of collider should I replace my “non-convex MeshCollider” and/or “non-kinematic RigidBody” with inside the Inspector?
Convex was already turned off, tried the opposite and turned it on. Guess that did the trick…well, sort of. Console error is now gone, and now in play mode my ship does collide with the asteroids…but instead of being destroyed the asteroids bounce off the ship instead! Can also push them around the screen, which is funny, but so not what I want.
Another problem is collisions with an asteroid alter the tilt of the player ship a little bit for the remainder of the game and send it drifting very slowly in a direction (seems to vary with each collision.) No matter how much I move around, the ship resumed moving very, very slowly in that same direction as soon as I release the controls.
Edit:
Actually, there seemed to have been some snafu with the convex toggle where it said it was already off but it was actually on, and switching it on actually switched it off, solving that problem.
The drifting seemed to be due to “Is Trigger” being switched off for whatever reason…now my game runs just the way it did where I last left off in Unity 4.
But I want a more-experienced person’s opinion: was that the proper and best way to fix the problem?
In Rigidbody
Set the Mass to 1
Drag to 0
Angular Drag to 0 Check the option Use Gravity Uncheck Is Kinematic
In the interpole place Extrapolate
And in Collision Detection selects Discrete
I managed with these settings.
I still get the error when my Rigidbody is kinematic.
I need my rigidbody to use no gravity and to be kinematic (XRGrabInteractable depends on it)&
do not want the mesh collider to be convex because it would then collide with other objects.
Can anyone help please? Thank you!!
Solution:
Change XRGrabInteractable.movementType to Kinematic. [reference] Set Movement Type to Kinematic to move the Interactable object by moving the kinematic Rigidbody towards the target position and orientation. Use this if you want to keep the visual representation synchronized to match its Physics state, and if you want to allow the object to be able to move through other Colliders without a Rigidbody as it follows the Interactor.