Hi there, folks!
I’ve been enjoying a lot te course, although I already know and work with Unreal. Knowing some things about blueprints, I wanted to present some insights about the problem with the door rotation in Lesson 91:
- Blueprints are supposed to work as templates, in the same way as classes for C++: when creating a Blueprint, is best pratice to create a generic solution that may work and adapt itself to many other cases than creating something really specific and trying to correct bugs that appear when its used on different contexts.
- Sometimes its easier to work with the components than the actors themselves.
So, that being said, I initially created my BP_Door to include the door frame as the root object of my blueprint and attach the door to the door frame later. This way I can rotate it based on a relative rotation to the door frame.
Like this.
And here is the Blueprint.
Notice also that I exposed two other parameters:
- The Opening Angle, that holds the max angle the door will open. My Timeline goes from 0 to 1 and than is multiplied by the Opening Angle, allowing me to open the door to any angle.
- The Door Close Delay (needs a better name, this variable) that holds the time (in seconds) it takes to close and open the door. After exposing it I just have pass it as it’s inverse ( 1 / DoorCloseDelay ) as the parameter to the Set PlayRate node and now I can have multiple doors that take different times to open.
like this:
and this is the way to expose to BP:
// By adding them as UPROPERTY with the BlueprintReadOnly argument
// I can see them in Blueprints
UPROPERTY(EditAnywhere, BlueprintReadOnly)
float OpeningAngle = 90.0f;
UPROPERTY(EditAnywhere, BlueprintReadOnly)
float DoorCloseDelay = 1.0f;
Hope it helps,
Cheers!