|
Post by karmik101 on Apr 22, 2018 2:18:20 GMT
Hi all I am not very good at coding but somehow managed to get instantiate projectile script working from a player muzzle. Now i am finding it hard to change it to integrate with the pool boss object. I have purchased full core game kit. Can some one please help me give a code sample for this.
I am using syntax something like below
Transform bullet = CoreGameKit.PoolBoss.SpawnInPool(bulletprefab, position,rotation ) I add force after this.
Its saying cannot find bulletprefab.
Can you please help me where i am going wrong.
I just dragged coregamekit prefab which has pool boss and child object. I added the bullet prefab under pool boss object in scene.
|
|
|
Post by DarkTonic Dev on Apr 22, 2018 2:36:03 GMT
bulletPrefab should be a public Transform in your script and you need to drag the exact same prefab there as you set up in Pool Boss. Then it will work.
|
|
|
Post by karmik101 on Apr 22, 2018 3:42:10 GMT
awsome. Working now. below is the code snippet. Hope this might be helpful for noobs like me. Variables: public Transform Player_bullet; public GameObject Player_Muzzle; public float Player_bullet_Forward_Force Function Code to spawn projectile: Rigidbody Temporary_RigidBody; Transform spawnedTransform = DarkTonic.CoreGameKit.PoolBoss.SpawnInPool(Player_bullet, Player_bullet_Emitter.transform.position, Player_bullet_Emitter.transform.rotation); if (spawnedTransform != null) { // check if it was actually spawned or not (in case you hit your pool item max). Temporary_RigidBody = spawnedTransform.GetComponent<Rigidbody> (); Temporary_RigidBody.AddForce (Player_Muzzle.transform.forward * Player_bullet_Forward_Force); } I was thinking maybe you should have a simple script like this in the kit itself to make life easy for people like me 
|
|
|
Post by DarkTonic Dev on Apr 22, 2018 3:53:35 GMT
Well normally you don't need to write any scripts. The spawners will take care of everything.
Glad you are sorted!
|
|
|
Post by karmik101 on Apr 22, 2018 3:57:02 GMT
Well normally you don't need to write any scripts. The spawners will take care of everything. Glad you are sorted! My bad. To engrossed in doing things my own way. Can i check if i can recreate the same bullet shooting behaviour through spawners aswell. Can you please point me to the docs/scene that covers this scenarion
|
|
|
Post by DarkTonic Dev on Apr 22, 2018 15:30:07 GMT
|
|
|
Post by karmik101 on May 9, 2018 6:32:47 GMT
So I figured i can use triggered spawner based on docs. But do we still need to add force on our own. As i could not find any option in the docs for it.
|
|
|
Post by DarkTonic Dev on May 9, 2018 15:06:49 GMT
Yes there are no options for movement except the knockback stuff in Killable.
|
|