[Answered] How to move actors/objects via velocity?

What I’m trying to do is move and object towards the front of the camera when holding the E key, I made an Actor class attached a cube mesh to it, enabled simulate physics and use gravity. I tried just plain simply setting the actor’s location by SetActorLocation(Input), but objects will go through walls. I also tried “RootComponent->ComponentVelocity”, however that didn’t do anything. So, it appears I can only get a velocity but not set a velocity. So is there another way to add force/push/set velocity or something like that on an Actor in which it does not get pushed through walls?

Thanks in advance.

‘Set Actor Location’ has a ‘Sweep’ option pin. If you set this to true, when it tries to move it will perform a collision sweep and stop if it hits anything. Note that if you are using a staticmesh for collision, it will need ‘simple collision’ added first (this can be done easily in the staticmesh viewer):

Or you can use a shape component (e.g. sphere component) for collision, and turn off collision for any graphics meshes attached to it.

Cheers! I used the Cube Component and it works great!