And in the BGE I already know how to the get the point of collision between two objects, and in this case, hit and hurt boxes.
Now I just need to know how to get the object to get knocked away in the opposite direction of what’s hitting it. I could use the BGE’s physics, but when I do that the object just get’s violently pushed this way and that and goes way too far. What I would like is a way to be able to control knock-back values and be able to get direction of getting pushed back.
If you want to use collisions you can get the first contact position using a callback but that is overkill,
I would cast a ray along the leading edge of the attack and then if it detects, use a localized vector to the actor based on the attack.
to get a point in space relative to the attacker
point = attacker.worldPosition+(attacker.worldOrientation*Vector)
vectToPointFromAttacker = point - attacker.worldPosition
Works fine with a Dynamic Object, but unfortunately the Object I want to do it with is a Character Object, which doesn’t have the applyImpulse attribute. I do wish the Character Object came with the Dynamic objects attributes like the Force and Torque attributes.
So are there any ways to get a non dynamic object to get “hit” or moved in a direction?
I think it will have to do with applyMovement, but I don’t know how to get the Vector of applyMovement to move it in the desired direction.