Jump to content

pushing


cassius
 Share

Recommended Posts

I tried using addforce to enemy character with both positive and necative values but it had n effect. Canyou give me some idea of values required.

 

 

But it maybe that se of y other code is nullifying the addforce code.

amd quad core 4 ghz / geforce 660 ti 2gb / win 10

Blender,gimp,silo2,ac3d,,audacity,Hexagon / using c++

Link to comment
Share on other sites

Character controllers can't have forces applied to them. Something I did a long time ago was to also have a cone physics shape at the bottom of the feet of the character and when I wanted to push them back, I would disable the controller, and then push the cone back some via physics and have the character model follow it. When it stopped I would enable the controller again.

Link to comment
Share on other sites

I think what NA is saying is another way to do it besides using physics, would be to do something where you specifically are setting the position of the character to simulate the push back effect. By using something like SetPosition() over every frame while said character is being pushed back, you can simulate, in a more deterministic way (it'll be the same every time). With the way I mentioned your character could fall over. When I did this some time ago I placed a very wide cone at the feet of the character to make sure it didn't fall over, but it still could have if something went wonky with the physics cone. 35 seconds into this video you can see it in action with the physics method I picked:

Link to comment
Share on other sites

  • 2 weeks later...

It is my assumption that a CharacterController is considered an 'infinite-mass' object which would prevent any external force from being applied to it or, the SetInput(...) method will negate any forces applied to the object because the SetInput(...) uses the objects position, rotation etc. What you might be able to do is use the SetInput(...) method and incorporate applied-forces into the method. Doing something like this should allow you to still apply forces without changing the character controller, or modifying the mass of the object.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...