When firing a bullet it fires on target from the gun, how ever when moving to another location in the scene, the bullet doesn’t fire from the gun, but further away. I tried positioning the empty, I had to do so to get the bullet firing accurately.
I don’t know what could be causing that?
I took a look at another file I have, and the bullet does fire better, it can be a little off if moving rapidly.
I only know of one way, the way I made the first weapon I created five months ago when I first learnt of how to create a firing weapon.
So I should delete the brick setup, keep the bullet another layer.
And with no target, the bullet fires off from the empty position, what could be causing that?
I also just noticed a bit of a problem, since I have more than one hand and arm, so a hit weapon, the hit weapon will work fine, but the sound effect of the bullet fire will sound. I still haven’t got a scroll wheel object change setup. Hmm. How can I make sure sounds for one object are for that alone, and so on for others.
You can set your Bullet to be child of the Gun. This way, it inherits the right orientation, when added. The Bullet object itself has to be on invisible layer and contain logic to move on local Z axis(could be something else, depending on your Gun orientation). Now if the Gun adds a Bullet, it’ll start moving the right direction by itself.
I don’t understand the no target situation. But this should not be happening, if you use the above method. So if you replace current logic with what’s described above, it won’t be a problem.
I tried making the empty the parent, and it then moves the arm as well as the FP. If I parent the arm to the FP, it all messes up. None of it displays when the engine is loaded.
I also found out, by making a hit weapon the parent, and the arm the child, it then knocks objects around, so that was the problem. Is it perfect, not really, from behind an object it didn’t knock one down. The Arm does also disappear once the hitting animation is played…
Okay, the bullet is in the third layer, the empty is parented to the arm as the child. The image there displays that empty adds a handgunbullet. The point being as is, the bullet doesn’t fire when the FP is in a different location from the gun of where the empty would be at the nozzle. The other user mentioned using a ray, not using the tutorial clip I had used to make my second shooting weapon since I first used the engine five months ago.
As for the other arm which has a hit weapon, I just found out that the weapon is what hits an object, not the arm, but the arm disappears as it is the child of the parent weapon once the animation sequence plays to hit.
When adding objects ensure the emitting object and all of it’s parents have homogeneous scaling. The best is they all are scaled with (1.0, 1.0, 1.0).
A bullet is typically too fast to be visible, therefore the “ray” method is the recommended way to handle bullets. It requires a tiny bit of Python (to process the hit object/hit position).
Beside of that the Physics engine does not really like small fast travelling objects.
Your method is good at rockets and grenades. They are slow and big enough to work without much hassle.
If you really need a ballistic curve you could use an hybrid solution (see post#2). Have a small projectile but measure with a ray sensor the way before the object. The ray should be as long as the way the projectile will travel within the next frame. It is like you watching your next step. When the ray hits this is the travel ends.
Using python isn’t an option. It is a brick setup only.
I have also tried while trying this to create a wheel up to change the Arms with different weapons, going nowhere with that.
As for the weapon hit example, the arm vanishes from the location once hitting an object. The weapon hits but the arm doesn’t, before it was the arm that hits and the weapon was no use.
How do i setup this ray for the bullet firing.
If I did leave the gun fire for the moment, it works for the least, it is rubbish. How do I solve hitting and firing at the same time? I can switch to the Arm 2, and there is no mechanism yet, so I just load from the object list. If I use the hit animation, the gun fires bullets and the sound effect is heard.
Using python isn’t an option. It is a brick setup only./QUOTE]
This is the same extreme approach as trying the do everything in Python. It just makes your work really hard. I guess your issue is the lack of python knowledge. With a little help it should be no big deal. There are a plenty shooting threads out there.
This are “inventory” and “change weapon” aspects and should not belong here. You are talking about shooting.
You mean recoil?
Typically you animate the arm and the weapon at the same time to give the illusion of recoil. This happens after firing (processing projectile or ray).
First fire then recoil.
Ray sensor (from the tip of the weapon) -> Python controller (to process the hit object from sensor e.g. add a force to the hit object, or increase a counter property, …)
This is how I would do:
The user request the weapon to fire
A) projectile method firing: add a projectile
B) ray method firing: either start sensing with the ray sensor (usually you do not turn the sensor off) or checking what is currently hit
Detect an hit
A) projectile detecting hit: collides with an object
B) ray: Detect an hit: the ray detects an object
firing and hitting does not occur at the same time. Maybe at the same frame (in case of ray).
The projectile method is already separated. The projectile will exist after firing (never before or at the same time). So it will start sensing within the next frame. Even when you let the target detect the projectile it will do that when the projectile exist only.
The ray method is a bit different. It is usually constantly measuring. The “firing” just tells when to react on the measure - which is “hitting”. Both the measuring object (usually the weapon) and the hit object can react on the hit. The hit object needs to be notified as it can’t detect if something measures via ray (it is not really a ray, it is a line of measurement).
Right okay, for the moment. When I use the hit weapon, the gun sound effect plays, as the left mouse button is for firing a handgun, and using the hit weapon, along with a hand animation.
Obviously, you don’t have all three displayed in the engine, so lets say I have a switch system using the scroll wheel using the brick setup. When i using the hit weapon to hit a character to knock it down or a body party, the gun fire is heard. So how would that be isolated?
The only way I can think off is by using a different key for the hit weapon.
You are currently mixing weapon selection with weapon usage.
You need to chose a design that uses one weapon only.
There are several ways to achieve that.
A) have only one weapon
I guess this is the easiest implementation A1) have only one weapon with several modes
on “weapon switch” you switch mode. This means you change the appearance (e.g. set other mesh) and the behavior of the weapon (play different sound).
B) have only one weapon at the time
on weapon switch you remove the old one before adding a new one
C) have only one weapon enabled at the time
ensure you can enable/disable each single weapon
on weapon switch disable the current one and enable the new one.
D) equip a weapon
have an “usage design” that works with exactly one weapon. All fitting weapons need to be able to work with that design.
On weapon switch disarm the current weapon and arm the new one.
The difference to B) is that the weapon does not react on user input directly. The “usage” talks with the user and the currently equipped weapon. This way not-equipped weapons will not get input for fire (or reload or whatever). The difference to A1) is that you keep a part of the weapon while exchanging a another part. It means the weapon consists of several objects (exchangeable and non-exchangeable).