Platform fix

No sooner had I posted for Monday, I fixed the parenting of the first/third person controllers to the platform problem. I kept the way the platform obtained each of the positions using individual empties and drawn gizmos for those positions. I then completely changed the way the platform was moved using ‘Vedtor3.MoveTowards’. I also included the check for the ‘Player’ tag prior to parenting. With this in place my platform mover worked like a champ! I will create a video tutorial on this once I get it perfected

What I like about the empty game objects occupying the location of the from and to destinations is that I can move those points anywhere in space (x, y or z) and the platform will track to them without a problem 🙂 .

I have also created a custom package for this ‘Moving Platform’ that I can import to other projects such as the Unity Book project I am working to convert to the new Unity5. This package bundled up everything I did for the fix including the walls keeping the player from walking off the platform while in motion, scripts and the positional empties.

Below is a demonstration of the ‘Moving Platform’ in action in my test project  showing how the collider walls prevent the player from walking off the platform then I switch over to my Unity book project where I import the package. There I demonstrate a fly over of the landscape from position one to position two. Lastly I show the extensibility by adding a third position and preform a fly through of two positions (I skip the fly back for time reasons). I will create a full tutorial of this moving platform next week.

Strange scripting errors

While adding the moving platform script to different game objects I found some very peculiar behavior presenting itself. When I added the holder script to my small platform everything works like a champ. Hop up on the platform, take a ride, jump up and down, walk off and everything works fine. When I add the holder script to the other platform using a little fancier script for the movement all hell breaks loose. Objects that have no association what so ever with the other platform start moving, even on game object off in the distance. I was and still am stumped by all that movement. When I adjusted the holder script with a check to identify the object entering the trigger and only will be affected by an object it should be affected by e.g. the Player all that extra movement stopped and the script started trying to act as it should. There is still a small bug but I’ll get to the bottom of that. When I do I’ll expand on that bug and the fix.

Latest: depending on how I am moving the platform ‘moving’ or ‘Vector3.Lerp’, when I parent the first person or third person controllers will result in how the controller will act. If I ‘move’ the platform, parenting seems to have no effect. When I Vector3.Lerp the platform parent works just fine and the character controller follows along great. The first person controller behaves a little weird as in the camera changes position (probably because to the parenting but I’ll get that fixed as it is a minor problem. Now I have to figure a way to move the platform without using Lerp because I don’t like that movement, I want the movement more liner rather than damped as the Vector3.Lerp is. I have a couple if ideas but I’ll check the online documentation first.

Back to Unity Book

I am back to translating the unity Book creating the Garden Gnome game into Unity 5. Stepping back I decided to change around how the platforms move in the test scenes and found some great ideas for a script that should give me a lot of flexibility. We will see how it works. I’ll post an early update as soon as I get the script the way I want which should be soon. Looking at the scripting references it should be fairly straight forward.

WoodMan

I created the WoodMan shown in the last post and using Rigify added a simple rig, exported as .FBX then imported. By just adding the animator component and using the mocaps from the asset store was able to animate the character in nothing flat.

Results: