// Abort if angle between new and old capsule 'up' axis almost equals to 0 degrees.
if ((DesiredCapsuleUp | CurrentCapsuleUp) >= THRESH_NORMALS_ARE_PARALLEL)
{
return;
}
When I disable that check, the character (capsule) rotation looks smooth. I’m not sure if I can simply disable that check though, might impacts performance? (see no hit in my current test level, but not sure about replication and multiple active characters)
Interesting finding. It would impact performance yeah, I will look into lowering the 1 degree change requirement and/or make it configurable.
I assume you still experience gimbal lock, right?
Yeah gimbal lock remains. Did a quick debug, but need to investigate a bit further. I also read about the native yaw/pitch funcions causing locks for people making 360dof controls. I think they just do a rotation.x+=, and dont use quaternions to add rotation. Which is destined to cause gimbal locks. Was planning on looking into that first, and maybe override the add control yaw/pitch functions to add rotation according to the component rotation.
I tried adding override functions for the addinput yaw and pitch (from pawn.cpp). I used the forward vector of the movement component to make those relative, however that didn’t seem to fix it.
makes the controller rotation match the gravity (movement component), and stops the gimbal lock. However, because of using the transform to make the rotations relative, enabling the option Orient Rotation to Movement doesn’t work correct anymore. So unfortunately it still might not be the correct approach… Any ideas to get those rotations relative using something else than the transform?
Hey , thanks for awesome work! Have been playing around with the plugin for a few days now, and noticed one strange thing: character’s velocity gets smaller for some little amount each time he steps on sloped surface. Felt it myself with walk speed cranked up to huge amounts, then tested with blueprint which compared current and previous velocity values, and current<previous happened exactly the moment character changed angle he stands on. Is intended behaviour? If it is, can effect be somehow cancelled out, so character remains constantly accelerating? Hope I explained the problem clearly
Edit: Did more testing with bare NinjaCharacter_BP by just tweaking CharacterMovement parametres, found out that oddity is especially noticable with high MaxWalkSpeed and low MaxAcceleration. For example I set those two to 3000 and 512 respectively, ran into the loop on NinjaTestMap at max (ie 3000) velocity, after that quickly slowed down to something around 1770 and stayed like that as long as character continued making circles. I use vectorlength of GetVelocity to measure current speed.
Edit2: After more researching I came to conclusion that the reason may be some component of velocity being lost during angle change, same as you land after jumping/falling (for example if you landed on flat 0deg surface then Z part of fall velocity will be ignored). Tried forcing the character to maintain same speed when stepping on slope, but no luck.
Edit3: Nevermind the previous blueprint, here’s one that works. VHorizonAngle is an impact normal vector from CurrentFloor component. product (ie cos) between its current and previous values pretty much determines amount of speed being lost during angle change, which can be cancelled out very easily.
Hi,
I have everything working great, but I was just wondering if anyone has any suggestions on matching up gravity for other physics actors? I am fairly new to the engine so it might be a basic thing I am missing. Most of the solutions I have found have been pretty cheesy.
It’s ok Frank, feel free to post your version of the updated code; I just downloaded 4.20 and will update the code one of these coming days.
Unfortunately for you Xenomatic, last time I checked, having custom gravity for physics actors requires changes in the engine, which were already posted on GitHub for old versions of the engine.
Thanks for the feedback STourist, will review that example in detail.
For other actors you could set gravity to 0, and add a constant linear force in the same direction your gravity points. It’s not the cheapest way, but if you tweak it so it’ll only trigger in a close range around the player i think you’ll be fine.
I’ll try upload my 4.20 changes tomorrow
just overwrite the existing files and you should be good to go (only 4 are updated, so keep the rest of the previous files in place)
Please note that there’s currently a bug in 4.20 which causes intellisense to fail to include your header files. Resulting in a ton of compiling errors!
What a surprise present from Epic… broken Intellisense. Thanks for the info Frank!
Ninja Character plugin for Unreal Engine 4.20.2 is up! Go to >>UnrealEngine · GitHub<< 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 just uploaded a new version with very minor code changes and an important change to fix non-Editor compilations.
I also added explanations about the input settings you need to test the sample content.
Thanks for the update !
a couple posts back you mentioned a replication bug. I was wondering what bug exactly, since I’m planning to add multiplayer to my project soon. Doesn’t it work at all, or just some minor things?
Sorry for the big delay Frank.
A problem with ControlRotation happens to me with the “Run Dedicated Server” checkbox enabled:
…com/=O-wNtOn_X7c
(RGB is XYZ of ControlRotation)
The rotation is not right after changing between floor angles with big or very small differences.
behaviour has changed for the better after upgrading to 4.20, the camera was also borked.
.
Could you please elaborate a little more or show us a video?