Unity C# – Torque Look Rotation in 2D

Getting one object to look at another object in Unity can be a very math intensive project.  In 3D there is an easy way to do this by use the transform to look at another object with a simple call:

Quaternion.LookRotation(target.position - transform.position)

In 2D Unity doesn’t hold your hand and you have to figure it out yourself. Most look rotation guides for Unity focus on simply modifying the transform even when talking about moving a Ridgedbody with physics.

If you want to use physics on Ridgedbody to add torque to turn toward another object then the unifycommunity wiki has a guide for 3D. With slight modifications we can get this same code working for Ridgedbody2D:

reasonably-sound

Awhile ago I was listening to a podcast about video games. They focus mostly on console games but for whatever reason they were talking about PC games which is where most of my interest lie and they just said obviously wrong thing after obviously wrong thing. And it made me so angry. So angry that I actually just stopped listening to all of the small handful of podcasts I was subscribed to.

Slowly I am bringing them back. First to catch up with Welcome to Nightvale and then Serial which has swept the internet almost as quickly as Nightvale did. But also Reasonably Sound a great podcast about an area I know very little about.

For me the greatest problem is just that podcasts are something I tend to do on my commute and which is also where I do most of my reading and so they tend to take me from reading. I’m already not reading as much as I should as I let Game of Thrones slow me down to a halt.

Comments here

I had this idea several years ago that I should repost comments I make around the internet here. I think Kottke had started doing it though he mostly stopped. I never did it more then once but I certainly regret not doing it more. I would have liked to have had that history here.

Sites like Medium are all the rage now and I have not had much interest in posting there. For me when content feels more ephemeral I’m more willing to give it away and Medium feels just like blogging but without the content ownership.

Facebook, Twitter or Tumblr is where the conversation is happening and it feels like a conversation. Mostly short responses that are apart of a larger context. Posting them here wouldn’t even make sense out of context and posting them here removes them from the conversation which is the only reason to post them in the first place.

Some parts of the internet, I think, are starting to encourage longer responses though. Idea Channel, like I just posted below, has build an amazing community partly due to youtube’s longer comment length but also due to so many being called out in the last few minutes of the show.

When I look back on my childhood I can barely remember what I did or liked or watched and I kind of hate that. This site should be that log of what I did and liked. Lets see if I can once again start posting stuff here that is less for others and more for future me. Because I want future me to remember this stuff better then I am usually able to.