Saturday, September 24, 2011

3D Plastic & Tin Wind Up Robot Model

Another 3D model reproduction of a vintage wind up plastic and tin lithograph robot. The robot is the hopping action sort I do believe just based on how his feet are joined together as a one legged affair made to look like he has two legs but in reality only has one. I've made him with a high degree of detail including the molding seems where his two body halves are joined together. He is an un-rigged model but can be easily rigged for animation purposes very effectively. He has arms that can be made to move, feet / foot. A spring antenna on top of his head and a wind up key at his back.

Model is available on my Turbosquid.

Thursday, August 25, 2011

Another Year Older

Well the O'l Odometer officially ticks over another year for me with today being my 48th birthday. No big plans for today, I'm just going to take it easy even though I did go out for my run to the Fork market and back this morning. I was going to take a walk to Giant Tiger and pick up my free gift today which is either an Apple pie, chocolate covered almonds or a can of coffee... I'm leaning more towards the coffee although those chocolate covered almonds are looking mighty tempting lol ;) But I figure perhaps I'll do that tomorrow instead. I was even considering going out for a bike ride today as well considering how nice it is out, but I think I'll save that for the weekend perhaps if it's nice by then too.

Over the past few years I've tried some new things, some have worked out OK, others not as well as I would have hoped. But lately I've been feeling like my life needs a dramatic change, something different, although I do not know what that is, but I feel a need for a change.

Saturday, May 21, 2011

New Gothic Zentai Art

I have a large new selection of gothic Black Snakeman Zentai art available on many fine products.

Products with this design are available from:


Cafe Press:
http://www.cafepress.com/mdk11

Zazzle:
http://www.zazzle.com/mdkgraphics*

Red Bubble
http://www.redbubble.com/people/mdkgraphics

Saturday, April 30, 2011

NEW BLOGS

As many of you may have noticed that my Unity 3D Video game development project has kind of taken over this blog. And it's such a HUGE project with many, many things going on that encompass so much from Photoshop graphics creation, 3D modeling, Animation, and the Unity 3D game engine itself. I felt it was time to give it it's very own blog as many who originally follow this blog may NOT be interested in my video game project. And although I originally set this blog up as sort of a basic "Just to let people know what I was up to" sort of blog, the video game project has kind of taken over. So what I have done is set up two new additional blogs. One for my Online Shops called MDK Graphics: Here. And another one dedicated entirely to my Unity 3D Video Game Project titled "Rednecks and Alien Zombies": Here. That way I figure people can follow more easily what they are interested in and not get lost in the clutter of stuff they may NOT be interested in.

Thursday, April 28, 2011

Alien Zombies walk Through Walls

A new problem I've been having is trying desperately to come up with an "Object Avoidance" system that is simple and hopefully not expensive. I added this bit of code into my "Alien Zombie's" AI script:







function Update (){



//The direction vector to our target
var dir = (target.position - transform.position).normalized;
var hit : RaycastHit;
// Check for forward raycast
if(Physics.Raycast(transform.position, transform.forward, hit, 20)){
if(hit.transform != transform){
Debug.DrawLine(transform.position, hit.point, Color.red);
dir += hit.normal * 50;
}


}


var leftR = transform.position;
var rightR = transform.position;


leftR
rightR.x += 2;




if(Physics.Raycast(leftR, transform.forward, hit, 20)){
if(hit.transform != transform){
Debug.DrawLine(leftR, hit.point, Color.red);
dir += hit.normal * 50;
}
}
if(Physics.Raycast(rightR, transform.forward, hit, 20)){
if(hit.transform != transform){
Debug.DrawLine(rightR, hit.point, Color.red);
dir += hit.normal * 50;
}
}


var rot = Quaternion.LookRotation(dir);


var sizeOfMonster = 2.5;
var groundOffset = Vector3(0,2.2,0);
var newPosition = transform.position + transform.forward * 1 * Time.deltaTime;
if (!Physics.CheckSphere(newPosition+groundOffset, sizeOfMonster)){
transform.position = newPosition;
}


transform.rotation = Quaternion.Slerp(transform.rotation, rot, Time.deltaTime);
transform.position += transform.forward * 1 * Time.deltaTime;


}


function OnDrawGizmosSelected () {
Gizmos.color = Color.red;
var sizeOfMonster = 2.5;
var groundOffset = Vector3(0,2.2,0);
Gizmos.DrawWireSphere (transform.position+groundOffset, sizeOfMonster);
}
 
