Working with bullet type objects

Hi guys i was wondering if any scripts are available or anyone could point me in the right direction here.

I want to make my character be able fire objects (visible) in the direction that they are facing and for them to be able to travel x far.

The object is a model of a ball that the player throws and can hit objects with.

It is a thrid person game and you can fire as many balls as you want at any time.

Thanks Very much for reading and any help or advise you can give me!

  • Are the balls under the laws of physics (gravity) ?
  • What kind of velocity (very fast, average) ?
  • What kind of trajectory ?

Maybe you should follow the TornadoTwins tutorial series on youtube… There you can see how to shoot balls.

Thanks guys for your quick reply!

No physics just straight a head.
Velocity would be average a bit fast.

For trajectory it would be the way the player is facing basically from that point straight ahead a certain distance pretty far.

Thanks again!

Go to the showcase forum and check out my post named (script)weapon control script. That should work great for you

It looks really good but i can’t get it to work at the moment.

the error is

NullReferenceException
WCS_Master.ShootWS1 () (at Assets\Scripts\WCS v1_0\WCS_Master.js:46)

refering to
var clone : Transform = Instantiate(WeaponSlot1,GameObject.Find(“WeaponSlot1”).transform.position,transform.localRotation);

why would this be i have set the prefab to the weapon slot, does the prefab need to be in the hierarchy because atm its just in my project pannel.

You need to create a prefab like a sphere and apply the prefab to the weaponslot1 in the inspector. Apply this to the object that has the wcs_master script. You also need a empty game object named weaponslot1. This will be the point of origin for the prefab.
So place this where you want pre fab to shoot from.

I’m typing this on my iPhone at work. When I get home I can post some pics

I fixed the instructions on the WCS page. I had left out the part about creating a empty gameObject named WeaponSlot1. Sorry about that. If you follow the instructions on the script forum you should be ok now. Let me know if you need more help setting it up.

Thanks at first it didn’t work and then i added a rigid body to the projectile and it works perfectly!

Thanks this script is really good!

Actually its not working correctly, i can’t get

// Dont collide with the player
Physics.IgnoreCollision(clone.collider,transform.root.collider);

to work at all, it just hits my players collider everytime? Can you please help me on this problem?

Hum…This script is on the player ?

Yes the script is on the player and its from ForceX’s excellent WCS.

Edit: Got it working!