now i’m wondering, id there a way that i could do an explosion adding an empty at the event point and then measuring with a near sensor
[Near; character]>[python] with the python being along the lines of
Near.hitObject setVelocity[awayFromEventCenter]
from that line you can see that i don’t python. but that^ is kinda what i’m looking for. is this possible?
So you want an explosion that launches objects (in its near-sensor detection range) away from it?
import GameLogic
cont = GameLogic.getCurrentController()
own = cont.owner
force = 10.0 # controls how powerful the explosion is
near = cont.sensors["near"]
if near.positive:
for obj in near.hitObjectList: # for every object detected by the near sensor
vec = obj .getVectTo(own) # gets distance, global vec-to, local vec-to
vect = vec[1] # get dat global vec
dist = vec[0] # oooo get dat distance too
totalForce = force/dist # oh snap divide your force coefficient by distance so stuff further away experiences less force
obj .applyForce([-totalForce * vect[0], -totalForce * vect[1], -totalForce * vect[2]], False) # APPLY THAT SHtuff.
# The inputs here are: [X force, Y force, Z force], True/False (controlling whether the force is applied on global or local axes)
That should just about do it. You might need to add “import mathutils” at the top but I doubt it. Should work alright. For the setup, you want a near sensor named “near” (wow crazy I know) connected to the python controller on the empty object you’re adding at the explosion event. That should be it!
near, + raycast to each target could make a explosion that respected walls etc,
and ‘throwing yourself down on the grenade’ really would block everything around from the hit, maybe even a second or third raycast depending what strength of armor? (armored units block explosions better then unarmored units?)
like
if damage multiplyer remainig >quit threshold:
cast rays again after target and remove value based on armor level of last hit.
I wonder how expensive(cpu cost) it would be
to cast 32 rays 6 units long? and use vector reflect :, apply impulse at hit point, and armor etc?