goldst / ik.ts Goto Github PK
View Code? Open in Web Editor NEWThis project forked from lo-th/fullik
TypeScript / JavaScript fast iterative solver for Inverse Kinematics
Home Page: https://goldst.dev/IK.ts
License: MIT License
This project forked from lo-th/fullik
TypeScript / JavaScript fast iterative solver for Inverse Kinematics
Home Page: https://goldst.dev/IK.ts
License: MIT License
Hello!
I have been trying to implement this library, I have it working if I re-create the chain/bones each frame. However, trying to preserve the structure, chain3d etc I get some weird results...
createIKStructure() {
const segment = this.segment;
this.ikLegTarget = new IK.V3(this.footPosition.x, this.footPosition.y, this.footPosition.z); // or IK.V2
this.ikLeg = new IK.Chain3D(); // or Chain2D
this.ikLeg.setFixedBaseMode(true);
const leg = this.ikLeg; // or Chain2D
// with start position, direction and length:
const baseBoneA = new IK.Bone3D( // or Bone2D
new IK.V3(segment.x, segment.y, segment.z), // start position. Use IK.V2 if you are using Chain2D.
undefined, // no end position given
new IK.V3(0, 1, 0), // direction. Use IK.V2 if you are using Chain2D.
1 // length
);
leg.addBone(baseBoneA);
leg.addConsecutiveBone(
new IK.V3(0, -1, 0), // direction. Use IK.V2 if you are using Chain2D.
1 // length
);
this.structure = new IK.Structure3D(); // or Structure2D
this.structure.add(leg, this.ikLegTarget);
}
update(delta) {
this.createIKStructure(); // only works if i do this, below lines seem to do nothing/produce buggy results
leg.baseLocation.set(segment.x, segment.y, segment.z);
this.ikLegTarget.set(this.footPosition.x, this.footPosition.y, this.footPosition.z); // or IK.V2
this.structure.update();
}
As you can see from this rough snippet, I tried using a few methods to reset the base location and others. Doesnt seem to do much besides produce buggy results. Re-creating everything produces the correct result from what I can see. Any ideas how to approach this?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.