Java LibraryJava Kütüphanesi

Inverse Kinematics LibraryTers Kinematik Kütüphanesi

A library you can use to create 3D inverse kinematics tentacles for Minecraft servers.Minecraft sunucularında üç boyutlu ters kinematik dokunaçları oluşturmak için kullanılabilen bir kütüphane geliştirdim.

Building a 3D Inverse Kinematics Tentacle in Minecraft

This project was a small experiment in bringing inverse kinematics into Minecraft. I built a 3D tentacle system where a chain of connected segments follows a target position in real time.

Inverse kinematics is a technique used to calculate how connected parts, like bones or joints, should rotate so the end point reaches a desired position. It is commonly used in animation, robotics, and procedural movement systems. In this project, I used the same idea to make a tentacle-like structure move toward a point inside Minecraft.

Starting From the Idea

The project was inspired by Coding Train’s inverse kinematics challenge, but I wanted to adapt the idea into a 3D Minecraft environment instead of only keeping it as a 2D visual sketch.

That changed the problem in a useful way. The tentacle was no longer just something drawn on a canvas. It had to exist inside the game world, update every tick, follow a target, and be displayed with visible in-game particles or objects.

The goal was simple: create a chain of segments that can reach toward a moving target while keeping its connected structure.

Representing the Tentacle

I structured the tentacle as a collection of segments. Each segment had a length, a direction, and a connection to the next segment in the chain. Together, these segments formed a flexible body that could bend toward a target.

In the repository example, the tentacle can be created from a starting location, given a total length and segment count, then updated by calling a reach function toward a target position. After that, it can be displayed in the Minecraft world.

The basic workflow was:

// Create the tentacle once.
this.tentacle = new Tentacle(player.getEyeLocation(), 10, 100, 1, Color.RED, 0.35f, 0.35f);

// Let the tentacle move from its start location.
this.tentacle.setAttached(false);

// Update the target position.
this.tentacle.reach(player.getEyeLocation().add(player.getLocation().getDirection().multiply(7)));

// Draw the tentacle in the world.
this.tentacle.display();

This made the system reusable. The tentacle logic could be controlled by giving it different target positions, while the display logic handled how it appeared inside Minecraft.

Making It Work in 3D

A big part of the project was moving from a 2D idea to a 3D implementation. In 2D, the tentacle only has to rotate on a flat plane. In Minecraft, the target can be anywhere in 3D space, so the system has to work with full position vectors.

That meant thinking about:

  • Segment direction
  • Segment length
  • Joint positions
  • Target positions
  • Updating the chain every tick
  • Drawing the result clearly in the game world

This made the project a good math and animation exercise. The additional direction of movement introduced while increasing the dimension, required me to structure the mathematical solution in a more complex way than I had initially anticipated.

Real-Time Procedural Animation

The most interesting part of the project was that the movement was procedural. I was not playing a pre-made animation. The tentacle was calculated at runtime based on where the target was.

That makes the system flexible. A tentacle can follow the player’s view direction, reach toward a point, or be reused as part of a larger ability or creature-like movement system.

I also used the tentacle code as a base for a waterbending arm ability idea. This showed me how a small procedural animation experiment could become part of a more complete gameplay mechanic.

Water-arms example

What I Learned

This project helped me understand how inverse kinematics can be used outside of traditional animation software. Implementing it inside Minecraft made the concept more practical because the system had to run in real time and respond to changing game-world positions.

I also became more comfortable with vector math, chained movement, segment-based structures, and procedural animation. These ideas later became useful for building more complex Minecraft abilities and other interactive movement systems.

Final Thoughts

This was a small project, but it was an important experiment for me. It connected math, animation, and game programming in a way that produced a visible result inside Minecraft.

Minecraft’ta 3B Ters Kinematik Dokunaç Sistemi Geliştirmek

Bu proje, ters kinematik yöntemini Minecraft ortamına uyarladığım bir çalışmaydı. Birbirine bağlı segmentlerden oluşan ve hedef konumu gerçek zamanlı olarak takip eden üç boyutlu bir dokunaç sistemi geliştirdim.

Ters kinematik, kemik veya eklem gibi birbirine bağlı parçaların, uç noktanın istenen konuma ulaşabilmesi için nasıl dönmesi gerektiğini hesaplayan bir yöntemdir. Animasyon, robotik ve prosedürel hareket sistemlerinde yaygın olarak kullanılır. Bu projede aynı yaklaşımı, Minecraft içinde bir noktaya doğru hareket eden dokunaç benzeri bir yapı oluşturmak için kullandım.

Ana Fikir

Proje, Coding Train’in iki boyutlu ters kinematik çalışmasından esinlendi. Çalışmadaki fikri yalnızca iki boyutlu bir görsel taslak olarak bırakmak yerine üç boyutlu bir Minecraft ortamına uyarlamak istedim.

