Set "Angular Rotation Offset" through BP

Hi,

Quick question (I think): Is it possible to set “Angular Rotation Offset” through a ‘Set’ node in a BP? I can find the “Set Angular Swing 1Limit”, “Set Angular Swing 2Limit”, and “Set Angular Twist Limit”, but it seems there is no node available for the Angular Rotation Offset.

…or is there a creative name for this that I can’t seem to find?

:slight_smile:

bump… does anyone have an idea if this is possible?

Sorry to bump this again… but I really need this to avoid have a gazillion copies of the BP in the project. Any ideas?

So, my best guess is that this parameter is not accessible through any node. Now how would I go about requesting the developers to add it in one of the next releases?

Apologize for the Necro on this but I need this exposed to blueprint as well and have some code changes to provide to expose Angular Rotation Offset in Blueprint for anyone who comes across this looking for a solution.

So here it is:

ConstraintInstance.h start at line 361


    /** Sets the Angular Rotation Offset
    *    @param AngularRotationOffset New offset
    */
    void SetAngularRotationOffset(const FRotator InAngularRotationOffset)
    {
        ProfileInstance.AngularRotationOffset = InAngularRotationOffset;
        UpdateAngularRotationOffset();
    }

PhysicsConstraintComponent.h start at line 265


    /** Sets the Angular Twist Motion Type
    *    @param AngularRotationOffset New Offset
    */
    UFUNCTION(BlueprintCallable, Category = "Physics|Components|PhysicsConstraint")
    void SetAngularRotationOffset(const FRotator AngularRotationOffset);

PhysicsConstraintComponent.cpp start at line 654


void UPhysicsConstraintComponent::SetAngularRotationOffset(const FRotator AngularRotationOffset)
{
    ConstraintInstance.SetAngularRotationOffset(AngularRotationOffset);
}

Still not exposed by default?

No… my understand is that it’s not possible to expose it by default for some structural reasons (it would have too much of an impact on performance)

I figured out a workaround how to effectively change the offset at runtime, which allows me to switch door directions or make them swing either in a single or both directions:


Image: Two instances of the same Blueprint, the one on the right has no offset and will swing both ways, while the one on the left is only allowed to swing in one direction.
Essential for me was to have the mesh remain at the same location so the Blueprint can be easily used as a drag&drop component for artists to place into other Actors and be able to reliably tell how the movement will behave.

The workaround is to apply an offset to the relative rotation of the mesh before constraining it, then reset that offset.

What is that performance assumption based on?

2 Likes

hi ChipmunkCraft! This thread is very old but I’m curious how you managed to expose the AngularRotationOffset value. When I add these codes to their files I still can’t seem to expose the AngularRotationOffset via blueprint… Does the node maybe have a weird name I can’t find?

Had the exact same problem. This solved it. Thanks for sharing. Have to say that this operation is to made not in the construction script otherwise it won’t work.

@Warner_V please set the solution from @Cpt.Trips as solution

This thread is so old it doesn’t have the solution button yet… but it seems you’re right: it does appear to work!

Create a derived class from the UPhysicsConstraintComponent
Add this in the public section of your .h file

UFUNCTION(BlueprintCallable, Category = "Physics|Components|PhysicsConstraint")
void SetAngularRotationOffset(const FRotator AngularRotationOffset);

UFUNCTION(BlueprintCallable, Category = "Physics|Components|PhysicsConstraint")
FRotator GetAngularRotationOffset();

Add this in your .cpp file

void UMyPhysicsConstraintComponent::SetAngularRotationOffset(const FRotator AngularRotationOffset)
{
	ConstraintInstance.AngularRotationOffset = AngularRotationOffset;
}

FRotator UMyPhysicsConstraintComponent::GetAngularRotationOffset()
{
	return ConstraintInstance.AngularRotationOffset;
}

2 Likes