I have code that causes the actor to move, however enabling gravity causes it to stop moving whenever it lands on a surface. There is a solution here but for some reason a static mesh as a root has the physics grayed out so that isnt an option either. Any options at all?
Is there a mesh assigned to the static mesh component?
I have code that causes the actor to move
So many things depend on the method used. Adding offset is so much different from simulating physics and is so different from a movement component.
Consider adding more details how the whole thing is supposed to behave.
Yes, as the root component. I am moving by adding offset. I explained it very poorly. The actor is supposed to move side to side on the ground, it can move in midair, and when there is no gravity applied. When i add a collision box at the root instead of a mesh, to give it gravity it lands, bounces once, and sticks to the ground, completely unable to move for some reason. When i try to follow the solution, i cant enable simulate physics on the mesh. I am using the same mesh as the thread i linked, a 100x100x100 bsp brush cube, moving on the default platform.
Edit: I forgot the most obvious solution, add collision to the mesh. This is my second day learning c++ and i keep making incredibly dumb mistakes. Apologies.
Re-edit: Physics work, but its still getting stuck, with beveled collision, ccd, and an insane amount of solvers (100 each), Setting collision to sphere/capsule fixes it, but i still wonder if non-capsule/sphere objects can slide. Setting physics material to frictionless does not help.
You’re going to have a bad time.
If you’re moving a simulating body, you have 2 choices:
avoid using moving by offset / set location at all cost- a can of ugly worms that in no way meshes with simulation; a.k.a. not really a choice
use physics only- not so easy to control but the most realistic looking
use physics + movement component- works really well as you get to use movement input, easy to control but the movement component makes certain behaviours more rigid, predictable, non-physical. But it also offers additional goodies, like using navmesh for pathfinding.
Namely, in a Pawn:
The mesh is simulating physics and has (optional) gravity.
This box is using the default box collision, efficient. You get superb collision detection (in most cases), and if you add a physical material to the mix, you get granular control over friction, restitution and more goodies.