How can I stop my Physics Body from being affected by other Physics Bodys without constraining movement?

MyCharacter from Side Scroller template had Collision Presets set to Pawn and disabled “Collisions Enabled”, which made other falling objects just fly through my character, completely ignoring it. So I changed Character’s collisions to custom preset and and then “Collisions Enabled” to “Collisions Enabled”.

rest of objects now collide with my character even when they’re WorldDynamic or PhysicsBody. But there is one bad thing with this solution (bad in my case)

In my game each object has it’s own Vector3 gravity, so I can control if it falls down, flies up or sideways. Player can just control whether object falls down normally or has “inverted gravity” and flies up. Example setup:

1 - Character with “No Physics Collision”. Player shoots platform - it flies up. Player can walk around that platform with no problem.

2 - Character with “Collisions Enabled”, same thing but platform’s rotation get’s affected by mass of character. Clumsy player falls off platform:

Of course I understand that this is how physics work. But can I apply these two into my character:

  • Things that fall on character should not ignore it’s collider component (bounde off, not intersect)
  • Set Character’s mass to 0kg (?) so Its collider couldn’t affect other objects as described above.

One answer would be to constrain object’s rotation but I would like to avoid that. I’m already constraining all physics objects to 2D plane (movement on Y, Z and only one rotation)

for 1) doesn’t standard pawn collision preset work? 2) To set mass to 0 kgs, expand physics tab by clicking on arrow and set mass scale to 0 or you can just search for mass scale and set it to 0 for mesh and capsule component.

Hey Zielak,

You might want to consider using matinee to move your platforms, and basically fake your gravity change. Otherwise, constraining rotation is probably best option. Setting your character’s mass to 0 might have other unintended effects on your game.

If you’d like, I can take a close look into issue if you show me specifically how you are moving your platforms up and down so I can reproduce it.

Best,

  1. No, only from “below”. When I throw stuff at him from side or above it just goes through it.

I’ll try that mass scale in a moment.

No luck, setting mass scale to 0 keeps situation from my seconds screen.

Hi ,

platform inherits from my Obstacle blueprint so usage is not restricted to up/down platforms. Here’s setup:

Collider properties:

  • Simulate Physics - true
  • Enable Gravity - false
  • Collision presets - BlockAllDynamic

One Vector3 variable called “Force”. Default value negative Z (0, 0, -15). In my case player can shoot his gun and invert Obstacle’s Force (0, 0, 15). For simplicity you could bind inversion to some keyPress.

In Obstacle events graph I have On Tick event:

6411-fake_gravity.png

MyCharacter is taken from SideScroller template, only thing I changed here was to Enable Collisions, as I mentioned earlier.

You could try increasing Angular Damping by a large enough amount. In your Collider’s physics settings, increase Angular Damping to something like 50 and see if that helps.

Hey Zielak,

We haven’t heard from you in a few days, so we’re going to mark this as accepted answer for tracking purposes. If you’re still experiencing after above suggestions, please let us know!

Best,

Well, that could be my design flaw. I wanted to make every obstacle act same but maybe I just have to restrict some obstacle’s movement so they can act like elevators. Thanks for your time.