stride3d / stride

Stride (formerly Xenko), a free and open-source cross-platform C# game engine.
https://stride3d.net
MIT License
6.66k stars 957 forks source link

[Feature Request] Build-in IK / Inverse Kinematic Solver #103

Open ghost opened 6 years ago

ghost commented 6 years ago

Original Content of this post: beside to handle the character foot position, maybe this will be useful for 3rd person shooter game.

Added context from @anan1213095357 in issue #1698 : Is your feature request related to a problem? Please describe. Yes, my feature request is related to a problem. Currently, our software does not include an Inverse Kinematics (IK) solver, which can limit our capabilities in various animation and robotics applications. The lack of an IK solver may increase the complexity and the time needed to calculate the joint parameters that achieve the desired positions of the robotic manipulator or character.

Describe the solution you'd like I would like to have an integrated Inverse Kinematics solver in our software. This solver should include support for different IK algorithms such as CCD, FABRIK, and Jacobian methods. It would be great if the solver could handle both single and multiple end-effectors and constraints.

Describe alternatives you've considered An alternative could be to integrate an external IK library into our system, but this could lead to problems with compatibility and maintainability. Having a built-in IK solver will provide more flexibility and control over the feature.

Additional context An IK solver is fundamental in various fields like computer animation, game development, robotics, and even biomechanics. It is essential for calculating joint parameters that would put an end-effector in a desired position.

Last edit by @Eideren.

Vega-KH commented 6 years ago

A first step in this direction would be to expose bones in the API. This would allow developers to at least set bone positions and rotation manually and could be used to script a basic IK solver.

ghost commented 6 years ago

yes, well, i only need to rotate a single bone manually, to rotate the spine bone according to mouse y axis, wasn't really IK though, but if xenko have IK that would be cool too.

ykafia commented 6 years ago

Is there a way to work on the API to expose the bones ?

Eideren commented 6 years ago

I haven't used it but this seems like what you are looking for.

ykafia commented 6 years ago

Thanks @Eideren i think i found something with that : var modcomp = this.Entity.Get(); var skeleton = modcomp.Skeleton; skeleton.Nodes[0].Transform.Position.X = 0;

Tried this in a syncscript and attached to a model with a skeleton, didn't seem to work yet, i'll try more about it, so if someone wish to try things be free

Eideren commented 6 years ago

@Jaygem use NodeTransformations's Transform instead, works perfectly on my end.

ykafia commented 6 years ago

@Eideren I'm sorry it doesn't work for me :c How do you do it?

Eideren commented 6 years ago

@Jaygem

var Skeleton = Entity.Get<ModelComponent>().Skeleton;
for( int i = 0; i < Skeleton.NodeTransformations.Length; i++ )
{
    Skeleton.NodeTransformations[ i ].Transform.Position = new Vector3( 0f, 0f, 0f );
}

Put this inside your update function, it should place all of your bones at the origin.

anan1213095357 commented 1 year ago

When can I receive support? A game engine lacking IK and animation state machines will greatly increase the entry threshold

anan1213095357 commented 1 year ago

@JAYGEM

var Skeleton = Entity.Get<ModelComponent>().Skeleton;
for( int i = 0; i < Skeleton.NodeTransformations.Length; i++ )
{
  Skeleton.NodeTransformations[ i ].Transform.Position = new Vector3( 0f, 0f, 0f );
}

Put this inside your update function, it should place all of your bones at the origin.

When can I receive support? A game engine lacking IK and animation state machines will greatly increase the entry threshold

Eideren commented 1 year ago

@anan1213095357 Stride is not a commercial engine, every person contributing does so on their free time. If you want a specific feature to get implemented in the engine your best bet is to do it yourself or pay someone to do it for you

anan1213095357 commented 1 year ago

@anan1213095357 Stride is not a commercial engine, every person contributing does so on their free time. If you want a specific feature to get implemented in the engine your best bet is to do it yourself or pay someone to do it for you

If my technical level could be achieved, I wouldn't be asking questions here. Because this ik is considered a necessary content for a mature game engine. So I want to see if everyone has the will to achieve it

Perksey commented 1 year ago

@anan1213095357 looks like you’ll want to find a “more mature” engine then. Stride has lots of users (that do think it’s mature enough for them) and they already have lots of needs that are being worked on, so unless anyone has particular passion for this specific feature (there has been no indication as of yet) then it isn’t going to be worked on in the near future. This isn’t me speaking as a Stride dev (because I’m not), this is just the way open source works. Open source and the volunteers therein does not mean the world is going to materialise around you.

anan1213095357 commented 1 year ago

@anan1213095357 looks like you’ll want to find a “more mature” engine then. Stride has lots of users (that do think it’s mature enough for them) and they already have lots of needs that are being worked on, so unless anyone has particular passion for this specific feature (there has been no indication as of yet) then it isn’t going to be worked on in the near future. This isn’t me speaking as a Stride dev (because I’m not), this is just the way open source works. Open source and the volunteers therein does not mean the world is going to materialise around you.

"I believe the future of a thriving user community for a game engine still greatly involves newcomers like me. The reason I'm drawn to this game engine is because, compared to others, it offers simplicity and a low learning curve, which is perfect for beginners. However, I do face challenges when certain tools necessary for my projects are not available in the game engine, making it impossible for newcomers like me to achieve certain goals. My hope is that this game engine continues to improve and grow. That's why I brought up this point."

ExtraMedicated commented 1 year ago

I was relying heavily on the RootMotion Final IK package in my Unity projects. I was hoping there was some alternative here, but porting that over seems like a lot more than I'm personally capable of.