Bu değişiklik, problemi daha işlevsel bir hale getirdi. Dokunaç Minecraft içerisindeki birçok farklı sistemde kullanılabilir oldu. Dokunacın oyun dünyasında var olması için, her tick güncellenmesi ve oyun içi parçacıklar ya da nesneler aracılığıyla görünür hâle getirilmesi gerekiyordu.

Kütüphanenin amacı: geliştiricilere farklı amaçlarla kullanılmak üzere, birbirine bağlı yapısını korurken hareketli bir hedefe doğru uzanabilen üç boyutlu segment zincirleri sunmaktı.

Dokunaç Yapısını Tasarlamak

Dokunaç sistemini segmentlerden oluşan bir yapı olarak tasarladım. Her segmentin bir uzunluğu, yönü ve zincirdeki bir sonraki segmentle bağlantısı bulunuyordu. Bu segmentler bir araya gelerek hedefe doğru bükülebilen esnek bir gövde oluşturuyordu.

Aşağıdaki örnekte dokunaç, bir başlangıç konumu, toplam uzunluk ve segment sayısı verilerek oluşturulabiliyor. Ardından bir hedef konuma doğru reach fonksiyonuyla güncelleniyor ve Minecraft dünyasında görüntülenebiliyordu.

Temel kullanım şu şekildeydi:

// Dokunaç'ı bir kez oluştur.
this.tentacle = new Tentacle(player.getEyeLocation(), 10, 100, 1, Color.RED, 0.35f, 0.35f);

// Dokunaç'ın başlangıç noktasından bağımsız hareket etmesini sağla.
this.tentacle.setAttached(false);

// Hedef konumu güncelle.
this.tentacle.reach(player.getEyeLocation().add(player.getLocation().getDirection().multiply(7)));

// Dokunaç'ı oyun dünyasında göster.
this.tentacle.display();

Bu yapı sistemi yeniden kullanılabilir hale getirdi. Dokunaç mantığı farklı hedef konumlar verilerek kontrol edilebilirken, görüntüleme kısmı yapının Minecraft dünyasında nasıl görüneceğini yönetiyordu.

Sistemi Üç Boyutta Çalıştırmak

Projenin önemli bölümlerinden biri, iki boyutlu fikri üç boyutlu bir uygulamaya dönüştürmekti. İki boyutta tentacle yalnızca düz bir yüzey üzerinde dönüyordu. Minecraft’ta ise hedef uzayın herhangi bir noktasında bulunabildiği için sistemin tam üç boyutlu konum vektörleriyle çalışması gerekiyordu.

Bu süreçte şu konular üzerinde durdum:

  • Segment yönleri
  • Segment uzunlukları
  • Eklem konumları
  • Hedef konum
  • Zincirin her tick güncellenmesi
  • Sonucun oyun dünyasında gösterilmesi

Bu yönüyle proje hem matematik hem de animasyon açısından faydalı bir çalışma oldu. Boyutu artırırken eklenen ekstra hareket yönü, algoritmanın matematiksel çözümünü başta tahmin ettiğimden daha kompleks bir şekilde düzenlememi gerektirdi.

Gerçek Zamanlı Prosedürel Animasyon

Projenin en ilgi çekici yanı, hareketin prosedürel olmasıydı. Önceden hazırlanmış bir animasyon oynatmak yerine dokunacın hareketi, hedefin konumuna göre çalışma anında hesaplanıyordu.

Bu durum sistemi oldukça esnek hale getirdi. Dokunaç oyuncunun baktığı yönü takip edebilir, belirli bir noktaya uzanabilir veya daha büyük bir yeteneğin ya da canlı benzeri hareket sisteminin parçası olarak kullanılabilirdi.

Dokunaç kodunu daha sonra bir su bükme kolu yeteneği fikri için de temel olarak kullandım. Bu, küçük bir prosedürel animasyon deneyinin daha kapsamlı bir oynanış mekaniğine nasıl dönüşebileceğini görmemi sağladı.

Su kolları örneği

Öğrendiklerim

Bu proje, ters kinematiğin geleneksel animasyon yazılımları dışında nasıl kullanılabileceğini anlamama yardımcı oldu. Sistemi Minecraft içinde geliştirmek, yöntemi daha uygulamalı hale getirdi çünkü yapı gerçek zamanlı çalışmalı ve oyun dünyasındaki değişen konumlara anında tepki vermeliydi.

Aynı zamanda vektör matematiği, zincir tabanlı hareket, segment yapıları ve prosedürel animasyon konularında deneyim kazandım. Bu fikirler daha sonra farklı Minecraft yetenekleri ve diğer etkileşimli hareket sistemleri geliştirirken de işime yaradı.

Son Düşünceler

Küçük ölçekli bir proje olmasına rağmen benim için önemli bir deneydi. Matematik, animasyon ve oyun programlamayı Minecraft içinde doğrudan görülebilen bir sonuçta bir araya getirdim.