Hello, i can't understand why my combatant gameobject can't receive a force when hit by an ability. I created a battle event for damage animation, such that when the combatant is hit, the combatant gameobject is given a force. So am trying to use Add force rigidbody node to move the target of the ability when hit by the ability, but the gameobject doesn't move. Below is my setting for the Add force rigidbody node

Rigidbody object

Object Actor
Actor Target

Force settings

Use 2D unchecked
Relative force unchecked
Limit time unchecked

Force

Value type value
Value x= 0, y= 0, z= -5000
Force mode force

Also note that my combatant gameobject has rigidbody component attached to it, and has is kinematic unchecked. Any suggestion will be appreciated
  • edited February 2018
    Working fine on my end - make sure the rigidbody is attached at the root of the combatant's game object, or define the child object with the rigidbody in the Child Object field.

    Also, if the rigidbody uses position contraints, it can't move :)
    Post edited by gamingislove on
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • edited March 2018
    @gamingislove thanks for your reply. Once I disable the position and rotation constraints, the character gameobject will start flying around. I have altered the value of drag, still no luck.
    Post edited by henkesky1 on
  • So, the Add Force Rigidbody node is working now?
    What's the issue now?
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • @gamingislove Anyway, i cant even verify if it is working. The enemy keeps flying around. Even when i manage to hit them, i can't tell if it is the Add Force Rigidbody node is moving them or not. They keep flying in zig zag patteren. I have checked the value of my gravity, it is still set to -9.81 in the editior
  • In that case it's your overall physics setup that's causing this behaviour.
    All I can tell you is that, if you want to add rigidbody forces to something, the rigidbody must be allowed to change the position (and/or rotation) of the game object.
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • @gamingislove your right, but i just discovered it has something to do with character controller. I placed the same combatant gameobject in an empty scene, with just a cube acting as the floor. When i remove the character controller, it starts working fine, but reverses to usual problem when i add the character controller. To the best of my knowledge, it seems i cant set up my combatant to move and animate without character controller. I have done alot of google search, but still no solution. Please if you can make any new suggestion with my latest information i will appreciate. Then if not, i will consider leaving out Add Force rigidbody to my damage animation event.
  • Rigidbody and Character Controller are not friends :D Character Controller does not use Rigidbody collisions as far as I know.

    What you could try is disabling Character Controller, Setting Rigidbody to non Kinetic, Adding Force and after X time Enabling Character Controller and Kinetic.
  • @hellwalker thanks. I tried to disable Is Kinematic field of the rigidbody using ork event node change fields, but is not working. Here are my settings.
    Component name Rigidbody
    Is static unchecked
    Object Actor
    Actor Target

    Field name Is Kinematic
    Is property unchecked
    Field type Bool
    Bool value unchecked

    The Addforce Rigidbody node comes immediately after the Change fields node. I didn't enable Is Kinematic after the Addforce Rigidbody node, just for testing purpose, but nothing happens to the target Is Kinemtic field
  • You need to enable Is Property, Unity components usually provide these fields as properties :)
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • @gamingislove i actually tried it both ways(Is property checked and unchecked) is not working.
  • Sorry, I should have taken a closer look at your settings - you've also got the wrong field name, it should be isKinematic to work.

    The name you see in the inspector of a component isn't what you should put into the field name setting. E.g. for Unity components, always check in the scripting API how the name of the field really is (like for rigidbody.isKinematic).
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • @gamingislove thanks, I have corrected that. But the targets that receive the forces are not moving the way I want. I would prefer them to move/pushed away from the user/player when hit by the ability. Am not really sure, but it seems what am talking about is normalising the force.
  • Well, the event system gives you all available methods to add force to a rigidbody - I guess you have to change how you use the force vector, e.g. calculating a direction away from the user.
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
Sign In or Register to comment.