How to Disable Rotation on Collision?

Hi guys,

I’m trying to do something incredibly simple that for some reason is very difficult to find answers for.

I’m doing a lot of manual physics stuff for a glide racer game, which means I’m doing a lot of my own math and equations that govern how things move and collide etc.

One of the things that has me stumped is that when I have my sphere (Pawn) go up a ramp, it’s understandably rolling. I’ve locked X and Y rotation easy enough, but if I lock Z rotation as well, I can no longer turn (since I am using set rotation function to turn using the A and D keys). So I need Z rotatable, but on the ramp, this makes the ball steer upward towards the ramp.

The red arrow shows what it is doing. I let it go, and it rotates to the right, up the ramp.

I already have code in place for simply going upward in the same direction via vector projection, but it relies on the forward vector to not be modified, and it is being modified by Unreal.

So my issue is, how do I stop the ball from rotating on collision? Can I disable physics but still generate hit events (i need the hit events to process my collision logics)?

Well…Interesting question.

I got a work around. You can attach another ball2 to this ball1, turn off the collision of ball2. And then uncheck the visibility of the origin ball1.

I can’t seem to get this to work. Can you elaborate?

Okay, I’ve figured it out. I did add a second ball as an invisible “hitbox”, and turned off physics simulation altogether and did my own manual physics calculations for speed, accel, gravity, etc. Turning off the physics simulation for my Pawn components allowed me to control them directly while still having collisions.

An important thing to note here that threw me off was that I need to make my terrain/walls etc. have physics simulation turned ON in order for collisions to still work in this set up. Which is… really weird, but it’s fine.

Seems like a horrifying solution but in my particular case I was going to do all of this anyway for my glide racer game, so it’s no pain.