Hi,
I got a copy of this from a tutorial on how to create a blood effect, I have the object working, but the code here, I don’t know what to change or remove, I did try one edit with it.
It was from a tutorial similar to the sparks effect.
The object is blood1 so that should load similar to the way I did the sparks, so I setup a ray2 gun is now fpgun.
From those who know how to program, what exactly is relevant?
##############################################################
#Blender 2.5 bullethole script
#this script is free to use and is under no license agreement.
##############################################################
from bge import logic as GameLogic
from mathutils import Vector
c = GameLogic.getCurrentController()
scene = GameLogic.getCurrentScene()
own = c.owner
space = 0.3
gunspawn = scene.objects['gun spawn']
# sensors
Ray = c.sensors['Ray']
Ray2 = c.sensors['Ray2']
fpgun = c.sensors['fpgun']
m24flare = c.sensors['m24flare']
# actuator
ground_hole = c.actuators['bullet_hole']
body_hole = c.actuators['blood_hole']
ground = c.actuators['ground']
blood = c.actuators['blood1']
if Ray.positive and fpgun.positive and gunspawn['equipped'] == 2 or Ray.positive and m24flare.positive and gunspawn['equipped'] == 1:
# Get info
pos_vec = Vector(Ray.hitPosition)
normal_vec = Vector(Ray.hitNormal)
# make object
ground.instantAddObject()
bullet_hole = ground.objectLastCreated
# position hole
bullet_hole.alignAxisToVect(normal_vec.xyz, 2, 1)
normal_vec.magnitude = space
bullet_hole.worldPosition = (pos_vec + normal_vec).xyz
ground_hole.instantAddObject()
bullet_hole2 = ground_hole.objectLastCreated
bullet_hole2.alignAxisToVect(normal_vec.xyz, 2, 1)
normal_vec.magnitude = 0.003
bullet_hole2.worldPosition = (pos_vec + normal_vec).xyz
if Ray2.positive and glockflare.positive and gunspawn['equipped'] == 2 or Ray2.positive and m24flare.positive and gunspawn['equipped'] == 1:
# Get info
pos_vec = Vector(Ray2.hitPosition)
normal_vec = Vector(Ray2.hitNormal)
# make object
blood.instantAddObject()
bullet_hole = blood.objectLastCreated
# position hole
bullet_hole.alignAxisToVect(normal_vec.xyz, 2, 1)
normal_vec.magnitude = space
bullet_hole.worldPosition = (pos_vec + normal_vec).xyz
# make object
body_hole.instantAddObject()
bullet_hole3 = body_hole.objectLastCreated
# position hole
bullet_hole3.alignAxisToVect(normal_vec.xyz, 2, 1)
normal_vec.magnitude = 0.003
bullet_hole3.worldPosition = (pos_vec + normal_vec).xyz