In code formatting, everything I need to find how it’s done (if it can)
- Create a HasWeight component with a Weight (UProperty)
- Create a Grabbable component
- Attach an HasWeight component to FirstPlayerPawn
GrabbableComponent :
- If
owner Actor distance to Player Pawnis less than GrabbingRadius (UProperty) - AND Player Pawn Camera Actor
is aiming atowner actor -
Display a visual cuefor the grabbing action - If
player inputfor grabbing - Set Grabbed = true
- Save
vector from Player Pawn to self Block Player Pawn Camera Actor Rotation- Each tick, move owner actor position to match saved vector
OpenDoor component
- WeightTreshold UProperty
- Instead of the Player Pawn,
get an iterable of all Actors having a HasWeight component - Compute total weight of the ones overlapping and open door if > WeightTreshold
Level 2:
- Instead of keeping vector from Actor with GrabbableComponent to Player Pawn constant, use
position in the Cameraso that we can move the grabbed actor with the camera rotation -
Apply Gravityto Grabbable Actors and Player Pawn, And reduce BoxTrigger Height
I’ll give it a try and see if I can achieve something by myself with UE Doc and Google 