maanantai 9. tammikuuta 2017

Time for an update!

It's been awhile since my last update. My project was quite dead during all of this time mostly because lack of time and programming skills.
Now is time to resurrect this project and start to write posts again and rewrite old systems.



I replaced Unity's default input system with Rewired which made input coding a bliss.

I modified Mixamo's paladin character to fit my needs.

Paladin only had diffuse, normal and specular textures which I needed to convert to more PBR friendly shape. Substance Painter proved to be perfect for this job. I wanted to get this done quick so
I started by adding old diffuse as a fill layer in subtance painter.
Then I added metal material as a fill layer and masked out every non-metal surfaces and added some leather material to all leather straps. Quick and results good enough for my tests.
Original diffuse


Metal and leather materials added.

Then I needed to chop this paladin into different body parts and add some kind of flesh material which I painted in Substance Painter.

All different body parts separated


I made a Warrior Creator script which makes making new warriors simple. I just need to make sure that every character rig and body parts follow my naming policy.
It used to be really long and time consuming process to prepare new character meshes as warrior but now it's just a one button. I could share it but it's so specific for my project so it would be quite pointless to share it.

I rewrote whole arm controller because old one was not that well coded, really shows my lack of experience as a coder.

I used Custom Handles to make it easy to adjust arm rotation limits in unity Scene view. Custom Handles is really nice asset if you need to make any kind of custom gizmos.




Anyways, here is the new LimbHandler and LimbHandlerInspector which should be more shareable than my earlier one.
There is some dependencies which I'll also share but I can't obviously share Rewired or Custom Handles.

and inspector Here is LimbAction, which is main class for any action LimbHandler handles

Here is the Common class And here is InputManager, it's really simple.

torstai 19. toukokuuta 2016

Let there be limbs!

I finally managed to finish my dismember system. It's not perfect yet but working well enough for my current needs.


So overview of my system:

Bear in mind, that I'm not programmer so some of my code might look really stupid and unefficient.
I've separated every limb in blender to make my work easier in Unity.

I've also parented every mesh same way rig is parented. 


This way Unity will automatically make mesh hierarchy same as rig hierarchy. This is not mandatory but just makes things easier in Unity.

I'm using Puppetmaster to control character physics and FinalIK for Full Body IK movement which I use to control both hands.

Every breakable skinnedMesh has reference to of all of it's child skinnedMeshes which is called MyLimbs.

Every limb in Puppetmaster ragdoll has a reference to same skinnedMesh limb.

When ragdoll limbs gets too damaged it will break and call method BakeLimbs() from it's skinnedMesh counter part.

SkinnedMesh will then make new temporary GameObject, change position of this empty gameObject same as it is in Ragdoll limb and bake current vertex positions of skinnedMesh to a new gameobject and copy skinnedMesh materials.

Bakedmesh will copy rigidbody from puppetmaster and use reflection to copy whole ConfigurableJoint component from puppetmaster ragdoll to bakedMesh with one change,
ConfigurableJoint.connectedBody changed to correct parent.

Items are parented to Puppetmaster ragdoll so I need to check what is current item and change it's FixedJoint.connectedBody to bakedmesh hand gameobject.

Then I apply same velocities as it's on Puppetmaster Ragdoll so the dismembered limb will break naturally instead of just dropping off.

I had quite alot problems with adding collider with correct orientation so I add collider as a child of this new bakedMesh. This new collider copies properties from Puppetmaster ragdoll, and changes layer to correct one. (I did not know about reflection when I was doing collider part but ofc I could use it also here just like with ConfigurableJoint)

And finally disable old skinned mesh renderer.

It was much more work than I first thought but that is how game development always goes :-)

Here is my current codes, quite un-commented but I hope these are clear enough. Leave a comment if you have any questions!

First the code which is on every detachable skinnedmesh
Second code is on every breakable Puppetmaster ragdoll limb which can break.
Third is both Bone and Item components. 




lauantai 14. toukokuuta 2016

Blog for my own game development rants.

Here I will update the progress of my personal game project which is heavily inspired by the old game Die by the Sword

This project is still at really early stage.
Currently I have arm movement working with rotation limits.
Player can rotate shoulder on two axes,wrist on three axes and extend/curtail arm.

Current controls are:
Press 1 to make right hand active
Press 2 to make left hand active

While left mouse button is held down:
Mouse Y adjusts shoulder pitch
Mouse X adjusts shoulder yaw

While right mouse button is held down:
Mouse Y adjusts wrist roll
Mouse X adjusts wrist yaw
Mouse Wheel adjusts wrist pitch

While middle mouse button is held down:
Mouse Y adjusts extending/curtailing of arm

Player can simultaneously adjust shoulder and wrist

Here is a video of arm movement.

Next job is to finish elbow target which gets a bit weird when wrist is rotated that hand palm is facing up. Problem can be seen in the video below.

After that to an interesting topic, dismembering of limbs.

Here is link to my current to-do list which I will update when ever I manage to think something nice I would want to have in my project.