With some help from Unity Answers. But they still just pass right through the walls of my buildings and even sometimes through the terrain and then just fall into oblivion, which I'll bet is a real garbage collector and drag on the games performance after a while. These frustrating problems are causing me so much grief and costing me so much valuable time that I could be spending on the games actual creative look and feel. But I just want to get this and other issues worked out so I have some sort of template to base future (If Any) games on as this very frustrating learning curve continues.

Saturday, April 23, 2011

The Old Dynamite Shack

Finally done Farmer Bob's Old Dynamite Shack located right by the Old Windmill. It too me a little longer than I had expected to make this model, I guess it was all the odd bits of junk inside of the shack that took the time. It's got a shelf with old paint cans, boxes, spray paint cans, turpentine cans and empty wire spools. Some bits of old wood on the floor and leaning up against the wall, Old wooden cable carts, empty apple boxes, boxes of old dynamite, rusty old buckets... basically anything I could think of to toss in there but yet trying to keep the poly count down so as to not bog down my games performance too much. Unity 3D seems to handle it quite nicely so I'm very pleased with that. As you can see here (left) this is Bob's Old Dynamite Shack as seen in the game play mode.

For some reason when I imported my model into Unity 3D the door was out of position so I had to move it back to where it was supposed to be, fortunately only along the one axis so it was a very easy adjustment. My animations from Max 8 were unaffected thankfully. The REALLY cool part was that when I imported the model into Unity 3D the textures were all applied and all I had to do was apply the bump maps, so that saved a lot of time ;)

Now I need to make the Dynamite and Detonator, place that inside of the shack where my notation mentions so that Bob will be able to pick up those items in order to blast the rocks clear from the path.












Here is a sample render of Farmer Bob's Old Dynamite Shack done in Max 8 with the roof hidden so you can see a general layout of the shack's interior and all the odd bits of junk lying about the place.

Sunday, April 17, 2011

Level One Layout Bob's Homestead

After a lot of tweaking and playing around I am fairly close to completing level one of my Unity FPS game. "Rednecks and Alien Zombies". As you can see the level is much more manageable than how I had it before which was to try and place everything onto one giant terrain. Which I quickly discovered was just not going to work. So now I have been working on setting up level one which is where "Farmer Bob" starts his adventure. There are a few things Bob needs to figure out in this level. Nothing too complicated. There is a locked gate that Bob needs to take the key hanging on his wall in order to unlock and then open the gate to gain access to the old farm area.

Getting into the old farm area is not enough though, Bob has to find and kill all of the "Alien Zombies" lurking about his property. Also in order to get the first of four "Alien Artifacts" Bob will need to walk towards the UFO hovering just inside on the Ancient stone circle close to Bob's house. This will cause the UFO to take off and in mid flight will explode and then crash over on the "Old Farm Area", but ONLY if Bob walks towards the UFO and causes it to take off otherwise he will NOT get the first "Alien Artifact". Also Bob will need to visit the Old Dynamite Shack located close to the old Windmill in order to get some Explosives to blast the rocks blocking the exit from this level to the next game level.

The Dynamite shack I'm still in the process of construction right now so it's not seen on my Screen capture of my game level just yet, just the Old Windmill is visible. 

Saturday, April 16, 2011

The Old Windmill is Back

The Old Farm Windmill is back. This time I decided to place it over on Bob's Homestead just on the other side of the Ancient Stone Circle from which the UFO takes off from. You can't see it here to fully appreciate it but the windmill blades rotate slowly and make a nice quiet old creaky windmill sound.

The idea is have my player explore more and find things they need. Now I haven't even begun to make it yet. But over close to the old windmill there will be Farmer Bob's old dynamite shack that's used for storage. You see when the UFO takes off from the Ancient Stone Circle and then crashes over by the old farm area the impact causes a rock slide that blocks off the path that exits this game level. So Bob will need to get some Dynamite to blast the fallen rocks clear.

I guess that's going to be my weekend project is to start work on the Dynamite shack. There might even be "Alien Zombies" lurking about inside of the old dilapidated Dynamite Shack ;)

Dynamite is of course the Farmers old helper, it removes stumps. rocks, and drastically reduces the flight capability of Alien Spacecraft :lol:

Thursday, April 14, 2011

Farmer Bob's Old Farm Gate Action



