Lazily Languishing, and Mutilating Movement

Lazily Languishing, and Mutilating Movement

Has it been two weeks? Whoops! I may have forgotten I was meant to be working! There’s only a little to talk about this week, but talk about it we shall! Here is the low-down.

With the last fortnight being two days shorter than expected, along with some unexpectedly good weather creating a lackadaisical atmosphere, oh and the raging torrent of scatter-brained half thoughts I’ve been contesting with lately, this hasn’t been my most productive week. Sorry about that! I’m working on turning it around, I promise! I’ve made a start on an alternative player controller though. That was a bigger task than I imagined. Here’s how it worked out:

It’s not… an improvement. In fact there’s a long way to go. And part of the joy of being a game developer, particularly when using someone else’s code (in this case, Unity’s) is that is never certain whether or not it will be worth the effort, or indeed even work at all. This is just phase one of experimenting with the CharacterController, rather than simply using Rigidbodies. And we have a lot to fix.

Background for non-techies: A rigidbody is the name we give a physics object. Something that behaves as its own unique object, affected by forces. A CharacterController is a Unity specific class, designed to work with physics, but is specialized to make it behave in a way that is desirable for a player controlled character. Generally this involves removing rotational physics to some degree, and rather than applying forces directly, we pass a movement vector and let the controller handle everything else. It’s more complicated than that of course, but I don’t want to go too far down the rabbit hole!

The reason this is taking so long, even despite my lethargy, is that I wanted to lay down the groundwork. The first thing was take all the movement code and abstract it away from the main class. I’ll maybe do a deep dive on abstractions at some point, but for now take it to mean “making it so I can easily swap out how the movement code works under the hood”. Then I had to write in new code to use the new system. This is the “very in-progress” stuff right now. On top of that, to avoid causing issues in the main testing level, I had to throw together a new level to build and test the new prefab in, which is why the video looks so barren. (I cover prefabs in an ancient post here.)

The problem I’m experiencing now (ignoring the missing turning and animation) is that the controller isn’t triggering collision events. The Mjenga (the M is silent) pieces have a bit of code that makes the physics activate properly when they are hit by another object. It means we can have set-pieces that would be unstable if we trusted the physics alone. With a rigidbody, this works perfectly. But for some reason, the character controller, despite professing to work with the physics system isn’t telling the Mjenga tower about a collision. This needs to work or the new movement code simply will not be viable.

Beyond that we need to make sure dragging objects works the way we want; heavier objects need to feel harder to drag. The movement does feel snappier, but without rotation and animation I still don’t have a gauge on if this work is taking us in the right direction. Only time will tell!

I haven’t done a personal section for a while, figured I might finish up by filling you in on that. I’ve been really pushing both streaming and my physical fitness lately. The streaming is slow progress but I’m trying to up my game and get better at the skills involved. If I gain nothing else from it, I hope it’s a lesson in confidence and presenting myself online! And completing the trio of using every waking hour of my time, I’m now climbing every weekday morning (more or less) which has been great! Once I get over the initial grumpiness of forcing myself out of bed and get to the climbing centre, I’m met with a mostly empty area with friendly staff and I basically get the run of the place, it’s wonderful! Hopefully it’s also good for my health, just so long as I don’t buy too many lattes!

That’s it from me, hope you all have a wonderful fortnight, and I’ll catch you next time!

Matt out.

12 thoughts on “Lazily Languishing, and Mutilating Movement

  1. Its like you read my mind You appear to know so much about this like you wrote the book in it or something I think that you can do with a few pics to drive the message home a little bit but other than that this is fantastic blog A great read Ill certainly be back

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top