I am working on a custom engine and have been tinkering with animations using the Cal3D library. My previous experience with animations was based on prototyping a bit with Unity's Mecanim. Right now, I'm trying to implement a character that can be idle, walk or run and is also able to point it's gun straight, up or down while doing any of the previous animations. As far as I know, this would require two different variables from which to calculate the weights of each animation, these are, the aiming angle and the speed of the player. At first I thought about separating the hands and head of the player as a partial animation and do a 1DBlender (like the one in Unity) based on the aiming angle to interpolate between three different animations of the arms and head pointing up, straight or down. Then, for the rest of the body, interpolate with another 1DBlender based on the speed. While the solution works, I'm still not completely okay with it, as I cannot have blended animations for the … [Read more...] about Calculate animation weights based on two variables

# Variable salary calculation

## Calculating rotation after retrieving joint positions with FABRIK?

As we all know, FABRIK gives us joint positions -- it is up to us to calculate what the rotations need to be so the child joints end up in the desired joint positions. My calculations for joint rotations work only when the starting local rotation (in object space) is 0, 0, 0. The rotations seem to have some mysterious offset otherwise. In short, this is how I am achieving this: FinalToRoot() -> get the positions, but don't actually move any joints -- just cache the position RootToFinal() -> Get the next position using the cached vector (nextPos) -> calculate rotation offset needed I have validated that nextPos is correct. The joints are correctly positioned if I adjust their transform.position instead of rotation. Code sample: Also, semi-relevent, this is how I convert desiredRotation into local/object space rotation coordinates: Quaternion desiredLocalRotation = transform.localRotation * (Quaternion.Inverse(transform.rotation) * worldRotation); I can then perform object … [Read more...] about Calculating rotation after retrieving joint positions with FABRIK?

## How to calculate the price for acquisition of a mobile game

I searched long and hard thru the Game Dev community here and I didn't manage to find a good enough answer for a situation that I need help with. Here is the deal - I've spent about a year to single-handedly develop a mobile game which is a mix between MMORPG and idle battle games. Wouldn't like to go into too much depth as to which game we are talking about and who is trying to buy it but, a company I have worked for before reached out to me with a proposal to buy the game from me so they can reap the profit from it and develop it further since they are a professional game dev company while I am a single person and I can't really reach the game's full potential as far as growth and player base goes. Now the game is pretty beneficial for me since I live in a region with a very low-income standard so the money I get from the game might not be much for many other people but for me, they are equal to about 1.5 ~ 2 monthly salaries (we are talking average salary for this country). That is … [Read more...] about How to calculate the price for acquisition of a mobile game

## Recursively calculate possible pathway on a grid depending on max walk distance

I have a character that is placed on a grid. It has a variable maximum walking distance. Grid fields can be walkable or not walkable. As the character may has to walk around certain not walkable fields to reach his destination his maximum walking distance isn't allways represented by a circle. See these examples: Without obstacles, walking distance 7: With obstacles, walking distance 7: Note how the obstacles affect the players maximum walking distance To calculate this i've written this recursive function: static Vector2Int[] GetWalkableFields (Vector2Int position, int steps) { List<Vector2Int> walkableFields = new List<Vector2Int>(); if (steps > 0) { foreach (Vector2Int v in GetNearbyFileds(position)) { if (m_mc.IsInBounds(v) && m_mc.IsWalkable(v.x, v.y)) { walkableFields.Add(v); walkableFields.AddRange(GetWalkableFields(v, steps - 1)); } } return walkableFields.ToArray(); } else { Vector2Int[] v = { position }; return v; } } And this function, that returns … [Read more...] about Recursively calculate possible pathway on a grid depending on max walk distance

## How do I calculate where which pixel it’s reflecting based on a height map?

I saw this How can I Compute steepness for heightmap while looking for a way to reflect pixels. But now that I have the steepness/slope I don't know how to calculate which angle it's pointing at. Imagine if I had an image parallel (directly above my heightmap) with my heightmap and 100(units/pixels) away/above from it, if the steepness is 0, then i just grab a pixel at that same [x,y]. Imagine that i am trying reflect what the heightmap would show if i was to be able to see through my image. But let's say I have a steepness of 1 which i am guessing is 45 degrees since 1/1 is 45 degrees but which pixel should i be grabbing from my image how do I calculate what angle the pixel is coming from [x,y]. How would i calculate which pixel(location) is reflected onto the heightmap (imagining that the heightmap is a chrome surface). I know if the angle is too steep it'll be way outside of the image but I'll just use min/max hack to grab border pixels (unless you can think of another method to … [Read more...] about How do I calculate where which pixel it’s reflecting based on a height map?