DNX Gaming is my personal game development brand. My name is Daniel Rosales, I'm here to build a portfolio as a Unity developer focused on AI. Making games has always been my goal. After a few years of familiarizing myself with Unity and the backend of game design, I'm ready to start.
My first release in quite a while is LeafTown. That was a 20-day project for the Great Autumn Game Jam 2021. I hope you appreciate the NPCs.
One of my favorite snippets of code for LeafTown was the flexible object. Unity "Cloth" component is a very simple way to make a mesh flexible on runtime. This was particularly important for LeafTown since the leaves play such a core role. The issue is that the cloth component doesn't behave the same way as a regular RigidBody. So, instead of working out a way to handle the cloth, I added it and a separate RigidBody (with a regular collider) and synced the cloth to it through a custom script.
//The flexible object displays it mesh as a cloth but has a... //regular RigidBody and collider on the same game object to... //work as skeleton and allow wide range collisions //If the object is moving, as in it recived any force if(m_Rigidbody.velocity.magnitude > 0.05) { //Take the base constraints from the cloth component constraints = m_Cloth.coefficients; for(int i = 0; i <= constraints.Length - 1; i++) { // setting a constraint to 0 in the inspector means it... //should always be locked, at least one contraint should.. //be always locked if(constraints[i].maxDistance > 0) { //Each constraint is loosen based on the speed of... //the body, the initial value for extra... //customization of movement, and a flexibility... //multiplier to control the speed at which the.. //constraint lossens constraints[i].maxDistance = constraints[i].maxDistance * m_Rigidbody.velocity.magnitude * flexibilityMultiplier; //Adjust the maximun flexibilty we want if (constraints[i].maxDistance > maxFlexibility) constraints[i].maxDistance = maxFlexibility; } } //Apply the new constraints to the cloth m_Cloth.coefficients = constraints; } else { //Reset constraints when not in motion m_Cloth.coefficients = initialConstraint; } }
I'm working on a multiplayer card game to learn more about Photon. While the first expansion is likely going to have only a few cards, I have a few twists on the classic collectible card game in mind.
I'm not sure I will be able to make my full collab projects public as I did for the children of preservation. However, I'll publish the code after a little cleaning so you can check it out here.