Farmer Bob has a new obstaclele to overcome, a very simple one. it's a locked gate that separates Bob's homestead from the old farm area which has the old Barn, abandoned farm house, the old Chicken Coop and disused Silo. Bob will actually need to pick up the key that hanging on his wall in order to get the gate unlocked and then open. Simple I say because I can't really imagine anyone leaving the house, which is the starting point of the game, without taking the key. most people I know explore an area pretty thoroughly before leaving it. At least I always do whenever I'm playing a game. So to miss the key one would have to be pretty blind not to see it hanging there. It is almost because of this very reason that I have thought about perhaps putting the key in the wood shed out back of Farmer Bob's house just so it forces the player to explore a little more. but it to me didn't make much sense to have a key out doors like that??

It took me the better part of almost two day to figure out how to code this to get it to work with a key though. As it's NOT like any of my other door that simply open when the raycast from my FPS player intersects with the door, the door opens. The gate's coding was a little different in that I had to make it recognise that I had actually picked up the key. Took a bit of getting the scripts to send messages to one another, a whole process I'm still a little fuzzy on how it all works. But we eventually got it to work.

The gate model itself didn't really take too long to make, what did take a while was working out the unlocking and gate opening mechanics. The gate has a sort of "Swing Arm" type of locking bracket that closes over the end gate pole and then locks with an old rusty padlock at the ends of the "U" shaped "Swing Arm." I had to make an animation for that part to unlock the padlock, swing the "Swing Arm" down to unlock the gate. You can see the whole thing in action in the video clip from my YouTube. Once you have the key, you approach the gate, press the "Q" key on the keyboard which unlocks the gate, press it again and the gate swings open. A real pain to figure out but at least now I have a working model of this game action so I can use it again if I ever need to in the future.

Monday, April 11, 2011

Alien Zombie Attack 01 Postcard from Zazzle.com

Alien Zombie Attack 01 Postcard from Zazzle.com

Farmer Bob's Creepy Old Wood Shed

I kept thinking that Farmer Bob's homestead was missing something, although truth be told I still think there are some things that need to be added. But I did over the weekend manage to make an old wood shed for just out back of Farmer Bob's house located fairly close to the old abandoned out house.

As you can see here from my "In Game" screen captures it adds a nice bit of eerie scenic detail. You can also see that I have given Farmer Bob a flashlight too which is perfect for poking about inside of those dark confined and creepy interiors.

 I figure it's another ideal place for Alien Zombies to be lurking about and hiding on Farmer Bob's property. I have not yet placed one of the Alien Zombies inside of the old wood shed yet. I've been trying to think of something interesting or different that an Alien Zombie could or would be doing in there, perhaps just hiding behind the door as it opens inwards so behind the door would be kind of a perfect spot for a surprise Alien Zombie attack. In any event I'm trying to come up with something different or unusual for this location. I am also still trying to work out if I can start my Alien Zombie animations off from something other than their default "T-Pose" as right now in confined spaces the "T-Pose" intersects with the geometry of some of the small confined spaces like the Chicken Coop and the Out house especially. So I'm sure that will muck up the game when it starts as they will most likely end up stuck inside of the walls of such confined structures. At least this IS want happens to my Chicken Coop Alien Zombie when I shoot him. Because his "Dead replacement rag Doll", which starts of in the "T-Pose", he ends up stuck through the roof of the Chicken Coop when he dies instead of dropping to the floor. I've been asking around on Unity Answers to see if anyone knows if "Rag Dolls" can be given different poses as this would solve the problem of that happening I am sure.

As you can see from my Max 8 renders that I have tried to give the Old Wood Shed a fair amount of rustic typical "Red Neck" style and detail. There are wood planks, an old barrel, a broken pallet, an old wood saw, chopped fire wood inside, some loose boards with nails sticking out here and there and nice grungy wood textures to help give it that old well used and broken down sort of look.

As usual I have made my model available on my Turbosquid.

Wednesday, April 6, 2011

Alien Zombie Chicken Coop Chowdown

Alien Zombie Chicken Chowdown

Alien Zombie Chicken Chowdown

It's gonna be a hot time in the O'l chicken coop tonight with poor ol Farmer Bob's gruesome discovery of an Alien Zombie raiding his old chicken coop.

I'm just working on the animations for the Chicken Coop Alien Zombie. I've never tried to animate two bipeds before so it should prove to be an interesting challenge. So far it seems to be going OK, just more parts to animate and try and keep track of. After I do this animation I have to create an "Aware" animation for when Farmer Bob discovers him and he is within a certain range he will react to Farmer Bob's presence. I also will need to do a special attack animation for this guy where he maybe drops the dead chicken and goes after Farmer Bob, and I'll also no doubt need to make a new "dead replacement" rag doll too for when he gets shot by Farmer Bob. lots to do so little time.

