x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

How can I make my character affected by physics?

Hi,

I'm trying to make a character affected by a slippery surface in U4. I created a physics material and assigned it to the material of my floor. Upon this other pawns (such as cubes) are being affected by it, but my character doesn't move at all.

If I disable simulate physics at my character's capsule component, the character moves, but if I turn it on, the character stays immovable.

Any ideas?

Cheers!

Product Version: Not Selected
Tags:
more ▼

asked May 14 '14 at 02:58 PM in Using UE4

avatar image

fdjveiga
31 5 8 12

avatar image Ben Halliday STAFF May 14 '14 at 06:51 PM

Hey fdjveiga,

Would you mind showing us what your physics material setup is, and what your character controller looks like? I'm guessing your character movement is what's causing the problem here, but if I can see it I might be able to see how. Thanks!

Ben Halliday

avatar image fdjveiga May 15 '14 at 08:42 AM

Hi,

So, I am using the TP_FirstPerson example, where everything is default in the character except:

  • Checking the box for simulate physics in the capsule component.

  • Setting PhysicsActor as the collision preset in the capsule component.

As for the physics material, I created a new physics material and set the friction to -1000.

Cheers!

avatar image fdjveiga May 16 '14 at 09:14 AM

Just an update,

There's no need to change the physics material, it is enough to only enable the physics simulation in the characters capsule component that it will not move anymore.

Any ideas?

avatar image Jarbles Dec 08 '16 at 06:02 AM

So I've looked everywhere for a solution to this (how to move a player character with a dynamic object) and I can't find jack. For example I have a normal third person character on a ledge and he gets slammed with a massive dynamic object but the dynamic object just bounces off. I've tried so many fixes to this and nothing is working, getting very desperate.

avatar image zeroexception STAFF Dec 08 '16 at 06:09 AM

Try using an impact event on the character to get notified of the hit, and then using either AddImpulse() or AddForce() on the character movement component to affect velocity. You'll want something like OnActorHit, OnComponentHit (for either the capsule or mesh), etc.

If the dynamic objects are simulating physics, you will need to set "Simulation Generates Hit Events" to true on the physics objects (and the collision in their physics asset) for the events to be triggered.

avatar image Jarbles Feb 28 '17 at 03:12 AM

Hey never noticed your response, and here I am still trying to fix these problems. I think I've been trying to stretch the character movement component past it's intended limits, but maybe my struggles can help inform a future update, or maybe you can even help me somehow.

I have tried what you mentioned, the main problem is that dynamic objects defer to the character movement component always, and love to bounce off like beach balls. To try and stop this I created a static mesh that transported itself to the exact location of the dynamic mesh so that it couldn't bounce it away. The problem with that was then i had to create a faux collision system out of AddImpulse() which still had me clipping through the object sometimes, and messed with some other things like cloth effects. The closest I could get was to give the static mesh a SetVelocity() and copy the dynamic object's movements. This worked perfectly, except that once the z velocity was high enough (from falling) I wouldn't be able to walk on that object anymore. I tried creating a dynamic object with a child component that blocked and didn't simulate physics, but the child seemed to effect floating pawn movement anyways.

