I’m not sure if this should go on Blueprint or C++. I’m posting it here on Blueprint because the there’s not much C++ code related to this part, I think…
I’m trying to make a multiplayer FPS, but my Aim Offset is being a bit wonky with replication.
- I’ve done the computations from C++ and I’ve put the final Aim Offset values in a Rotator. I exposed this Rotator to Blueprint
- My AnimationBlueprint can see the Rotator. I can break it and get the Pitch and Yaw. I can print them out and they’re giving off correct values.
- I can feed a hard coded float node into both my Pitch and Yaw values in the AnimationBlueprint. They replicate properly on all clients and the server.
- However, when I try to feed the values from my Rotator into the Animation Blueprint, Pitch is working perfectly. All clients can see it. However, Yaw doesn’t replicate to the clients. Only the listen server can see anyone’s Yaw.
Attached are some screenshots of the blueprints. Not sure if they will help.
Any assistance would be appreciated. This has been quite an odd problem. I don’t see why only Pitch is replicating properly when they both come from the same variable. So I’m pretty much stumped.
replicate aim pitch and aim yaw variables from Update Aim function
After tinkering around with it, I’m not even sure if it’s a replication problem anymore.
- I plugged in the Pitch value into the Aim Yaw setter node, and it manages to move the Aim Offset
- I tried plugging in Yaw into Aim Pitch… doesn’t work.
There seems to be something wrong with the value coming out of Aim Yaw, but they both come out of the same Rotator, so I really don’t know what’s wrong. o.o
Seems to be a problem with the value I’m putting in. I’ve seen other solve this by looking at the ShooterGame example project
FRotator AShooterCharacter::GetAimOffsets() const
{
const FVector AimDirWS = GetBaseAimRotation().Vector();
const FVector AimDirLS = ActorToWorld().InverseTransformVectorNoScale(AimDirWS);
const FRotator AimRotLS = AimDirLS.Rotation();
return AimRotLS;
}
Lots of them said this worked for them. They just expose AimRotLS to Blueprint and the values just do their magic. However, this didn’t quite work for me. I’ve tried putting in other values into the Yaw and they work in making the Animation Blueprint move. I’m thinking it’s a problem because GetBaseAimRotation() takes the controller’s value for Yaw and different clients can’t see the of other client’s controllers… but that doesn’t explain why Pitch works but Yaw doesn’t. This is really baffling.