Hi, I was just wondering if there was a way to enable/disable the gravity effect midgame using Blueprints?
What I’m wanting to do is make it so the effect only works after reaching a certain speed.
Thanks!
I’m really impressed with your Ninja!!
But your Ninja changes his own gravity direction only when his sole hit the surface, isn’t he? I want to shift this function to when anywhere hit.
(Ex, when Capsule Component hit the surface, he changes his own gravity.)
That’s why I want to know what function of Character Movement (or other BP or C++) makes NinjaPlayerCharacter change its own gravity direction?
I’m trying to create Ninja FPS with your plugin but I’m noob and just started. So I need your some advice.
Yup, it seems you want to replace all calls to MakeFromZQuat with your own function. My function almost always rely on FQuat::FindBetweenNormals, you have to think on a complete replacement, choosing the axes you want to preserve. Try using cross products between normalized axes, like I did in my function when not using FQuat::FindBetweenNormals.
Yeah, you should be able to turn on/off gravity-related stuff through blueprints. Let me know if you can’t manipulate something.
Thanks. You can use the “Change Char Axis” blueprint node to rotate the collision capsule and force-walk unwalkable surfaces. Go up.
The optional bAlignX booleans determine in C++ how gravity direction and capsule orientation are modified.
Thanks for responding!
My issue is that I haven’t been able to change ninja related bool values on my character controller, despite the component being set to the NinjaCharacterMovementComponent class.
Is there something I’m doing wrong?
you have to cast the character movement to ninja character movement, if you want to edit the c++ so the character movement is casted to ninja character movement at blueprint construction then follow the video in this post Ninja Character - Dynamic gravity for characters & objects - #126 by err0s
Oh thank you! That helped a lot!
I’m still new to Unreal so I wasn’t sure what the cast function did lol.
this is great, I just started trying to do something similar but with the Lyra project (combined with the Ninja plug-in). Are you lerp-ing the camera location and rotation to smooth it out? I’ve figured out how to do that, but trying to isolate when the camera’s jumping/skipping due to mesh/gravity issues vs. the character just moving their mouse/controller around.
I have a planet with point gravity, so the gravity isn’t really changing every tick. I just don’t have the highest poly sphere so it stutters. Anyway, I’m trying to make it work modifying GetCameraView within the Camera component. I’m curious if this is the right direction.
thx!
Thank you for your answer!
Thanks to Your Suggestion, the character can move the vertical wall and more when they are on landed. But my final goal of Character movement is Changing gravity direction Even if they are in the air (is falling). I want to let them jump on the vertical surface.(and when they are falling and hit the wall, they land on the wall.)
I’m thinking how to add this function but please give me some your ideas.
Best regards
does the code that Xaklse wrote not work for point gravity? I think you just need to turn off the make actor up vector match the face normal, and while that means your character’s up vector won’t match the surface of the planet at every point. It will always be parallel with the ray from the center of the planet to the player, then you can do a linecast below the player to retrieve the surface normal and rotate the player’s mesh to match that.
To the camera question, I did not write the modifying code in the camera component.
Thanks for the reply @err0s.
With point gravity, with both settings of “actor up vector matching face normal” I still get camera stuttering since my planet only has 2,333 verts. I’m using Lyra so don’t currently have a camera boom to add any lag. Lyra has the camera relatively “Fixed” to the capsule so I believe my solution is adding some smoothing in there.
These are the settings I have with the smooth camera turned off (so it’s using the original Ninja Character code), I get struttering when I jump and at the start of my character’s movement but the planet is also 1,920 tris or 2,269 verts and this size next to the ue4 mannequin
I made it a bit bigger and set the camera spring arm rotation lag to 15 and got less but still a noticeable amount of lag.
so I guess it will depend on how big the planet is as and you might honestly be able to double the face count using subdivide in blender and make the struttering almost non-existant as 5K verts really isn’t a lot in the grand scheme of things unless you did something like me where you tied the pickup spawner to the number of mesh faces and the ai pathfinding to the mesh as well. In that case I would advise not following what I’ve done as it’s a major headache. (I’m still in the process of working out the edge cases and I’ve been doing this project off and on for like 2 years)
You could just use Volumes that change gravity direction when a Character overlaps it, similar to the Projectiles found in Example Map.
I would try to use a point gravity Volume and “Align Component to Gravity” if possible (instead of using floor normal as capsule direction and gravity direction), and decrease the value of “Threshold Parallel Angle” to improve smoothness.
I didn’t make the volume visible but there’s a sphere collider with the set point gravity on the sphere in the pictures above, and are you talking about ‘align gravity to base’ as I turned off the floor option and landing on any surface, and I’ll try lowering the parallel angle threshold.
With Xaklse’s suggestions I came up with these settings
that should cover smooth rotation on your planet, if you still get a little stuttering (on beginning to move) lower the ‘Threshold Parallel Angle’ a little more than 0.4
(edit): I noticed that those settings work fine on 60 fps, but when switching to 144 fps there is a little stutter again so you might have to detect the user’s fps and change the Threshold Parallel Angle accordingly.
It is almost done !
Thank you for your suggestion! Because of “Set movement mode”, My character can jump on the wall and stand.
But ,only this, his movement is unstable because he always turn around when hit the wall.
So I want to let him permit Wallrunning when the action key is input. Next is my idea.
In my idea, “Can Wall Run” boolean are changed by “Input action WallRun”(mine is Q-key press).
But this case can not stop wallrunning. Whether “Can Wall Run” is true or false, he always wallrun.
I need the new way instead of mine.
Hello my dear lords and ladys, i have a quick question.
I use a 8 Way Directional Movement System with my Character.
My Problem: On Walls the axis Change and the 8 Way Blendspace kinda inverts. Its because the normal Axis XYZ are not turned with my character then i move on walls.
Solution: I tried the nodes change the char axis and set fixed gravity direction.
and test them with Box Trigger Events. Sadly with no success.
Maybe you can help me out. I think i am close to the Solution, but need a hint
Hello hello, i found another solution that works out fine, even with Root Motion.
I trigger my 8 Way Movement with a Key System and Anim Montages, so there is no need for Axis anymore.
Works out pretty well and looks nice with root motion.
Case closed. Peace