Announcement

Collapse
No announcement yet.

Dynamic gravity for characters

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

    Originally posted by Xaklse View Post
    No idea, the NinjaCharacter must be using the NinjaCharacterMovementComponent, I just placed a NinjaCharacter in a simple level and everything is fine (UE4 12).

    My code is currently a child class for any game project, you don't have to recompile the engine.
    Hi. Do I still need to download the project from github? How do I get my hands on this good stuff?

    Comment


      Beta 5 is up with fixes for UE 4.13.1, check the first post for more details.
      Ninja Character Code Plugin
      Visual Studio snippets for UE4
      ---------- ---------- ---------- ----------
      SonicGDK / Ashura: Dark Reign
      Heaven of Relics / Relic Madness

      Comment


        [MENTION=4059]Xaklse[/MENTION]: First of all, thank you so much for this very generous contribution, I sincerely hope that this will get integrated into the engine.

        I am no newb at all here, but I can't seem to figure out the API for this thing. When I use UNinjaCharacterMovementComponent->SetGravityDirection(FVector(0.f, 0.f, 1.f)), my character just floats to the ceiling with no rotation, same as if I was to directly change the GravityScale float.

        What am I missing here?
        Once I figure this out, I'll be happy to help with a tutorial for newcomers to your plugin, if it has any interest.

        EDIT: What I was missing was the public settings on the UNinjaMovementComponent, specifically the flag "bAlignComponentToGravity". Makes total sense. Don't mind me
        Last edited by mrzapp; 10-27-2016, 05:46 AM.

        Comment


          Originally posted by mrzapp View Post
          EDIT: What I was missing was the public settings on the UNinjaMovementComponent, specifically the flag "bAlignComponentToGravity". Makes total sense. Don't mind me
          No problem mrzapp, I released something with no documentation after all, it's better to ask here so that other people have the chance to not miss the solutions. Thank you.
          Ninja Character Code Plugin
          Visual Studio snippets for UE4
          ---------- ---------- ---------- ----------
          SonicGDK / Ashura: Dark Reign
          Heaven of Relics / Relic Madness

          Comment


            [MENTION=4059]Xaklse[/MENTION] I've been following your work. I'm looking for a bit more info on the player controller orientation. When I use the Add Controller Pitch Input, the controller seems to only be aligned to the world and not my character (a spaceship). Does your code address that part? I don't really need the arbitrary gravity, but I do need to figure out a way to get around the controller's pitch being relative to the world and not the character. I've also seen the Arbitrary Orientation thing on Trello (backlogged to 2017). Is that supposed to fix the controller pitch being relative to the world? I appreciate any insight! It's kind of blocking my progress right now. Thanks!

            Comment


              HI!

              I've been working with your code but at the time I tested it with dedicated server and two clients, the Simulated Proxy didn't align to the surface. Is thath a know issue in your code? or maybe I broke something? If not any idea how can I replicate to a simulated proxy the character orientation?

              Comment


                Just want to inform that I couldn't build this in 4.14 and the error I get is that it tries to find "\Epic Games\4.14\Engine\Source\Runtime\Engine\Public\Net\PerfCountersHelpers.h" which is actually located "\Epic Games\4.14\Engine\Source\Runtime\PerfCounters\Public\PerfCountersHelpers.h"
                Always appreciate honesty. For good and bad. It is a rare thing in this world.

                Comment


                  So, I did everything, but I dont know hot to compile game project after adding "AIModule" to build.cs.

                  Thank you!

                  Comment


                    Originally posted by Tomislav0309 View Post
                    So, I did everything, but I dont know hot to compile game project after adding "AIModule" to build.cs.

                    Thank you!
                    For compiling the game you have to open with visual studio (or simply by dobule clicking) the .sln file that is on the root folder of your project, then u will see all the project files like on my image and u can compile it, the steps i followed where opening the solution with the .sln file and then modify all the needed archives that the readme tells to you and then go to compile, compile solution.

                    Click image for larger version

