I have a simple weapon system: weapon which has a ray that collides with game-related objects (i.e. objects that can collide with player); an empty that is always at the end of the ray; and, on a trigger (left click), an object (damage object) is added to the end of the empty, the object changes the health value of an opponent when collision occurs. There is also an opponent, for the simplicity of this question, a cube set to dynamic for physics.
I am trying to get the ray to exert a force the way it is facing/going. I'm not quite sure how to create such an idea in the game-engine. How can I have a ray create a force facing the same way the ray is facing/going?
- Force only affects certain object(s). This/these object(s) are whatever the damage object collides with. In other words, the force will affect no object but those that the damage object collides with. (You can have it collide with the object(s) the ray collides with if you can't do this)
- Force does not decrease/increase strength over time; force is constant.
- A property that defines how much force to use.
- A property that defines how long the force will last.
- Please try to answer in python.
Any help is appreciated. Thanks!