Announcement

Collapse
No announcement yet.

Trying to setup physics-enabled dragging. Running into some stumbling blocks

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Trying to setup physics-enabled dragging. Running into some stumbling blocks

    Hi everyone, I'm working on an entry for the Katamari Jam over at http://jams.gamejolt.io/katamariJam



    The next piece I want to implement is being able to drag stuff around with your noodley tentacles. My first thought was to use physics constraints to setup a connection between any physics-enabled actor in the scene and the skeletal mesh that I use for the octopus. I've been able to get it attached fine, but the performance doesn't really give me what I want. Despite whatever settings I set the constraint to have, I'm able to pull the pieces apart and twist the attached tentacle into a state where the physics doesn't seem to be able to resolve. It will just twitch in place endlessly. Another problem is that if I apply torque in such a way that the tentacle that's attached gets pulled under the body, then the whole mesh has a chance of being shot off into space. But the biggest problem is definitely being able to pull the tentacle off the surface really easily.

    What I'm looking for is to have the tentacle touch an object, have it attach to the object, and then by applying torque to the ball shape of the skeletal mesh I can then exert forces on the other actor. By sticking the tentacle to the surface, it should become fixed on the actor, so if I apply torque in the other direction but it's too heavy, it should prove impossible to move away with it.

    I've also tried a physics handle, but this seems to disable all weight on the attached actor, so it just flies through space with the tentacle's tip. Also the same problem occurs where rolling tentacles under the body will cause some serious problems with shooting the whole character off in one direction.

    I can try to provide more screenshots or video if anyone would find that more helpful. Anyone have any ideas for a better way to approach this problem? Thanks!
    @Brian__May

    #2
    I got to the bottom of the problems I was having with attachment using constraints.

    I was attaching things in the wrong order. Attaching the correct bone to the correct component according to the Hit event is critical. In my case, I was setting the constraint component to have the hit component as component 1, the hit bone as bone 1, and my component as component 2. This was backwards, you'll want component 1 to by my component, and component 2 to be hit component.

    The next thing I ran into was not placing the constraint in the correct place. When you use Add Physics Constraint Component, it will generate the constraint at 0,0,0. I called Set World Transform for the constraint and passed it the hit location and normal and it is giving me much better results.

    It seems like the final piece of the puzzle is a weird offset I'm getting after setting the constraint. I'm not sure how this distance is getting set, but it's locking the constraint to it:



    The red line there shows the distance between the bone constrained by this constraint component and the impact point. This point doesn't seem related to the location of the constraint, oddly. Anyone have any idea what this distance could be and how I can move it around?
    @Brian__May

    Comment


      #3
      hahaha, great work, it's really cute, why only 4 tentacles??

      Comment


        #4
        Originally posted by boysingh View Post
        hahaha, great work, it's really cute, why only 4 tentacles??
        Thanks! I'm really glad you like it.

        I could barely get 4 working, you want more than that? Maybe once I get dragging and flinging working, I can go back and make some revisions to the mesh :P
        @Brian__May

        Comment


          #5
          That is really cute. I think 4 tentacles is fine.

          Comment


            #6
            Sorry, I don't know how to help you, but your quatuorpus is the best thing I've seen in UE4 so far
            Good luck with jam!
            SuperGrid: Marketplace Page | Feedback Thread | Demo | Website
            Level design and prototyping for newbies

            Comment


              #7
              Originally posted by Shanthosa View Post
              Thanks! I'm really glad you like it.

              I could barely get 4 working, you want more than that? Maybe once I get dragging and flinging working, I can go back and make some revisions to the mesh :P
              Hahaha, nah, no problem about that, I was just wondering, because they usually have 8 tentacles, right? ahahaha, but yeah, it's a job well done..

              Comment


                #8
                Thanks boysing! I'm happy with how it's going. I'll have a new video tonight for my work in progress thread: https://forums.unrealengine.com/show...-Katamari-like
                @Brian__May

                Comment

                Working...
                X