Ninja Character - Dynamic gravity for characters & objects

Screenshot 2021-08-10 190235
look for this setting after clicking on ninja character movement, will be in the details panel. Easiest way is to type “capsule” in the search bar of the details panel.

Then I think you don’t need to manipulate the gravity direction for the character, just attach it to the wall with the (new) “Change Char Axis” node, the character will fall the way you want if it jumps or doesn’t find a floor to walk with the bottom collision sphere.

Thank for the reply !
Unfortunately, whenever I try to use the “Change Char Axis” node, my Unreal Editor crash :smiley:

That’s intriguing… it would be good if you could provide more info, send me a private message if you’re willing to get it fixed.

First, thanks for the plugin. I’m really enthusiastic about using this in my project. I’m running into a small problem when trying to access the gravity settings (Align To Floor, Align To Base) in the movement component from a collision event (in Blueprint). These variables are only accessible via the (inherited) NinjaMovememtComponent and no matter how I try to cast, I keep getting an error that the component is not ‘inherited from’ or ‘incompatible with’ whatever I plug in to the Object node. Apologies if this is a dumb question but how do I get access to and alter these booleans from another Actor BP?
Thanks,

Check the example map, it has buttons there.

For those who didn’t notice yet, the plugin is already compatible with UE 4.27.

Thanks! I overlooked that part.

hey there, incredible work on the plugin - I soon realised the limitations of rotating characters when adding a skateboarding feature and found my way to this plugin. any chance I could get a little help on how to set up ‘tank control’ rotation when the character is no longer in normal orientation? you can see in the attached video the problem and the blueprint code at the end. I realise I cannot simply rotate the actor on the Z axis - if I do, you can see jitter as Align Component to Floor fights with the new rotation which is not offset to the characters orientation.

All I want to do is rotate the character left and right with the A and D keys, relative to the actors current orientation. I’m not experienced with vectors and rotations, I tried to figure out how to obtain the current orientation and rotate about that, but I haven’t had any luck yet. I’ll keep trying but if there is a simple solution to this that I’ve missed I would love to hear it.

Thanks!

The “Add Controller Yaw Input” blueprint node should work, also use the “p.ShowControlRotation 1” cheat to make sure the ControlRotation changes with slopes.

using the p.ShowControlRotation 1 cheat does indeed show that the characters orientation has updated correctly on the slopes, the drawn axis align with the character properly

something I should have mentioned is that I want the ability to use the mouse to control the camera at all times, so using Add Controller Yaw Input only rotates the camera left and right with my current configuration

ultimately it appears I am battling two limitations of unreal engine. One of which you have solved (arbitrary orientation of character), and the other is the coupling of Control Rotation and character movement component and the control of the camera

before I realised the first problem and found this plugin, I wrote my own handling of X and Y mouse axis on tick to set the camera boom rotation to ‘bypass’ this entirely and have the ability to control the character like the third person template, and seamlessly switch to ‘tank controls’ retaining the camera control. although I then miss out on several rotation related features of the character movement component such as rotation speed, and instead need to handle this myself via interpolation, etc., and once the character was on a slope the camera controls would no longer align with the horizon

it seems like the only way I can get this to work the way I want is to obtain the current orientation of the character and rotate around that

I appreciate this is a very specific use case for the plugin, though I feel if it is possible to rotate the actor around its current orientation this could be valuable to others too

so far I have removed this feature from my project due to the complexity and my lack of experience, but I would love to revisit it in future. I knew there must have been a reason for a lack of skateboarding games on unreal engine which include transition skating!

I appreciate the support

Hey there, first off, this seems like a much better thought out and designed gravity product than all others I have looked at since it uses the UE4 character. But, anyways, that aside. I have a question.

I am looking to create something where the walls of a room are all walkable on, yet the center is zero gravity. If the player jumps, and floats upwards, once reaching the oposite side, should flip around so feet are facing the “floor” or roof in this case. I have tried to figure out how to do this, but can’t. I’ve also tried to just have simply zones of no gravity, and zones with gravity, but only seem to get one or the other. Any suggestions? Thanks.

