Making a variable accesible to other blueprints
Hello Unreal Community this is my very first post.
My question is: I am planning to make a side scroller 3d shoot em up game. I want to be able to limit my spacefighter Up/Down movement relative to my fixed cams frustum at the spacefighters distance. and required mathematical formulas for computing frustum height min/max is as follows tan(verticalFOV/2)*distance verticalFov=2*atan(tan(horizantalFov/2)*height/width) i created camera and placed it to scene center and converted it to a camera component blueprint and computed my frustum height the problem here is i want my Pawn movement to be clamped between frustum height. but i am not able to transfer the frustum height information that i was computed from camera component blueprint to my spacefighters blueprint.
any help would be appreciated.
asked Aug 21 '17 at 10:04 AM in Blueprint Scripting
Store your refference or just the result somewhere easy to access like GameMode/GameInstance or even your Controller.
BeginPlay -> getGameInstance -> CastTo YourGameInstance -> Set VariableNameYouChoose and pass self (YourBP or Component that has the Variable you want to get) or just the Result after you calculated it.
Inside your Fighter you get the Variable from there when you need it. No need for get all Actors of Class and it will work with dynamicly spawned Fighters out of the Box.
BeginPlay -> getGameInstance -> CastTo YourGameInstance -> Get VariableNameYouChoose
You could Get all actors from class space fighter (or whatever name it has) on begin play inside the camera component blueprint and then cast the variable you want the space fighter to receive, to the space fighter with the "cast to" node on event tick. I don't know how cost efficient this is, but I think it should to the job.
Follow this question
Once you sign in you will be able to subscribe for any updates here