Monday, April 4, 2011

Chicken Animation Test



just an Idle animation test for one of the chickens that will occupy Farmer Bob's Chicken Coop in the FPS game I've been working on called "Alien Zombies".



I've got some envelopes to tweak I see but it's getting there. This is the first time I've used a Biped in quite this way so it's a little different from what I'm use to.

Sunday, April 3, 2011

Adding Extra Details

I've added some clusters of Fire Flies to my game environment just to give it some extra life and make it more realistic. I figured what better for a night time scenario than to have some lightning bugs flying around here and there. In my particle emitter I used a picture of a real Fire Fly tweaked a bit in photoshop and given some extra glow in the tail section. Exported that as a PNG transparency for the particle emitter. I made scattered about 3 or 4 clusters around the trees here and there. They fly around randomly popping in and out so hopefully they act like real fireflies. They look good in my scene so I'm pretty happy with the way they turned out.






 Farmer Bob's Chicken Coop
First there was Alien Zombies in the outhouse and now there will soon be Alien Zombies in the old Chicken Coop. I'm almost completed the Chicken Coop, I just need to add a few details and then do the animation for the open and close door function so that way when Farmer Bob gets close to the door it will open just like his house and outhouse door functions.




Of course the Chicken Coop is going to need some chickens. I was originally just going to have it so there was an Alien Zombie stuck in the Chicken Coop just like the Outhouse scenario but the more I thought about it the more I thought it would be nice to have the Chicken Coop scenario work a little differently. It's going to mean more work to create a new animation for my Alien Zombie where he is inside of the Chicken Coop munching on a Chicken when Farmer Bob discovers that gruesome sight. I have to texture map the Chicken Coop floor so it looks like feathers and Chicken Blood everywhere and make a dead Chicken for the Alien Zombie to have in his hands. This is going to mean setting up a new "Dead Replacement" Rag Doll with the Chicken roughly placed into the Alien Zombies hand so that way when Farmer Bob shoots him he'll drop the Chicken as he slumps down dead like a sack of potatoes. lol

Also additionally I've placed "Meadow Muffins" here and there around the terrain so that way if Farmer Bob accidentally steps in one, he'll curse; "Dag Gumit!"

Thursday, March 31, 2011

Alien Zombie Attack And Kill


Finally after 2 months of pure frustration I have managed to get my Alien Zombie to attack and inflict damage on my FPS player. It took a lot of time but Finally I got help on Unity Answers.com "Statement" solved my biggest problem. There is some fine tuning to do like add Alien Zombie attack sounds for when he attacks and then polish up their animations a bit more. but it's FINALLY getting somewhere.



Y'know what the most aggravating part about all of this has been,? It's that in my code it was only a few short lines needed to be added and one line needed to be tweaked.



Wednesday, March 30, 2011

Alien Artifacts Full Screen Inventory GUI Part 3

So far I've created my first "Alien Artifact" and it's PNG icon that is supposed to show up in the position you see on the left (lower window). Right now there is no working code supporting any of this until I can get something that works. I have a code in progress but it is very much incomplete at the moment as I don't know that much about the code to finish it off and get this part of my game working. Right now I just have these two element set up a GUI textures that I have tweaked into position using the values in the inspector window of unity 3D. It's my hope that the code will place my "Alien Artifact" icons just like I have started to do here.

Here is the code I have as a work in progress at the moment:

var i = 0;

var alienArtifacts = 0;


onGui();
{
if(i == 1)
//put the code that makes the item holder here
//you might want to add code for which ones you have got


}


update()
{
if (/one of the artifacts was picked up/)
{
alienArtifact ==1; //other stuff like what artifact was picked up
}
}


function Update () {
transform.position.x = 0;
transform.position.y = 0;


guiTexture.pixelInset.x = 0;
guiTexture.pixelInset.x = 0;




guiTexture.pixelInset.width = Screen.width;
guiTexture.pixelInset.height = Screen.height;
}
 
As you can see it's very much not finished and needs a lot of work. Man I could really use a code person on this project. I also need this code to disable that weapon, health & ammo stats GUI you see in the lover left hand corner also, so that way when the player presses "I" the "Alien Artifacts" GUI pops up and nothing else is visible until ["I"] or ["Esc"] perhaps to exit from the inventory screen.