EDIT: I’ll reword this a bit. So, it’s a space scenario. Walking on a surface with magnetic boots. you can jump and land on the surface again if they are activated. If deactivated, you jump and will enter zero gravity until you reach the other side, where you will flip over to the right side. My problem is that going from gravity to zero gravity flips the character upside down instantly now. And it’s not a very clean way to do this I don’t think from what i gather. Is there a good way to allow such a thing to happen, thanks again

Instead of using the “SetActorRotation” blueprint node, did you try to use the “AddActorLocalRotation” node to change character yaw rotation? It works for me with every orientation.

Open my example map, open my character blueprint, select the “Character Movement” component, set “Gravity Scale” to 0.001, check “Align Gravity to Base”, compile blueprint, play the map, walk on a wall and jump. Is that what you want to do?
If you hit a planet with your head and want to stick to it, take a look to “unwalkable hit”, and “Change Char Axis” blueprint node.

perfect - I wasn’t aware of this node, you can see the working result below

huge thanks, I appreciate it, plenty of work left to do but seems to work great so far!

Hey Xaklse, amazing work with this plugin. Huge props for putting this out to the community.

So I’ve taken some time to implement this into my project, and so far it’s looking great. The only problem I’ve been trying to solve is the capsule snapping that occurs from surface to surface. Camera/spring arm lag settings were not satisfactory in solving this, so what I’ve done to smooth this out visually is set the mesh to absolute rotation and have it interpolate to the capsule’s rotation, then attach the camera/spring arm to the mesh.

This works well, except it interferes with the base character movement components network smoothing. Somewhere in the client network smoothing code is still referencing the skeletal mesh with relative rotation instead of absolute, which causes clients (only from other clients or server’s POV) to stay stuck facing a fixed direction. Assumably because it’s trying to keep the “relative” rotation of the mesh a constant fixed value in relation to the capsule, but because the mesh is now relative to the world it just forces a fixed rotation.

Disabling network smoothing prevents this issue, but obviously I’d like to keep it enabled if possible. I was just wondering if you have any insights on this issue, since it’s pretty difficult trying to pinpoint all the network smoothing rotation references between the base movement component and this plugin. Or maybe there’s a better solution to smoothing out the surface snapping without using absolute rotation?

Thanks for all the hard work on this. If this has already been discussed here let me know, I’ll look at the posts. I wasn’t able to find anything specific to this.

You’re welcome.
Epic’s network mesh smoothing code isn’t compatible with online NinjaCharacters and can’t be adapted.
Two ways to “fix” this: roll out your own solution with C++ or blueprints; or use my “Smooth Component …” blueprint nodes (all of them use absolute location/rotation). Check the NinjaDumbCharacter05_BP blueprint graph for an example.

Hi Xaklse! Thank you for your awesome plugin. I only have a single Question. How can my Ninja Character walk up hard edges with 90°+ ? Smooth angle changes are no problem but how can I put the character on every surface without jumping? I try to make a Spider game in UE 4.27.

There is an issue with the way input / acceleration is applied.

At 0,0,1 there is a very low angular distance between the capsule rotation and acceleration but the farther you rotate away from 0,0,1 the higher the angular distance between the capsule rotation and acceleration.

UpdatedComponent->GetComponentQuat().AngularDistance(Acceleration.ToOrientationQuat());

This messes with the logic required to achieve ‘turn in a circle’ movement similar to Mario Odyssey or BOTW as it requires comparing the two as so:

const float AccelDiff = FRotator::NormalizeAxis(FMath::RadiansToDegrees(FMath::Acos(Direction | Acceleration.GetSafeNormal())));

Hi XakIse! Thanks for an awesome plugin. Can you help me with a problem, please. I’m doing TDS on a
small Planet. I have an issue with rotating my mesh to look at mouse position. It works fine only on top of the sphere, but as I move to the bottom it starts to look in oposite direction.