We would like to develop a custom IK solution replicating Unity’s IK functionality within the Babylon JS framework. While Babylon JS offers a community-made 2-Bone IK Controller, it does not fully meet our requirements. Therefore, we want to develop an IK system from scratch to ensure smooth gameplay mechanics.
Key Responsibilities:
Develop a custom Inverse Kinematic (IK) Control system in Babylon JS that mirrors Unity’s IK functionalities.
Work closely with our development team to integrate the IK system into the existing game.
Qualifications:
Strong experience with Babylon JS and Unity game development.
In-depth knowledge of Inverse Kinematics (IK) systems in Babylon JS, with the understanding of the Unity’s IK being highly desirable.
Proficient in JavaScript/TypeScript, with a strong understanding of 3D math and physics.
Experience with character rigging and animation.
Paid remote work
Must speak English well enough for commincating in team meetings
Team syncs up on the Pacific time zone for meetings and standup
Yo @adam … Please consider this post. You would be working with me to create an exportable Unity style IK system for hands and feet. Like foot placement to lock foot firmly on ground during a walking or running animation.
Mecanim is Unity’s animation system, and Foot IK is a feature within this system designed to ensure that a character’s feet correctly align with the ground or other surfaces during animation. This is particularly useful for ensuring that feet do not appear to float above or sink into the ground, which can break immersion.
Key Features:
Automatic Adjustment: Foot IK automatically adjusts the character’s feet to match the surface they are standing on, taking into account the slope and elevation of the terrain.
Realistic Movement: It prevents foot sliding and helps keep the feet planted on the ground when necessary, making movements like walking, running, and standing still appear more natural.
IK Pass: To use Foot IK, you typically need to enable the IK Pass on the animation state or layer in the Animator Controller. This allows the Foot IK to override the original animation data for the feet with the IK-adjusted positions.
Practical Use Cases
Walking on uneven terrain: Foot IK ensures that feet properly align with the ground, adjusting for the slope and avoiding unnatural foot placement.
Dynamic Interactions: When a character interacts with dynamic objects like stairs or moving platforms, Foot IK adjusts the feet to maintain proper contact.
Character Customization: In games where players can change character size or limb proportions, Foot IK helps maintain realistic foot placement regardless of these changes.
In summary, Mecanim Foot IK is a powerful tool for ensuring realistic foot placement in animations in Unity.
In Unity, A Custom IK Foot Placement script might look like this:
using UnityEngine;
[RequireComponent(typeof(Animator))]
public class IKFootPlanting : MonoBehaviour
{
private Animator animator;
[Header("IK Settings")]
public bool enableIK = true; // Toggle IK on/off
public float IKWeight = 1.0f; // How strongly the IK affects the feet
[Header("Foot Settings")]
public Transform leftFootTarget; // Empty GameObject to position the left foot
public Transform rightFootTarget; // Empty GameObject to position the right foot
public float footOffset = 0.1f; // Offset to prevent foot from clipping through the ground
[Header("Raycast Settings")]
public LayerMask groundLayer; // Layer mask for ground detection
public float raycastDistance = 1.0f; // How far to cast the ray for ground detection
private void Start()
{
animator = GetComponent<Animator>();
}
private void OnAnimatorIK(int layerIndex)
{
if (!enableIK) return;
// Process the left foot
PlantFoot(AvatarIKGoal.LeftFoot, leftFootTarget);
// Process the right foot
PlantFoot(AvatarIKGoal.RightFoot, rightFootTarget);
}
private void PlantFoot(AvatarIKGoal foot, Transform footTarget)
{
// Cast a ray downwards from the foot to detect the ground
Ray ray = new Ray(footTarget.position + Vector3.up, Vector3.down);
if (Physics.Raycast(ray, out RaycastHit hit, raycastDistance, groundLayer))
{
// Set the IK position and rotation based on the ground's surface
Vector3 footPosition = hit.point + Vector3.up * footOffset;
Quaternion footRotation = Quaternion.LookRotation(Vector3.ProjectOnPlane(transform.forward, hit.normal), hit.normal);
animator.SetIKPositionWeight(foot, IKWeight);
animator.SetIKRotationWeight(foot, IKWeight);
animator.SetIKPosition(foot, footPosition);
animator.SetIKRotation(foot, footRotation);
}
else
{
// No ground detected, set weight to 0
animator.SetIKPositionWeight(foot, 0);
animator.SetIKRotationWeight(foot, 0);
}
}
}
We need something like this in BabylonJS either using the existing BoneIKController or create a custom solution that we can implement something the above
Devs… This is the IK Foot Planting playground we need to get working. We need to imulate what Unity does when you enable the FootIK checkbox on the Animation Controller. Basically we need to use the existing IK Foot Rig Elements from the third person controller like left and right foot target meshes. When the ik is active for that frame, we need to make sure the feet are planted on the ground surface