Announcement

Collapse
No announcement yet.

Dynamic gravity for characters

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

  • replied
    I took the liberty to answer you HERE, let's leave this forum thread for 0.9.3 upgrade issues, please.

    Leave a comment:


  • replied
    Hi Xaklse

    I had to make a local change to get smooth movement on the player for our project. Using a (quite big) spherical world seems to make the delta between old-new gravity directions too big to get a smooth transition .

    Therefor I had to disable the return statement in ninjacharacter.cpp (which sets the control rotation).

    Also added a rotator lerp in the movementcomponent (that still has the return statement a few lines prior).

    Do you think this will have a huge impact on performance eventually? If so, what would you recommend to smoothen out the (rotational)movement? Using camera lag smoothens it out a little, but not entirely (and we rather don't have much lag on the camera)


    NinjaCharacter.cpp line 223:

    Code:
    if ((LastAxisZ | NewAxisZ) >= THRESH_NORMALS_ARE_PARALLEL)
    {
         //return;
    }
    NinjaCharacterMovementComponent.cpp line 5380:

    Code:
    // Abort if angle between new and old capsule 'up' axes almost equals to 0 degrees
    if ((DesiredCapsuleUp | CurrentCapsuleUp) >= THRESH_NORMALS_ARE_PARALLEL)
    {
         return;
    }
    
    //// Take desired Z rotation axis of capsule, try to keep current X rotation axis of capsule
    const FRotator NewRotation = FNinjaMath::MakeFromZQuat(DesiredCapsuleUp,
    UpdatedComponent->GetComponentQuat()).Rotator();
    const FRotator CurrentRotation = FNinjaMath::MakeFromZQuat(CurrentCapsuleUp,
    UpdatedComponent->GetComponentQuat()).Rotator();
    
    if (!bRotateAroundCenter)
    {
         float PawnRadius, PawnHalfHeight;
         CharacterOwner->GetCapsuleComponent()->GetScaledCapsuleSize(PawnRadius, PawnHalfHeight);
    
         // Rotate capsule around the origin of the bottom sphere
         const float SphereHeight = PawnHalfHeight - PawnRadius;
         const FVector Delta = CurrentCapsuleUp * (SphereHeight * -1.0f) + DesiredCapsuleUp * SphereHeight;
    
         FRotator RotationLerp = UKismetMathLibrary::RInterpTo(CurrentRotation, NewRotation, GetWorld()->GetDeltaSeconds(), 4.0f);
    
         // Not using MoveUpdatedComponent to bypass constraints
         UpdatedComponent->MoveComponent(Delta, RotationLerp, true);
    }

    nonetheless, nice work on the update!! Especially the new debug options are really useful!

    Leave a comment:


  • replied
    The only new function difference had to do with rootmotion, which we dont use

    I replaced 2 if statements in movmementcomponent using this bool function:

    if (!HasAnimRootMotion() && !HasOverrideVelocityWithIgnoreZAccumulate())

    to:

    if (!HasAnimRootMotion() && !CurrentRootMotion.HasOverrideVelocity())

    seems to work fine on 4.24 now, thanks!!

    cheers
    Frank

    Leave a comment:


  • replied
    If the engine upgrade is impossible or undesired, let me know.

    Leave a comment:


  • replied
    thanks for your reply!

    we're still on .24.3

    Leave a comment:


  • replied
    Yup, I fixed the multiplayer camera bug I recorded in the video I posted, I think most of the related code went into the NinjaCharacter class.

    New "hidden" features that I can remember include:
    • Added more blueprint events.
    • Added cheats to draw in-world debug information.
    • Allow capsule rotation from bottom sphere as pivot (while walking mainly) (bRotateAroundCenter).
    • Allow to keep speed magnitude when the capsule rotates (bRotateVelocity).
    • Added check for gravity direction to know if the surface is walkable when landing (bLandOnAnySurface).
    But new critical multiplayer bugs were noticed after upgrading from 4.22 (moving bases broken, location desyncs), keep that in mind.
    What's the engine version you're using?

    Leave a comment:


  • replied
    Hi Xaklse

    was wondering about the new features and possible bug fixes (that multiplayer bug you mentioned before)?

    Our project is using an older engine version, so contemplating to upgrade the project or not. Could you please elaborate

    thank you!

    Leave a comment:


  • replied
    New version of the code plugin has been released HERE, compatible with UE 4.25 and includes more features.

    If you're upgrading from plugin 0.9.3, stuff might be broken, since some names were changed.

    Leave a comment:


  • replied
    Originally posted by sollaholla View Post
    Hello, I seem to be experiencing issues when using the plugin. I'm using Unreal 4.21.2 (vanilla), and 0.9.3 of your plugin.
    The issue seems to only occur on remote clients standing on movable objects with a rotation > 0,0,0. The problem however does not occur on the Listen server screen (each client is rotating/moving appropriately).
    I haven't noticed this reply until now, sorry. There are issues with rotating bases in online mode, you didn't do anything wrong, I'll take a look for sure.

    .
    Originally posted by Faptdivers View Post
    Any chance you could update this for 4.25? I've been trying to get it up and running for a few days now but there are a lot of errors when compiling via the "
    RunUAT BuildPlugin" command.
    I have a compatible version for 4.25, but there is no ETA sorry (2020).

    Leave a comment:


  • replied
    404 error for me as well with UE connected to github

    Edit: For those who have this problem after me, who also have little or no github experience like me -

    The "Epic Games" Team from Github will send you an invite to join the Team, this will allow you access.
    I believe the process is automatic, but the invite did not appear prominently for me until I followed a completely unrelated link to another UE Git repository, got the same error, then googled the team and went to https://github.com/EpicGames where the invitation was in a bar at the top of the screen.

    This now works.

    Last edited by 2_D_e_v_o_t_e_d; 09-07-2020, 04:48 PM.

    Leave a comment:


  • replied
    Hi!

    Any chance you could update this for 4.25? I've been trying to get it up and running for a few days now but there are a lot of errors when compiling via the "
    RunUAT BuildPlugin" command.

    Leave a comment:


  • replied
    Hello, I seem to be experiencing issues when using the plugin. I'm using Unreal 4.21.2 (vanilla), and 0.9.3 of your plugin.

    The issue seems to only occur on remote clients standing on movable objects with a rotation > 0,0,0. The problem however does not occur on the Listen server screen (each client is rotating/moving appropriately).

    I wonder if I'm missing something? This is a fresh project with your plugin and TP Content installed.

    If it helps at all, I'm noticing that the root Actor seems to be moving appropriately; it's only the actors skeletal mesh component that is jittering all over the place (also the transform of the skeletal mesh is showing X/Y/Z values going all over the place).

    Let me know if I can provide any further information. Video below:



    Thanks!

    Leave a comment:


  • replied
    Hello, zaguarman how do you ask for developper group ? I cannot access the files, 404 error for me too, so can you tell me where to ask ? I would really love to get this plugin and start tweaking and modifying it ! It look awesome Xaklse ! Thanks a lot for sharing this wonderfull work, really !

    Leave a comment:


  • replied
    Thank you Frank, the fixes are valid and should help others work.

    Leave a comment:


  • replied
    for whoever is using 4.24, a quick fix below:

    CharacterMovementComponent.h
    line 1728:

    Code:
    virtual void VisualizeMovement() const;
    change to:

    Code:
    virtual float VisualizeMovement() const;
    NinjaCharacterMovementComponent.cpp

    line 3421:

    Code:
    void UNinjaCharacterMovementComponent::VisualizeMovement() const
    {
    if (CharacterOwner == nullptr)
    {
    return;
    }
    change to:

    Code:
    float UNinjaCharacterMovementComponent::VisualizeMovement() const
    {
    if (CharacterOwner == nullptr)
    {
    return 0.0f;
    }
    add a return below line 3505:

    Code:
    #endif // !(UE_BUILD_SHIPPING || UE_BUILD_TEST)
    return HeightOffset;
    }

    cheers
    Frank

    Leave a comment:

Working...
X