Closed Bitheral closed 2 years ago
OKay I'll have a look into it.
Okay so the fix would be that add rigidbody to the walls and freeze their movement and rotation and all axises. I know it's not the best but it works for now.
Hi guys. Sorry for the late update just been busy like we all. As I did try a few methods which didn't bring the desired result. The parent method would work with the gravity turned off but if the player bumps into something the item will start floating away. I cannot get it to stop. There was another way where I turned the mass off but it had no affect. I think this way is getting the closes cause at least the player can push the cubes into the wall which is a great thing.
My idea would be that if the scalable objects would have a the box collider as a trigger and we could access it then with the "ontriggerenter" the player would just drop the item. I have been trying to get it to work but it's not detecting it. anyone could give it a try?
here is the solution. so I am freezing the rotation of the object but with our code the player can still rotate it. and after the player drops or throws the item it will have gravity again and the rotation will not be frozen.
I did leave the old code commented out for you guys to check and see what you think :)
Alright nice, I'll take a look at the commit, since I'm curious how some of the code works, but I suppose as long as it works, we're good!
Managed to find a video which helped fix the phasing of the grabbed object with walls https://www.youtube.com/watch?v=zgCV26yFAiU
I refactored the code so that it's much easier to read as well.
So after looking at what happens when "colliding" the cube on the demo level using the
OnCollision
methods and Debug Spheres on the contact points of the object, it seems that the problem is actually related to how the object is grabbed, due to theisKinematic
variable on the Rigidbody of the scalable object.I tried to see what would happen if were to disable the
isKinematic
variable when grabbing the object, which helps by giving us access to the collision points, however the object starts to randomly exert force when the object is grabbed.Screenshots:
isKinematic
enabled on grabisKinematic
disabled on grab