Game
Coco Blast
12 years ago

Physics : Frozen Rigidbody in Unity3D (Fix)


Damn you Unity Physics
While trying to wrap up a few bug fixes with Coco Blast, one in particular was driving a spike into my brain.
For those of you who work with Unity3D, you probably notice that the integrated physics system is buggy. Let’s face it, most of the time nothing works like it should. This is why I’m ranting at the moment; hopefully I can save others the grief.

The Problem
My problem in this case was the fact that every once in a great while a spawning Ice Block Formation with physics enabled would simply freeze in mid-air. No physics, no gravity, no response (hello is anyone home? … NOPE).

The FIX
After many hours of trying to figure out if something was wrong with my code (maybe gravity was getting turned off or the rigidbody was being removed), we determined that it was simply an error in the physics engine. Save yourself some time and add this one line of code to your Start() method…

C#

		
			<pre class="snippet-code">
void Start()
{
     // This forces a small impulse on the attached rigidbody to wake it up!
     rigidbody.AddForce(Vector3.down*0.2, ForceMode.Impulse);
}
		
	

After apply this to the problem child, everything was fixed. Well then, take that…



0 comments

Loading...

Next up

Just as Pecaminosa's musicians #improvise this rendition of #LittleSunflower 🌻, so do we improvise with this post you're reading. 😂

What's coming out of your own improvs? 🤔

#Pecaminosa | #IndieDev | #OST | #Jazz

Successful landing

#screenshotsaturday

Shadow The Hedgehog X pixel art

not the greatest house, but it's a house! :D

OK, this starts to be too tricky puzzle already :D

#platformer #indiegame #puzzle

Colorful Fox

Happy Late Easter!

Hi all, Quick update with a bunch of fixes and changes.

Updated save system, optimisation and screen tear fixes, a new shoutout room and more sounds.

Don't forget to follow the kickstarter going live on the 20th! https://www.kickstarter.com/projects/9fingergames/zapling-bygone

Enjoy!

Sonic and Shadow as Pokémons. #Fakemon

Hello my space friends! Now I added a space background to the ship. I love that space look but I still feel like stuff is missing. The lighting on the ship needs some improvements I think. Please tell me your opinion!

Pigs can push buttons for you!

#gamedev #pixelart #screenshotsaturday

Don't forget to wishlist Toodee and Topdee on Steam!

https://store.steampowered.com/app/1303950/Toodee_and_Topdee/