When my camera is rotated, the character switches to a back view, but all the physics parts fly up because of the changing parts, even though he hasn't actually "moved" in game.

In Unreal engine, how can I reset or manipulate the physics through code or blueprints?

Related Discussions
...

Not a single function you listed actually exists.
Can I get help from a human please?

Note: Sorry for sounding rude, can't edit the post and overall annoyed at AI in general giving false answers lol.

Anyway, unreal spine seems to be lacking a few features from it's unity counterpart. Any info would be appreciated.

No worries, us humans will be along as soon as we can and check the AI answer. It is great when it's right, giving people the answer so they can move on quickly. The downside is sometimes it makes things up!

The method you want is PhysicsConstraint reset (in spine-cpp here). Iterate the Skeleton physicsConstraints (in spine-cpp here as a Vector) and call reset() on each.

    @JuiceTin just to follow up on this, can you tell me how you rotate the character? In principle, physics should be applied in the skeleton's coordinate system, which should be independent of the UE component's transformation.

      Nate Heya thanks, didn't think of accessing the base skeleton! Though it's been years since I've used C++ and currently do not have intellisense working, so I'm basically coding blind lol.
      I feel like this should work, however it says GetSkeleton() is not found? (subclass of SpineSkelRenderer)

      void UJSpineSkeletonRendererComponent::ResetPhysics(){
      	Vector<PhysicsConstraint *> contraints = GetSkeleton()->getPhysicsConstraints();
      	for(int i=0; i< contraints.size(); i++){
      		contraints[i]->reset();
      	}
      }

      Also, is it possible to simulate wind using the spine physics?

      Mario Oh no worries the current Spine implementation works perfectly. I just have a setup where the character always faces the camera, but when you rotate the camera it switches to a back view (similar to Paper Mario). This switch moves parts to different locations which simulates their physics. A simple reset function would work perfectly. 🙂

      I've added an issue to add ResetPhysicsConstraints() to the SpineSkeletonComponent on GitHub. I'll try to get to this today:
      EsotericSoftware/spine-runtimes2615

      That way, you won't have to write any C++ yourself, but can just call the function via blueprints.

      I've added ResetPhysicsConstraint() as a blueprint callable method on SpineSkeletonComponent and SpineWidget (along with PhysicsTranslate() and PhysicsRotate(), which allow you to apply forces and torque to a skeleton to simulate wind and other physical things).

        5 days later

        Mario
        Apologies for the late response, but hell yeah! Mario you are my hero lol, excited to try out that update!

        Also 2 more things:

        1. I'm unfamiliar with github, am I able to post things too? I wrote some C++ code that allows access to the spine dynamic material instance, which I believe was not possible before. Would be nice to add that into the official unreal build.

        2. Also sorry to shove this in, but I have an unresponded post earlier about loading the skeleton at runtime: https://esotericsoftware.com/forum/d/26578-loading-spine-files-from-disk-at-runtime
          It's possible in unity but not in Unreal as far as I can tell. Would be huge for allowing freelance artists to test their skeletons quickly in a build without having to send them through me every time first.

        1. That sounds great! You can send what is called a pull request. However, if the change is small, you can also just post the code here in response.
        2. Ah, apologies, I missed that one. I'll reply in the thread.

          Mario
          Ah thanks! While the github bug reports & commenting work fine, the pull request button is greyed out for me unfortunately, so I have put it in the pastebin here:

          Just a few notes:

          1. I had some additional functions to change materials, copy material params, etc. But those involved heavy modifications to UpdateRenderer, which I'm afraid might break other spine features, so I did not include it.
          2. Normally UpdateMaterial would automatically reset any changes to the dynamic instance, so I had to disable the texture checks in that function. Unsure why those are needed, but they can always be disabled only if the Dev calls the "GetDynamicInstance" function first, so anyone who doesn't use it will be unaffected.

          I've seen a few unreal devs on here asking how to work with material instances, so if these don't cause an issue, would be a nice addition to the unreal spine. 🙂

          Awesome, I see if I can work this in without breaking existing code bases!

          I opened an issue here:
          EsotericSoftware/spine-runtimes2625

          The PR button is likely grayed out because you haven't created a fork (copy) of our repository on GitHub. The way things usually work:

          1. Fork the repository you want to contribute to
          2. Clone your fork to your local machine
          3. Make modifications to the source code, commit and push to your fork on GitHub with a standard Git client on your machine
          4. On the "front page" of your fork on GitHub, there should be a "Contribute" button. Click it to create a pull request containing your changes, which will show in the original repository you cloned (also called the upstream repository), so the maintainers can review and potentially merge your proposed changes.
          5. Occassionally, click the "Sync fork" button on the front page of your fork to pull in the latest changes from the repository you cloned

          If you want to be extra fancy, you can create a branch in your fork and make changes there which you submit. For small, one-off changes the workflow above is usually good enough.