Jump to content

Recommended Posts

Posted

In my game two characters are in a sword fight. I want my main character to slowly push back the enemy character. What command do I need to do this?

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

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

Posted

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++

Posted

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.

Posted

..i would do that trough game logic, where specific kind of attack will produce output result(s) such as push back..same should apply on to main character where such motion caused by AI action, affect player as well..

 

Posted

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:

Posted

Just use SetInput to make him keep walking in the direction of the player. Make the enemy's mass heavier than the player's if he isn't moving you enough.

My job is to make tools you love, with the features you want, and performance you can't live without.

  • 2 weeks later...
Posted

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.

Posted

The enemy mass is much greater than the player mass and when they collide there is a slight pushing, but its brief and only happens once.

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

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

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.

×
×
  • Create New...