Well, this last weekend of the quarter wasn’t a total loss (except for sleep but that comes with the territory). I managed to finally put all the assets I’ve been working on into the actual game and making it look nearly identical to the mock up screens on my presentation. I say “nearly” ’cause I’m missing a few elements such as the GUI, enemy barbarians, and the player barbarian. At least the logs are there but unfortunately, I still can’t get the collider function in my code to work the way I want. Why oh why can’t programming be easy for syntax challenged designers like myself?
Monthly Archives: November 2012
Basic Scolling Complete!
My God! What a long road it took to get this basic function to work! With a little help from one of my classmates, we came up with the right code to allow my environment to scroll in the way that I want it to. Looking back on it, I can’t believe that I went through tens of lines of code just to see that it only took close to 20 lines. *sigh* My programming skills really need some brushing up, but that’s what this upcoming winter break is for! Anyways, below is the script when inserted in my gameobject “scrollTerrain”:
var topSpeed = 20.0;
var minSpeed = 1.5;
var currentSpeed : float;
var acceleration : float = 5.0;
function Start () {
currentSpeed = minSpeed;
}
function FixedUpdate (){
currentSpeed = Mathf.Clamp(Time.time, minSpeed, topSpeed);
}
function Update () {
currentSpeed += Time.deltaTime * acceleration;
transform.Translate(-currentSpeed * Time.deltaTime, 0, 0);
}
Onward to completing the rest of the game’s features now that this great hurdle is over with, and what I’ve learned from it is to never be too proud to ask for a little help. It could go a long way! As always, keep gaming.
Collision Catastrophe!
Ugh! What is the magic code for getting the collision to work correctly? All that I want to do is to have my horse, whenever making contact with a log or getting attacked by another barbarian, have it’s momentum reset. At the moment, I don’t think that function will be available for the alpha build and will require some further research during the Winter break. This game will be polished; I’m in too deep!
UV Maping Dilemma Solved!
What it is everybody? Recently I came across an issue in Maya where I needed to take a mesh that I imported that was UVed in Headus and transfer that UV over to my original, non-UVed mesh.
“But Dantrell, that’s easy! Select your UVed mesh and shift-select the original, go to Mesh>Transfer Attributes option box from the polygon menu, and transfer only the UV sets. After that’s done, delete the mesh that you imported.”
In another situation, random armchair Maya buff, you’d be right on the money. You’d just have to remember to delete the history of the original mesh before deleting the other. But here’s the thing: my original mesh contains animations on it.
“So what’s the dealie?”
Here’s the dealie! Deleting the history also deletes the animation on the mesh. The rig is still remains with the animations intact, though. Wait, before you ask…
“Just reskin the mesh with the rig!”
Dammit! Remember what happens once you skin your rig?
“It…can…animate?”
Correct! Now remember what happens once you play the animation?
“Ewwwwww! It’s all blobbity-blobbity!”
And why’s that, Mr. Armchair Maya Buff?
“Oh right. The problem is that you’d have to go through the trouble of repainting the weights again, even though they were already painted correctly before the UV transferal?”
Bingo! Here’s how you can get around that and save you lots of time.
This tip assumes that you have a scene where upon opening, all you’d need to do is transfer the UVs and your original mesh contains animations. After applying all of the steps mentioned above, save your scene and rename it something easily identifiable, then import the original scene. Now, and this is gonna blow your mind, select the imported mesh and then shift select the original. Then at the Animations menu, go to Skin>Edit Smooth Skin>Copy Skin Weights. Now just clean your scene up by deleting all of the components that you imported from your outliner and don’t forget to save. This should solve everything!
Fellow ITGM majors, as always, feel free to share this info to anyone that needs it.
Keep gaming!