• entries
12
27
• views
12085

# Decaffeinated Passion

1426 views

Coffee is my fuel. I drink straight espresso, a lot of it, about 12-16 shots a day, if not more. This morning I realised that I had run out of caffeinated beans. Rather than get some from WinCo, I decided to drink the decaf and tough it out until I had a chance to make a store run. I understand how dependent I am now. I spent a good hour trying to save a few variables with little success. Simple little things would trip me up, or I would blank out in the middle of typing a line. It was a nightmare. I kept at it anyway, plugging along until a midday appointment, which turned into a mission to get my sister's license reinstated. After her recent wreck, the police informed her that her license had been suspended due to a mailing mix-up, and she would have to pay a good deal of fines to reinstate it. Anyway, long story short, thanks to a makeup shipment she got her license back. (Don't ask).

This really has nothing to do with the game, I just thought I'd tell you all how my day went.

The sheep have new models, but I'm not quite happy with them. Perhaps I need to animate them to get a feel for the way they look in motion. Here's a pic:

[sharedmedia=gallery:images:7805]

Speaking of animation, I've been avoiding it for some time. The entire reason I make space games is that they require very little animation, at first, anyway. But now that I'm making something with character models and animals, I really need to learn. It's not that I think it's going to be hard, though I know it will be; it's that once I become entrenched in rigging, animating, and blending, I won't get out until I have a good grasp of it, which could take a while.

In the less interesting news, I made all of the sheep rigidbodies kinematic. I don't know if that's a universal term, but in Unity it means that you can manipulate the rigidbody in every way except for force and torque, but it is not affected by gravity or external forces. The reason it's different from a Unity Transform is that it can detect collisions, due to the fact that it's still a rigidbody. I had been putting the change off for a while, since I knew I would have to rework the uber-simple movement system, but it was much easier than I expected. I simply had to change this:rb.AddForce(transform.forward * moveSpeed);
to this: RaycastHit hit; if (Physics.Raycast(transform.position, transform.up * -1, out hit, 999999)) { if (hit.transform.gameObject.tag == "Terrain") { rb.position = hit.point + transform.up * distanceFromGround; } } rb.position = Vector3.Lerp(rb.position, rb.position + transform.forward * moveSpeed, 0.1f);
Since this is Unity C#, the programmers among you, and probably everyone else too, can see what I'm doing. Essentially, the sheep shoots a ray straight down, and if the ray collides with the terrain, the sheep's position is set to exactly the position of the point where the ray hits the terrain, plus distanceFromGround on the vertical. The last line simply moves the sheep forward at a rate of moveSpeed lerped by 0.1f.

That's all for now, so have a nice day!

Caffein is the life blood of development!

Indeed. As a self-taught Unity user, I learn some things late. You'll be glad to know that Rigidbody movement is powered by Rigidbody.MovePosition now. :)

## Create an account

Register a new account

×

## Important Information

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!