how to make bullet hits in blender game engine

how to make bullet hits in blender game engine, How do you do it Like i have a gun and were i shoot i want a dirt hit or something heres an example: http://www.youtube.com/watch?v=SHW68KZFzPw help

Here’s an example .blend I think it’s what your looking for. this is a 2.49b script so it won’t work with 2.55

Attachments

Bulletholeandmouselookexample.blend (319 KB)

No not really i want like my example! no offense

Search for something like FPS Template. I think the original version is by Social

No, but i just want a tut not a another blend. file

How can you be so lazy. You just need to download the .blend file and copy the script you want. If the FPS Template is too complicated for you try searching for “Bullet Hole Script”.

NonONONO Dude i whant a tut i am not lazy! Just Please Some one Do a tut For God Sake!!!

Yeah, 'cause everyone knows yelling makes everything better… :no:
Also, I’m pretty sure the idea was for you to reverse-engineer the examples, so as to learn from them and adapt them to your needs, but whatever…

On a less sarcastic note, have you looked into python at all? Referencing your more recent threads, it would appear not, so I thought I’d bring up the awesomeness that is scripting. I’d have a look at this, this, this, this, and this if I were you, remembering that the second to last “this” relates to the second “this”…
It’ll require work, your apparent worst enemy, so consider yourself forewarned…

Hold on guys. I can see his viewpoint. I tried to edit Socials FPS template, and the bullethole script is Insanely complex for a beginner.
I will make a tutorial at 12 tommorow GMT if you want.
[EDIT] SORRY, WILL BE 12 tommorow, BUSY TODAY[EDIT]
If you want to see what i will be using is:
http://blenderunderground.com/forums/viewtopic.php?f=20&t=3381
http://blenderartists.org/forum/showthread.php?t=85219
and the blend link is not working, so here it is:
http://sites.google.com/site/socialstorage/FPS_template.blend

i will show you how to integrate them.
they’re quite simple.

Wheres The Tutorial?

Was really busy, ill do it tommorow maybe. If i can

quick question, do you want to know about making a hole for certain materials when you shoot them, like a hole for wood etc. or do you want to know how to shoot things so they “die”?
CREDITS FOR BULLET TORQUE and FORCE go to Goliath, blenderunderground
i have done a basic shooting script:

  • make an empty, at the end of your gun model.
  • add a mouse lClick sensor:
  • call it “mouse”
  • make it true pulse, (the first set of 3 dots, click it)
  • set the frequency about 60.
  • make a ray sensor, also true pulse
  • call it “ray”
  • make a “script” controller, make a text file in the text window.
  • paste the below script.
  • type in the name of the text file into the script controller
  • read the comments (the ones with #) to see how script works
  • for the objects to be shot, add a health property, and two other properties:

health = 100
torc_obey = 1
velocity_obey = 1

import GameLogic
controller = GameLogic.getCurrentController()
owner = controller.owner

#gets the sensors, such as the mouse shoot
shoot = controller.sensors["shoot"]
ray = controller.sensors["ray"]

#if you press shoot and the ray hits an object
if shoot.positive and ray.positive:
    
    #sets the hitobject variable as hitobj
    hitobj = ray.hitObject
    
    #if the hitbject has "health" as a property
    #take off 10 per pulse
    #if the object has no health, kill it
    if "health" in hitobj:
        hitobj["health"] -= 10
        if hitobj["health"] == 0:
            hitobj.endObject()
            
    #if the hitobject has a property "velocity_obey"
    #set the variable as velocity
    if "velocity_obey" in hitobj:
        velocity = hitobj["velocity_obey"]
    else:
        velocity = 0
    
    #if the hitobject has a property "torc_obey"
    #set the variable as torc    
    if "torc_obey" in hitobj:
        torc = hitobj["torc_obey"]
    else:
        torc = 0
            
    #if velocity has been defined
    #set bullet force and make the object move
    #it's complex, just copy it really            
    if velocity > 0:
        bullet_force = 1000
        force_x = -owner.worldOrientation[1][0] * (1-abs(owner.worldOrientation[2][1])) * bullet_force * velocity
        force_y = owner.worldOrientation[0][0] * (1-abs(owner.worldOrientation[2][1])) * bullet_force * velocity
        force_z = owner.worldOrientation[2][1] * bullet_force * velocity        
        force = (force_x,force_y,force_z)
        hitobj.applyForce(force, 0)  

    #if torc has been defined
    #set bullet force and make the object move
    #it's complex, just copy it really            
    
    if torc > 0:      
        force_x = -owner.worldOrientation[1][0] * (1-abs(owner.worldOrientation[2][1])) * bullet_force * velocity
        force_y = owner.worldOrientation[0][0] * (1-abs(owner.worldOrientation[2][1])) * bullet_force * velocity
        force_z = owner.worldOrientation[2][1] * bullet_force * velocity
        dx = ray.hitPosition[0] - hitobj.worldPosition[0]
        dy = ray.hitPosition[1] - hitobj.worldPosition[1]
        dz = ray.hitPosition[2] - hitobj.worldPosition[2]
        tx = -(force_y * dz) + (force_z * dy)
        ty = (force_x * dz) - (force_z * dx)
        tz = -(force_x * dy) + (force_y * dx)
        torque = (tx,ty,tz)
        hitobj.applyTorque(torque, 0)

#add script
#done!         

Whats a iclick Sensor?

L click, left click, sorry wrong letter :stuck_out_tongue:

ok freaked out for a moment!! LMAO

Sorry, i wanted to do a video tutorial, but the recording went wrong 3 times, 20 minutes down the drain XD

what kind of computer do you have?

netbook, till i get my new PC XD

Wow i have a mac but only reson why i ask is that there is a software called hypercam and it is free (record your backround) and it’s free

And can’t get it to work sorrry