I have used an old bullet hole script, its not mine (im not sure who’s it is, it might look familiar) it runs ok when its on its own. But i made my own script, and im not sure if the problem is related to the original script, but it shut’s down blender anyhow… here is the script …
import GameLogic as GL
from Mathutils import Vector
cont = GL.getCurrentController()
own = cont.owner
# Get controller
controller = GameLogic.getCurrentController()
spawn = controller.owner
setParent = cont.actuators["Parent"]
mouse_click = cont.sensors["mouse_click"]
ray = cont.sensors["ray"]
# get the game object hit by ray
gameObj = ray.hitObject
# Set parent
spawn.setParent(gameObj, 0, 1)
I opened it and it also crashed on me as soon as I started the game.
I found something that makes it stop crashing, but I am not sure if it is how you want the game to work.
A property was missed. The object being shot at “cube.003” had a “Rigid” property.
Your Ray sensor wasn’t working without a property in the property value box. For everything that you shoot at, you would need to make a common property if you’re going to use the Ray sensor. I put the “Rigid” property inside the ray sensor and it didn’t crash.
Its a parenting problem. When you parent an object to itself blender crashes, I don’t know why there isn’t an exception for this.
So the hitObject is returning a bullet hole, and when you try and parent the new bullet hole to the hit bullet hole they are being interpreted as the same object, even though they are different instances. To solve this change the bullet hole’s physics type to “no collision”, this way bullet holes won’t be returned as hit objects.
Nathankl’s method solves this problem as bullet holes are not being returned.
Yay, thnx guys it doesnt crash (thnx Linkxgl btw) but another problem has occuerred. When i shoot the floor, then the box, and then move the box the hole on the floor becomes parented to the box. The only way i can think of right to go about fixing this is making each bullet hole a seperate objects all together. But, not only do i not know how to do that, but there might a better way. So could u guys help me out with that aswell… ty for helping before btw, i was so happy, like, literally.