Tuesday, March 29, 2011

Alien Artifacts Full Screen Inventory GUI Part 2

OK I created the first of my 4 "Alien Artifacts" that "Farmer Bob" will need to collect throughout the game. I knew this part of my game was destined to be a real pain in the ass but I had no idea the pain I'm getting into with his. First off I thought; "Oh sure this should just be a simple matter of creating my Alien Artifact, plopping on the sound for it to emit, then plop on the "PickUp" java script, lob all that into a prefab and then make a new UFO Animation event that will Instantiate my new prefab close to where my UFO crashes." and is it that simple? Frak No! First off the way I thought to code it was wrong so I popped on over to Unity Answers to get hopefully a lead in the right direction. Some of kind folk there helped me out by providing this script to add into my UFOanimationEvents.js:
var explosion : GameObject;
var wreck : GameObject;
//var artifactTarget : Transform;
var alienArtifact : GameObject;
function ExplodeUFO()
{
        Instantiate(explosion, transform.position, transform.rotation);
}
function KillSelf () {
        yield WaitForSeconds(3);
        var wreckClone = Instantiate(wreck, transform.position, transform.rotation);
        Destroy(gameObject);
}
function dropArtifact () {
    var artifactPosition = Vector3(276.7286, 5.241356, 963.852);
    var artifactRotation = Vector3(270, 0,0);

    var Artifact01 = Instantiate(alienArtifact, artifactPosition.position, artifactRotation.rotation);
    print("Artifact created");
}
Highlighted bits are what's been added to my existing UFOanimationEvents.js It's supposed to instantiate my "Alien Artifact" at a precise location so that way when "Farmer Bob" goes to investigate the UFO crash he will find the first Artifact.
But can I get a break and something would actually work for a change? Hell no! For some reason this is not working. So I thought I would try it another way. I moved my "Animation Event" back a few frames so that way the "Alien Artifact" would get sort of dropped mid-air a short distance from the UFO when it crashes. Sounds good right? Wrong!. It would just fall through the ground. So I had to give it a ridged body and turn off the boxcollider trigger. so now it does NOT fall through the ground anymore, but now my FPS player can't pick it up!! Grrrrrr... Frak, Frak and Double Frak!!

Monday, March 28, 2011

Alien Artifacts Full Screen Inventory GUI

I made a background image for my FPS game where my character "Farmer Bob" has to collect 4 "Alien Artifacts" that he will find lying about either after something has happened in a game level or somewhere inside the game level. Once "Farmer Bob" has all of the "Alien Artifacts" they will enable him access to or be able to do something special with them. Right now I'm looking into how to make this function inside of my game environment. I currently have it set up as a full screen GUITexture object with this code attached to it:
function Update () {

transform.position.x = 0;
transform.position.y = 0;


guiTexture.pixelInset.x = 0;
guiTexture.pixelInset.x = 0;




guiTexture.pixelInset.width = Screen.width;
guiTexture.pixelInset.height = Screen.height;
}
It's a simple code, the same one I'm using for my Full Screen blood effect for when my FPS player takes damage. Now what I need to figure out is for when my FPS player picks up an "Alien Artifact" it will get added into this inventory screen into one of the place holders I have set up here. My guess is, is that I would make a smaller GUITexture to represent each "Alien Artifact" and then somehow have the code place those "Alien Artifacts" into the appropriate spot on my inventory screen in order of how "Farmer Bob" collects them up. I then somehow have to make sure that, that game information is carried over from level to level as my player moves between them. I've not yet figured out or decided whether or not to have my character go back and forth between levels yet. I'm thinking yes! Because it might make the game more challenging if "Alien Artifacts" and other game objects are missed, then he would need to return to either find them or pick them up.
 
All this and I STILL have NOT been able to get my stupid Alien Zombies to attack my FPS player. Grrrr...

Sunday, March 27, 2011

Scared Alien

Scared Alien
I had a bit of success again this weekend, I was able to get my Alien Zombie that stands on the ancient stone circle hill top next to the UFO to run away from my FPS player when he gets within a certain range. Weekend not over yet so hopefully I'll be able to add the waypoint stuff into his "ScaredAlien AI" script so that way he will wander around a bit. This alien is scared because when the UFO takes off from you getting too close to it he gets stranded so of course he's scared. Of course that means you have to chase after him to shoot him though, well not really if your aim is half ways good.

