Announcement

Collapse
No announcement yet.

Dynamic gravity for characters

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

    #46
    Originally posted by Kosrona View Post
    same here but where to Compile it? isnt for Version 4.8 right?
    Part of the code already been merged in 4.9 branch, and reset supposed be in 4.9 according to ZakMiddleton (https://github.com/EpicGames/UnrealEngine/pull/957).

    I've ported the code to 4.8, tested and all works fine. I can put them to github if anyone interested.
    | twitter | github | #ue4tip

    Comment


      #47
      Originally posted by Nate View Post
      Part of the code already been merged in 4.9 branch, and reset supposed be in 4.9 according to ZakMiddleton (https://github.com/EpicGames/UnrealEngine/pull/957).

      I've ported the code to 4.8, tested and all works fine. I can put them to github if anyone interested.


      I'm trying to use in 4.8, can you put on github? thanks
      Last edited by Mdavanzo; 07-28-2015, 01:28 PM. Reason: quote

      Comment


        #48
        1st post updated:
        This is a showcase of my code adaption of the standard CharacterMovementComponent from Epic Games. Once they're ready (UPDATE: they're ready), changes will be shared with everyone through GitHub (https://github.com/Xaklse) (if error 404: log in to Github, link your UE4 account to Github), which might be merged into UE4 by Epic (UPDATE: in progress). Code changes are based on an updated 4.7 version of the engine.



        Originally posted by QuantumRSN View Post
        Sorry if this is a noobish question, but how do I now use that updated code?
        At the moment I do a line trace from my character to the center of an object (in my case a sphere). I understand that I need to break the hit > get the normal > reverse it, but what do I do then? I've tried plugging that result into the Set Gravity Direction node but that's not giving the desired result. I read something about applying a rotation to the CapsuleComponent of the character?
        The code you quoted takes floor normal (if there is any) and changes gravity direction each frame, so it might ignore any use of the "Set Gravity Direction" node in blueprints.
        Ninja Character Code Plugin
        Visual Studio snippets for UE4
        ---------- ---------- ---------- ----------
        SonicGDK / Ashura: Dark Reign
        Heaven of Relics / Relic Madness

        Comment


          #49
          This is great, and very fitting music for the video haha
          Good job.
          Q.U.B.E. 2 | Q.U.B.E: Director's Cut

          Comment


            #50
            I try to update client to not fall, but with no result yet It seems gravity scale and rotation works but not movement direction Anyone can help me with this?

            Click image for larger version

Name:	local-client.png
Views:	1
Size:	102.4 KB
ID:	1084590

            I am very confused because on client there is 4x more code executing. It seems server run his own gravity code with different gravity direction. That's why even with no gravity client jitters.

            When I remove ReplicateMoveToServer gravity works fine, but I need replication so I am working on it. Right now it works OK but adding forces so my character is all shaking. Playable but I want to get rid of this mystical force and try to make simple replication. Any ideas?
            Last edited by Tefel; 08-28-2015, 06:42 AM.

            Comment


              #51
              Anyone has idea how to replicate moves?

              Comment


                #52
                This is great!!! Unreal must implement this!!! Hope we c an see the results by the end of the year

                Comment


                  #53
                  So, the update in the OP seems to suggest that this is being merged into the Core UE4 codebase. This sounds awesome! Any news on if/when this will be done?

                  Comment


                    #54
                    There isn't a solid timeframe, according to Epic.

                    Tefel, chech your PMs.
                    Ninja Character Code Plugin
                    Visual Studio snippets for UE4
                    ---------- ---------- ---------- ----------
                    SonicGDK / Ashura: Dark Reign
                    Heaven of Relics / Relic Madness

                    Comment


                      #55
                      I have no idea how to implement this into my build of UE4.
                      I've downloaded 4.7.6 source from github. I've changed the code.
                      When I build it gives me almost 100 errors.

                      If there's anyone who could lead me through the proces, explain like I was 2 year old child, how to do that, I'd be grateful... PM me maybe. Thanks.

                      Comment


                        #56
                        Originally posted by Mike Fricker View Post
                        Very cool project, Xaklse! We would love to see this reviewed and integrated at some point.

                        I'm curious how you decided to manage the various gravitational influencers. We had talked about this here in the past and thought that having functions like UWorld::GetGravityAt( const FVector& Location ) and a UWorld::GetUpVectorAt( const FVector& Location ) might be a good approach. Those functions would be optimized for a single fixed gravitational influence, but could also be implemented to support all sorts of influencers.

                        --Mike
                        I have some ideas for this.

                        First, we have to think big. As in planetary bodies. Gravity should be treated as a force vector, proportionate to a mass ratio of a physical body (such as earth). The amount of gravitational force applied to a body is something like an inverse square law of its distance from that object (I'm sure a good physics book has a precise equation). If you have two bodies which exert gravitational forces on an object (such as the Earth and Moon), then to find the gravitational force vector applied to an object, we'd have to go through all gravitational forces, figure out the gravitational force from distance X towards the center position of each body, and come up with a sum of gravitational forces vector. This force vector can then be applied as an acceleration force.

                        Optimization:
                        I think that this may get computationally expensive with a lot of gravitational bodies, especially if they're dynamic. I think that if you at least have a bunch of static gravitational bodies, you could go through chunks of 3D space and pre-generate a vector field which would suggest the sum of all gravitational forces at some position. The gravitational force applied could be determined by which cell you're occupying and then querying its gravitational vector, and then applying it to the bodies in that field.

                        The "up" vector is an interesting one. As far as cameras are concerned, I'd keep the game model up vector unchanged, regardless of gravity because it keeps rendering consistent. But the "up" vector which suggests an up orientation could be set to the normalized inverse of the gravitational force vector. Jumping would cause an impulse force on this vector (etc, etc).

                        Comment


                          #57
                          Late to the feast, but wow this looks incredible! Any pointers on where I can get my hands on the code and play around with it?
                          DonDon Busters!!

                          Dondon Discord

                          https://twitter.com/benjaminzeozen

                          Comment


                            #58
                            Hi, I've been adapting the xaklse code to the 4.9 version, I spent some hours on doing it (this is my first modification on the ue source code) and I want to share this adaptation with anyone who wants this feature (and, like me, cannot wait to epic to implements it).
                            I think there are some bugs, but it works well on my side scroller game. I will do some improvements on the next days

                            cpp: http://pastebin.com/sWz0T681
                            h: http://pastebin.com/SpXjGtvN

                            Also, really thanks to Xaklse for doing this, you saved me a lot of work
                            Last edited by Davixe; 09-12-2015, 07:33 AM.

                            Comment


                              #59
                              Originally posted by Davixe View Post
                              Hi, I've been adapting the xaklse code to the 4.9 version,
                              So, can I download 4.9 source from github and just replace the flies? Will that work? Didn't work with 4.7.6.

                              Comment


                                #60
                                Originally posted by Z-enzyme View Post
                                So, can I download 4.9 source from github and just replace the flies? Will that work? Didn't work with 4.7.6.
                                Yes, it should work, I just pull the 4.9 last thursday and only have modified that two files.

                                Comment

                                Working...
                                X