Name:	Oq7X8m1.png
Views:	1
Size:	11.4 KB
ID:	1119524

                    Comment


                      Originally posted by Groatse View Post
                      Hello there chaps, and thank you for this wonderful piece of code. It's been a blast to use so far.

                      I'm currently trying out a a first person project (I loaded the ShooterGame example on top of the 4.10 version by glazed), and I'm having troubles with the camera. Two separate troubles to be exact. I have tiny tiny planets that one can walk around - the code turns the capsules and my own overlap calculates a new gravity direction, but I run into troubles with setting ViewPitchMin/Max and ViewRollMin/Max. I just can't get my head around how to get them to recalculate based on gravity direction. The other trouble I have is with recentering the camera when I walk - what I mean by this is, as I walk forward on a tiny planet, I would like to see the horizon all the time instead of my view slowly climbing up.

                      Anyways, all ideas appreciated. Thanks again for the code, it's fun!
                      Did you ever get this figured out? I need dynamically oriented cameras for my first person project as well.
                      Website: http://www.NonLocalitySoftware.com
                      Facebook: www.facebook.com/NonLocalitySoftware
                      Twitter: https://twitter.com/NonLocality_Dev
                      Instagram: @nonlocalitysoftware
                      Discord: ASCII#1124

                      Comment


                        Originally posted by Ascendancy View Post
                        Did you ever get this figured out? I need dynamically oriented cameras for my first person project as well.
                        Unfortunately no. I stopped working on that project shortly after this comment and it's been a long while. I did find out where you can do it, but the solution escaped me at that moment so I fiddled with other stuff and just toggled pitch and yaw limits off allowing 360 free camera movement to test the game.

                        I'm not sure what kind of project you are working on, but in your playercameramanager class (I reckon you would be using one) there is a function called ProcessViewRotation with which you can use to limit your yaw and pitch according to calculations or rigid values. I think I tried it with getting player rotation in world space and calculating max yaw and pitch from that but it worked poorly. Not sure anymore though... The documentation for it is here ProcessViewRotation(). It returns a boolean based on your limit values and in the normal workflow that tells your camera if the view is updated or not by your mouse movements/whatever.. Due to the complex nature of my game and constant calculations I tried in this function, I think it failed to produce my needs because it is only a boolean and doesn't actually adjust the camera if the camera goes over the limits -> if you jump over your threshold your camera just gets stuck so you need to realign it in another function.

                        Comment


                          Hey, why is all of this source code down? Is there anyway you can share?

                          Originally posted by Xaklse View Post
                          NinjaCharacter subclass is up! Go to >> https://github.com/Xaklse/UnrealEngine << and grab the ZIP file (not the green button) from the link posted at the top part (if error 404: log in to Github, link your UE4 account to Github).
                          I see no harm if I share the code I have now, let me know what you think if you use this.
                          This is for vanilla Unreal Engine 4.12.2 and 4.13.1, you still need Visual Studio to compile your game project; detailed instructions are provided.

                          .

                          VERY OLD first post follows:





                          This is a showcase of my code adaption of the standard CharacterMovementComponent from Epic Games. Once they're ready (UPDATE: they're ready > https://github.com/EpicGames/UnrealEngine/pull/957), 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: progress aborted). Code changes are based on an updated 4.7 version of the engine.



                          I need help; the last function I modified is UCharacterMovementComponent::PhysicsRotation(), where you can read this:
                          Code:
                          	//YAW
                          	if( DesiredRotation.Yaw != CurrentRotation.Yaw )
                          	{
                          		NewRotation.Yaw = FMath::FixedTurn(CurrentRotation.Yaw, DesiredRotation.Yaw, DeltaRot.Yaw);
                          	}
                          
                          	// PITCH
                          	if( DesiredRotation.Pitch != CurrentRotation.Pitch )
                          	{
                          		NewRotation.Pitch = FMath::FixedTurn(CurrentRotation.Pitch, DesiredRotation.Pitch, DeltaRot.Pitch);
                          	}
                          
                          	// ROLL
                          	if( DesiredRotation.Roll != CurrentRotation.Roll )
                          	{
                          		NewRotation.Roll = FMath::FixedTurn(CurrentRotation.Roll, DesiredRotation.Roll, DeltaRot.Roll);
                          	}
                          It calculates the interpolation between the current rotator and the desired rotator by using each component of RotationRate (DeltaRot = RotationRate * DeltaTime). This is incompatible with arbitrary capsule orientations, the DeltaRot.Yaw should only affect the local horizontal orientation of the capsule.

                          How would you fix this problem? Any idea? I already had some and attempted to implement them, but they weren't correct.

                          Comment


                            I couldn't get this to work. Can I get some help?
                            I followed the steps and promoted the character to a blueprint character and I cant even move. I made sure that the axis mapping was the same as on the code.

                            Comment


                              Hi all. Just wondering, are there still plans to eventually integrate this into the engine? (And will this ever be accessible 100% through blueprints?)

                              Thanks!

                              Comment


                                Hello [MENTION=4059]Xaklse[/MENTION] just wondering if you had experimented or came across any solutions for navigation and ai was thinking on the custom geometry that has the gravity class of covering with hexagons and then using each as a flat plane to NavMesh over but navmesh only works in z up so thats out and this seems exhaustive or if even possible. The other is a custom path finding using A* for the surface of the sphere but id have to look into that and would not have a clue where to start so basically looking to see if any one else has any ideas?

                                TLDR:
                                AI on single sphere only think meteor more than world
                                Last edited by Smartay; 02-22-2017, 03:24 PM.

                                Comment

                                Working...
                                X