Edit: I found I had to make a few tweaks to his run speed, aware and scared distance parameters because depending on which direction I would approach from sometime when he would run away from on top of the stone circle hill he would end up, up in the air? So I had to fix that. I also gave him a nice "alien shriek" sound for when he starts to run away. My other alien in this level that is SUPPOSED to attack my player, and he still doesn't :( I did manage to get him to wander back and forth between two way points. It seems if I add a 3rd waypoint he goes to the first one fine but when he reaches about midway between the 2nd & 3rd waypoint he gets all "jerky" like he doesn't know where to go. That's something snafu in the code I'm sure but I'm just NOT code savy enough to see what it is. So I pulled the 3rd way point and now he will just go back and forth. The other thing is, is that if he sees my FPS player and comes after him, if I get out of range instead of going back to his routine of wandering his waypoints he just sort of stops and runs in one place?? I don't know why that is, again another code snafu :(

Late Edit:
For some reason when I went to test out my game this morning it was acting all "Choppy" and "Stuttery" for lack of better words. So I pulled out the "Alien Shriek" sound and the script calls to that and everything worked fine after that. WTF!! it was working so fine yesterday so just WTF was going on there I just don't Frakin get!! Man this stuff REALLY pisses me off sometimes!

Wednesday, March 23, 2011

Alien Zombies Splash Screen & AI Script issues

Even though I'm nowhere near done I thought I would tinker around with some "Splash Screen" ideas today while I was still trying to figure out my Alien Zombie AI script problems. I was thinking that some of the screen captures I had done looked pretty nice. Even nicer I suppose if I run them through Corel Painter and tart them up a bit. But I thought I might as well get the ball rolling on that as my game will eventually need a start screen where players can click on "start Game" or "Choose Level"... stuf like that. All of which will have to be worked out and I've no cluse at the moment how any of that is done although I have watched a few video tutorials on splash screens and it doesn't seem too bad to understand. UNLIKE my blasted Alien Zombie AI script. check this crap out man.

var speed = 3.0;

var rotationSpeed = 5.0;
var attackRange = 30.0;
var dontComeCloserRange = 5.0;
var pickNextWaypointDistance = 2.0;
var target : Transform;
var modelAnimation : Animation;





// Make sure there is always a character controller
@script RequireComponent (CharacterController)


function Start () {
// Auto setup player as target through tags
if (target == null && GameObject.FindWithTag("Player"))
target = GameObject.FindWithTag("Player").transform;


Patrol();
}


function Patrol () {
var curWayPoint = AutoWayPoint.FindClosest(transform.position);
while (true) {
var waypointPosition = curWayPoint.transform.position;
// Are we close to a waypoint? -> pick the next one!
if (Vector3.Distance(waypointPosition, transform.position) < pickNextWaypointDistance)
curWayPoint = PickNextWaypoint (curWayPoint);


// Attack the player and wait until
// - player is killed
// - player is out of sight
if (CanSeeTarget ())
yield StartCoroutine("AttackPlayer");


// Move towards our target
MoveTowards(waypointPosition);


yield;
}
}




function CanSeeTarget () : boolean {
if (Vector3.Distance(transform.position, target.position) > attackRange)
return false;


var hit : RaycastHit;
if (Physics.Linecast (transform.position, target.position, hit))
return hit.transform == target;


return false;
}


function AttackPlayer () {
var lastVisiblePlayerPosition = target.position;
while (true) {
if (CanSeeTarget ()) {
// Target is dead - stop hunting
if (target == null)
return;






// Target is too far away - give up
var distance = Vector3.Distance(transform.position, target.position);
if (distance > attackRange * 3)
return;


lastVisiblePlayerPosition = target.position;
if (distance > dontComeCloserRange)
MoveTowards (lastVisiblePlayerPosition);






//Attack player with "Attack" animation which is basically a clawing and biting animation
//this "Attack" is supposed to inflict damage to the FPS player


else {
modelAnimation.CrossFade("idle");
RotateTowards(lastVisiblePlayerPosition);
}






var forward = transform.TransformDirection(Vector3.forward);
var targetDirection = lastVisiblePlayerPosition - transform.position;
targetDirection.y = 0;




var angle = Vector3.Angle(targetDirection, forward);
if (distance < attackRange);
yield StartCoroutine("SearchPlayer", lastVisiblePlayerPosition);
//Player not visible anymore - stop attacking
if (!CanSeeTarget())


return;




}


yield;
}
}


function SearchPlayer (position : Vector3) {
// Run towards the player but after 3 seconds timeout and go back to Patroling
var timeout = 3.0;
while (timeout > 0.0) {
MoveTowards(position);


// We found the player
if (CanSeeTarget ())
return;


timeout -= Time.deltaTime;
yield;
}
}


function RotateTowards (position : Vector3) {
SendMessage("SetSpeed", 0.0);


var direction = position - transform.position;
direction.y = 0;
if (direction.magnitude < 0.1)
return;






// Rotate towards the target
transform.rotation = Quaternion.Slerp (transform.rotation, Quaternion.LookRotation(direction), rotationSpeed * Time.deltaTime);
transform.eulerAngles = Vector3(0, transform.eulerAngles.y, 0);
}


function MoveTowards (position : Vector3) {
var direction = position - transform.position;
direction.y = 0;
if (direction.magnitude < 0.5) {
SendMessage("SetSpeed", 0.0);
return;


}


// Rotate towards the target
transform.rotation = Quaternion.Slerp (transform.rotation, Quaternion.LookRotation(direction), rotationSpeed * Time.deltaTime);
transform.eulerAngles = Vector3(0, transform.eulerAngles.y, 0);


// Modify speed so we slow down when we are not facing the target
var forward = transform.TransformDirection(Vector3.forward);
var speedModifier = Vector3.Dot(forward, direction.normalized);
speedModifier = Mathf.Clamp01(speedModifier);


// Move the character
direction = forward * speed * speedModifier;
GetComponent (CharacterController).SimpleMove(direction);


SendMessage("SetSpeed", speed * speedModifier, SendMessageOptions.DontRequireReceiver);
}


function PickNextWaypoint (currentWaypoint : AutoWayPoint) {
// We want to find the waypoint where the character has to turn the least


// The direction in which we are walking
var forward = transform.TransformDirection(Vector3.forward);


// The closer two vectors, the larger the dot product will be.
var best = currentWaypoint;
var bestDot = -10.0;
for (var cur : AutoWayPoint in currentWaypoint.connected) {
var direction = Vector3.Normalize(cur.transform.position - transform.position);
var dot = Vector3.Dot(direction, forward);
if (dot > bestDot && cur != currentWaypoint) {
bestDot = dot;
best = cur;
}
}


return best;
}
 
 
I'm amazed my head doesn't explode with this stuff lol
Right now my idiot Alien Zombies will follow me around like lost puppies... they are TOTALLY incapable at the moment of inflicting damage on my FPS player. I can't seem to figure out how to get that to work either. you see I have 4 animation states for my Alien Zombies:
 
Idle
is basically when he's not doing anything just standing still
 
Walk
For when he's on patrol around his Waypoints
 
RunAttack
For when he sees my FPS player to run towards him.
 
ATTACK
A Clawing and biting attack for when he has reached my character and this one is SUPPOSED to do damage to my FPS player
 
 
Pretty straight forward simple melee attack right? Can I get it to work? Frak no. Not finding a boat load of help at any of the places that are set up to help either. To top it off I'm still trying to learn this code stuff but code has NEVER been my strong point so that is making it extra tough. Heck I'm amazed I've come this far with the whole thing. lol

Alien Zombie Attack

Tuesday, March 22, 2011

On Screen Blood Spater Effects

Another achievment this week was discovered almost by accident. While I was searching for a way to have my Machine gun sparks particle emitter change to a green blood particle emmiter when it hits my Alien Zombie, I came accross this awesome method of creating blood splatter effects on the screen when my FPS player takes damage on Unity Answers. [link] Although it's NOT exactly what I'm after it will do for now.


Over all it a pretty cool method for creating blood effects on the screen so the more damage my FPS player takes the more opaque the blood effect becomes.


Now what would REALLY float my boat is if I can get some sort of claw marks & blood splashes to occur on the screen and get worse with the more damage my FPS player would take from attacking Alien Zombies.


I'm guessing I would need two kinds of blood effects:


1- Blood & claw effects created from attacking Zombie Aliens


2- Blood effects from just weapons fire and general player damage.


Not sure how that can be done but I'm sure there is a way. Mean while, I've still not been able to get my Alien Zombies to attack. right now they will follow me around like lost puppies when I'm within their attack range. So that's another scripting kafuddle to try and figure out. Bloody happy with the fact that I no longer have "Swimming" alien Zombies though so that progress


Friday, March 18, 2011

Zombie Alien Animation In Unity 3D a Final SUCCESS!

Finally SUCCESS!
After what has started to feel quite literally like forever with what was looking like no end and no solution in sight one of the member to Unity Answers Bunny83 gave me the solution to my ongoing character animation problem. For over a month now I had been trying to figure out how to stop my Alien Zombies imported from Max 8 into Unity 3D to stop from flipping over face down and doing their animations.

The solution, although complicated and a bit of a pain in the ass works, it actually Frakin works.
So what then was the solution you might well ask. Well it turns out that as suspected my Alien Zombie's rotation was wrong. So the way to fix it was to place my Alien Zombie inside of an empty game object and assign all the scripts to that game object. The Alien Zombie now being a "child" of that object. So the "ZombieAlienAIAnimation.js" java script needed to be changed in order to access the animations which of course are on the Alien Zombie inside of the "game object".

As you can see here the changes made to not only how my Alien Zombie is now implemented in the "Hierachy" but also the modifications made by Bunny83 now add an option in the "Inspector" view to add the "Model Animation". So that way all I had to then do was drag my "Child" Alien Zombie onto that "Model Animation" option. And it works. 

Finally after what has been like forever struggling with this blasted issue a solution. Thanks to Bunny who is absolutely brilliant for solving this problem.

Now on game play when my FPS player gets close the Zombie Alien I get a script error that reads:

Coroutine 'RunAttack' couldn't be started!

UnityEngine.MonoBehaviour:StartCoroutine(String)
$:MoveNext() (at Assets/WeaponScripts/ZombieAlienAI.js:100)
 
I know why this is too. I need to modify the "ZombieAlienAI" to better suit the type of attack strategy my Alien Zombie needs to perform as this script is basically the Robot AI script from the Unity 3D FPS tutorial. All I basically did was change the animations so I've got my work cut out for me on that. I will of course need to now make another animation for my Alien Zombie to do some sort of "Claw Attack" and get that to perform damage to my FPS player somehow. Right now I'm not sure how to do that. But hopefully we will figure it out.

Ongoing Character Animation Problems

Character Set Up
OK I've been struggling with this problem for so long now with what seems like no end in sight. I thought I would take a little time and screen capture as much as possible with some explanations and see if this information help anyone to help come up with a solution to this problem.

As you can see in my first screen capture my alien starts off OK in his "T Pose" and stands up vertically. I've included as much of the setup as possible so you can hopefully see my settings. Click the image for full size view.

Firstly, I'm using MAX 8 to create my character and import from Max 8 to Unity 3D using Max's version of the FBX exporter. as you can see the FBX export options are very limited and it does not give me the option to adjust rotation of the model, which I'm beginning to suspect is where the main problem is. I tried looking to see if they have an updated version of the FBX exporter but they do not support past version 9 of MAX it seems. Software companies REALLY know how to stick it in and break it off don't they? So I'm stuck with exporting it in with this method unless there is another way that I'm not aware of?







Test Play: Now as you can see I've added his "ZombieAlienAIAnimation.js" java script and his "ZombieAlienAI" java script (Basically the same script from the FPS tutorial on Unity 3D) both of these scripts can be viewed here. on my Unity Answerer's Question.
As you can see he flips over and performs his animations and his routine of moving from one Waypoint to the next, he will even chase after my FPS controller like how you see him above. I have not given him and REAL attacking ability yet nor have I made other animations to allow him to actually attack my player yet, nor will I until I can get him to perform the most basic of functions properly.

I've included this screen capture just in case you need to see how my Alien Zombie biped is in place.
Someone had suggested placing the character inside of an empty game object and adjusting his rotation. Well I tried that and it seemed no matter what direction I rotated him he would still end up performing his animations and routine exactly like in my screen capture that shows his action in game play. Face down and swimming rather than walking!!



Here is a screen capture of the alien as he is imported into Unity 3D straight from MAX 8 using the FBX export from MAX 8. I don't know if anyone would need to see this but I have included it just the same.






Now I've included this screen capture because it shows a distinct difference in the way the Robots from the FPS tutorial on Unity 3D differ from my imported Zombie Alien. As you can see the robot is rotated sideways and my Zombie is rotated straight up. Now that could be part of the problem like I had mentioned above. but I should mention that I have tried a few other scrips on my Alien Zombies. I had one that would make them animate properly only they would not walk, they would walk "on the Spot" or "in one place" for lack of a better description. So from that I can only deduce that it must be a script problem, but I'm not a code expert so I REALLY don't know. All I do know is that I have been at this problem for well over a month now and it just gets more and more frustrating each day.