Download

Calling an interface from Level Blueprint dont get values

Hi people!

Im trying to get angular and linear velocity from a Pawn to pass to another in the level blueprint using an interface.

Interface:
b56d842d37fae018eb0a28aad9e1db68707c208d.jpeg

Interface override in Pawn
1.JPG

assign values in Blueprint Pawn:
2.JPG

Call interface in Level Blueprint:
3.JPG

Printing always 0,0,0.

In those graphs, it appears as if the velocity values are set only once, on Event Begin Play. At that point in time, it would make sense for them to be 0,0,0 because nothing has happened yet. The variables in your pawn, Angular Velocity and Linear Velocity, are not reactive in the sense that they automatically update when something happens.

So, to fix this, your implementation of the interface function GetVelocity must make calls to GetPhysicsAngularVelocity and GetPhysicsLinearVelocity directly when the function is called, and return those (up to date) values.

Thanks Xenome, using GetPhysicsAngularVelocity and GetPhysicsLinearVelocity into the function that overrides interface works nice!

d26b2fe84f7a5eb26a979973cd19c3cced60abf1.jpeg

Excellent!