I am working on my very own fps. I have a double barrel 9mm and a beta shotgun working, however.
my bullets go through there targets about half the time. using material collision
is there a better way of doing collision???
also i have ok movement but having problems with going to fast and falling through the walls and if i use force it walks to fast or donest stop imeaditly. sorry about spelling lol. tired…
I will post more when i get some good baddies to shoot at and add clip and reload functions. probly wait till i get 3 weapons working , the db9MM and the auto shot gun, plus my razor saw gun hehe
please help…
You can combine these methods too Real bullet object with a ray sensor on it With shotgun, you can send them spiraling out or whatever path you want the bullets to take and they will register the hit cause they have ray sensors.
I already use the ray, however how do you detect which object is used in python. the only python i use is a mouse script. im not unfamilar with programing but i have no clue when it comes to python. any help please?
p.s i used multiple empty’s for the shotgun which is called by the key acutator. as soon as i fix the bullet all my problems will be solved. I kinda like to see the bullet shoot as well. makes a neat effect. Its just annoying when you fall through the wall or if you bullet hits the enemy and he goes flying becuase of that werid dynamics. so far my solution was to make the enemy’s size tiny. so if you shoot the spot between there feet sometimes they still go flying. and i am using another add object effect for smoke or leaving a bullet mark. which works when the collision is detected. where is a good resoures for python and maybe even is there a tut for bullets that dont go through walls lol
Simple script for ray, expand as needed. Attach the ray to a python controller with a similar script to this:
g = GameLogic
c = g.getCurrentController()
ray = c.getSensor("ray") #Have to name the ray sensor "ray"
killbullet = c.getActuator("endobject") #Name the actuator "endobject". This is only if you have the ray on the bullets
damage = 5 #Set this to the damage the bullet should do
if ray.isPositive(): #If the ray hits something
ob = ray.getHitObject()
if hasattr(ob,"health"): #We hit something that has health
ob.health -= damage
g.addActiveActuator(killbullet,1) #Again, this is only needed if the ray is on the bullet rather than the gun
This will work if you shoot the ray from the gun, it also works (with those two extra lines, and an extra actuator set to end object) if you put the ray on the bullets and add the bullets. Then all you have to do is add the bullets as normal. Experiment with the length of the ray to find the best effect. Using the ray.getHitPosition() command in conjunction with an add object actuator on an empty linked to whatever is casting a ray, you could also make a bullet mark appear where it hits, or make sparks, or whatever you want to do.