I have a Trigger Volume that when the player overlaps it, the Crawl variable is made True. When the player leaves the volume, Crawl is made false… and the player stands up again. This currently works fine. However, I also need to change the Max Speed of the Walk from 1000 to 200 and back again. I’ve tried casting to the CharacterMovementComponent, but I’m getting a compile error and I don’t know how to change it. Any help would be great, please?
You’re trying to cast a Character (an actor) to a CharacterMovementComponent (a component), so that will never work. All you need to do is drag off Get Player Character and then select Get CharacterMovement. You can then set the max walk speed from the CharacterMovement.
Thank you. I thought I needed to get the player character and then find it component (which is what you have shown me).
I’m definitely struggling with what can cast to what and where? Is there an easy way to understand this? Can an actor only cast to another actor and can a component only cast to another component and, if this is the case, is it an easy thing to spot or does it just come with practice? I know certain things are colour-coded. So, I thought this might help, but not much. I have in my head that a Cast sends info to another area, but a Cast can also retrieve info, too. I think it’s going to take me a while to understand this fully… but, I’m enjoying the challenge!
I believe this tutorial goes in depth on references, casting, etc within blueprints. Blueprint Communications | Live Training | Unreal Engine - YouTube
If not, just search for tutorials that involve blueprint communication, referencing, and casting. Understanding how referencing works in programming is a huge step in becoming a proficient coder.