I keep getting so close to making the engine do what I want, and that's been incredibly frustrating. I think there's a big flaw in having character-movement ignore physics (I don't know many games since before the 90's that don't have "dynamic" objects effecting the character). Maybe I'm missing something but I've looked everywhere and tried so many things.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

Okay, it sounds like you haven't messed with the Character Movement settings yet. In your character's Defaults tab, scroll down to the Character Movement section. In there, take a look at Ground Friction and set that to a number greater than zero but probably less than 1. Then look further down for Max Acceleration and, more importantly if you're looking to replicate an icy surface, Braking Deceleration Walking. Drop that down to zero to start with.

That should help you get what you're looking for, though you'll probably want to fiddle with those numbers some.

Hope that helps!

Ben Halliday

more ▼

answered May 16 '14 at 08:47 PM

avatar image fdjveiga May 19 '14 at 08:27 AM

Hi,

Thanks for the tips!

Still, is it not possible to use the physic materials in the world to affect my Character, not relying on messing with the CharacterMovement?

Cheers

avatar image zeroexception STAFF May 19 '14 at 05:46 PM

Normally you would change the settings on the movement component rather than the materials in the world. I think it was done this way so that you could tweak the settings without having to change everything in the world, and also so different characters could behave differently.

That said, there’s no reason the you can’t modify GroundFriction based on the physical material they are standing on, if they want to. There is the “CurrentFloor” member of CharacterMovementComponent that among other things has access to the physical material of the surface the character is on (through CurrentFloor->HitResult). One option would be to inspect this each update and change GroundFriction accordingly.

As for why the character didn’t move when simulating physics, that is because you either get physics movement or movement through the component, never a combination. It should move once you apply a physics force to the capsule, if it's simulating physics (although I also expect the capsule would start falling over!).

avatar image CharlieTheTall Aug 05 '14 at 10:44 PM

Does current floor work for BSP? I'm not getting anything returning. Here's my setup. alt text

ue4_icyfloor.png (130.1 kB)
avatar image zeroexception STAFF Aug 05 '14 at 11:07 PM

Is it working on things other than BSP?

First thing to check is that you set "ReturnMaterialOnMove" to true on your Character's CapsuleComponent.

avatar image Ben Halliday STAFF Aug 06 '14 at 12:23 AM

Hey Charlie,

As Zak mentioned, make sure Return Material on Move is enabled in your Character's CapsuleComponent. Current Floor will work for a BSP, but I don't think you can put a Physical Material on a BSP. In any case where there is no Phys Mat, you'll get DefaultPhysicalMaterial returned as the Display Name. Your Blueprint should work fine if you set ReturnMaterialOnMove to true as Zak suggested.

avatar image CharlieTheTall Aug 06 '14 at 01:38 AM

Ahh, perfect. That returns the PhysMat. I created an Ice looking material. Then a Material Instance that hooks the Material and the PhysMat together. Then slapped the MatInst on the BSP. Works like a charm. Now to apply the physics forces...

avatar image CharlieTheTall Aug 06 '14 at 03:57 AM

Thanks for the help! Another question. I've implemented the character movement tweaks when on the "ice". It works great when on flat ground, but if there is a slope, I would expect the character to slide down the slope. What's the best Character Movement attribute to play with to achieve this?

avatar image CharlieTheTall Aug 06 '14 at 04:19 AM

Nevermind, I figured it out. Basically I get the normal of the hit result. If the Z is less than 1, then I take the X value, multiply it my a constant (in my case 25), then add it to the existing X velocity, and set the velocity. Works well. Just posting my solution in case someone else stumbles upon this.

avatar image CharlieTheTall Aug 12 '14 at 06:35 PM

Some follow up. Basically I'm trying to make a wobbly iceberg that is also slippery. The physical material check didn't work on the static mesh because I have to turn off the static meshes collision and use the collision component in the Blueprint because I'm using a physics constraint to allow the object to "wobble" in the water.

If the Static Mesh Component's collision was enabled along with the Box Collision Component, the object freaks out.

To work around this, in the Event Graph for the object, I have a Set Physical Material Override node on the collision component (not sure why we can't set that in the initial properties). There I set my desired physical material and the result is joyous. If there's a better way to get this to work, let us know.

avatar image Ben Halliday STAFF Aug 14 '14 at 04:06 PM

You can give a Box Component a Physical Material in the Details panel, but you'll first need to create an empty Material that uses the Physical Material. In the Details panel, extend the Shape section to reveal the Shape Material setting. Apply your Material that uses your Physical Material, and that should work!

Of course, it sounds like you got it working pretty well without that. Let us know if you have other questions!

avatar image BrUnO XaVIeR Jan 26 '15 at 07:40 AM

In case someone is still wondering how to make these slippery surfaces and at the same time avoid allowing the character to climb slopes, I did something pretty much like STAFF suggested, but didn't have to mess with velocity functions though:

http://youtu.be/HtuU7hFhqJY

avatar image gooberCP Feb 10 '16 at 08:09 PM

Did you post that video anywhere else? YouTube says it's unavailable. If you still have it, I'd like to see it.

avatar image Incbyakya Jun 29 '16 at 07:36 PM

Ask u the same.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question