Ninja Character - Dynamic gravity for characters & objects

Does the ninja get stuck on 45deg ramps too?
Also make sure that touch controls generate a proper movement direction.

UE5 “has relative gravity now”? I haven’t found anything of this.

I checked with the default joystick and it works! looks like I need to get a fix for the joystick im using

This sure looks like it to me: virtual float GetGravityZ() const override;

Header and Source. You can find it in-use in the CharacterMovementComponent - search for GetGravityZ().

That function was there eons ago (since 4.00 probably).

Ah, okay. It seemed like something easy enough to override to get relative gravity, but whatever, you’ve touched that part more than me.

GetGravityZ() is the scale of gravity locked to the z-axis, but when gravity is changed like in the case of Ninja Character the relative Z axis or up vector doesn’t need to be (0,0,1) or (0,0,-1). long story short GetGravityZ is the world Z axis not the character’s local Z axis.

Yeah, we actually managed to make it work by commenting out the matinee code and patching one or two things. So, for now it will work but would be amazing if you update it properly :slight_smile:

1 Like

does the plugin have problems with meshes with complex collisions? I am trying to get the character to walk on a mesh without falling off, and it seems to work on the cube with the trigger box on it, but when I add a mesh and try to walk on it without falling off, it acts weird

when make the collision for the mesh a simple box collision it works. but with complex it acts weird

how can we get it to work with complex meshes?

Hey has anyone figured out how to the camera to rotate properly when the character is upside down or standing on a 90 degree angled wall? My camera seems to rotate to the World axis so when I am standing on a wall and attempt to look up or down the camera moves left/right in relation to my character and vice versa.

I reproduced the issue; bad news, unfortunately obtaining the closest point on complex collision is unsupported by the physics engine.
Message warning is: “Component (“x”) has no simple collision and cannot be queried for closest point”. I don’t think I can find a solution with good performance, if any.

Did you replace the PlayerCameraManager?

Xakise if the engine was modified it would work? Is this something that can be done with someone with c++ knowledge? or this is just hard codeded and cant be fixed?I guess I could made simple collisions out of things, so its not that bad of news! But let me know if you think its possible to fix if the engine source was changed. I will ask around the discords and forums and see if someone might have a solution.

No. I honestly am not sure how to change the camera manager.

Disregard previous message. I figured out and now things work perfectly. Thank you so much!

Both PhysX and Chaos implementations deliberately choose to not calculate the closest point on non-convex shapes, the reason could be performance, or impossibility of calculation.
Someone with C++ knowledge could try to improve that, but it would be a tough task.

I think I found a solution but its weird, its only works like this, but it keeps like sliding down and its not standing straight. how can I make it walk like this standing straight without them sliding down? why is the character always sliding down and falling?

@cosmicaffairs hey man, on UE5, what did you replace IsMatineeControlled() with,
i couldn’t figure it out

@Xaklse hey man how are you doing,
i patched Ninja plugin for UE5, i added it to UE5 compiled, showed errors
i patched those errors, and it seems to be working fine,
there’s just one correction i’m not confident about, in Ninja movement component,
there’s a if statement:
CharacterOwner->IsMatineeControlled()
this doesn’t exist in the Actor class anymore, i changed it to
!CharacterOwner->IsNotLocalyControlled()
im not sure about this, what should i put there instead ?
thank you.

Hi there, sorry for a bit of a delay here.

As far as I can remember we basically commented out the matinee code that did not want to compile. Not sure about that function specifically. I will see on Monday if others in the team can answer me.