Download

Movement & Hit Events without Physics

Hi, I am currently working on a mobile game and attempting to get a character that would move in 2D while standing upright when the device is tilted. I found that my skeletal mesh could not be moved this way while physics was turned on without unwanted rotating, or in the case of using linear forces there was no effect on the actor at all. I found that by adding an offset vector via the AddActorWorldOffset, I could get the kind of movement I wanted when physics were turned off. I also wanted my character to be able to jump and land, and upon landing see what they hit (whether it was a mine, or the ground) to both stop their vertical movement (since I had to create my own gravity and jump vector offsets without any physics) and execute the proper code. I found when I tried to use Hit events, that I couldn’t get a hit event to fire on my character. I also found that trying to use a collision component yielded no beneficial results, as the component would become disconnected from the mesh, only fire a hit event once or cause the character to abide by physics and roll around anyways. So my question is: How, without physics, can I get my actor to generate hit events on a skeletal mesh?

Even with physics disabled you can still use the collision detection. Make your skeletal mesh generate hit events and make it block some channels (WorldStatic and WorldDynamic for example).

You don’t need physics to achieve walking and jumping, so don’t try to replace that. Also don’t use AddActorWorldOffset to achieve character movement. Again with physics turned off you can still use the character movement. Try doing the movement by calling AddMovementInput on the character. If you don’t want the character to rotate in its movement direction, turn off “Orient Rotation to Movement” on the character blueprint (or character movement component, I don’t recall which one).

Thank you this worked perfectly! After reading your post, I found I was using a pawn when I thought I had been using a character, which was part of the difficulty I was experiencing. Thanks again!