|
Post by wa5hburn on May 30, 2017 9:13:54 GMT
Hi, I am using DTCGK, actually just poolboss. I am struggling to alter this code so I can use poolboss: So, I need a advice on how to alter the code to use poolboss and not instantiate. Any help appreciated guys  Rigidbody bullet = (Rigidbody)Instantiate(projectile, transform.position + transform.forward, transform.rotation); bullet.AddForce(transform.forward * bulletImpulse, ForceMode.Impulse);
|
|
|
Post by wa5hburn on May 30, 2017 19:54:05 GMT
AnyBody ?
|
|
|
Post by DarkTonic Dev on May 30, 2017 23:30:01 GMT
PoolBoss uses Transform component as both input and input, instead of GameObject like Instantiate. So if you wanted to get to the Rigidbody, you'd do it like this, assuming projectile is a GameObject (you didn't specify what it was):
var spawnedTransform = PoolBoss.SpawnInPool(projectile.GetComponent<Transform>(), transform.position + transform.forward, transform.rotation); if (spawnedTransform != null) { // check if it was actually spawned or not (in case you hit your pool item max). RigidBody bullet = spawnedTransform.GetComponent<Rigidbody>(); // now the rest of your code as is. bullet.AddForce(transform.forward * bulletImpulse, ForceMode.Impulse); }
Sorry for the late response. I didn't see it this morning when I checked for some reason.
|
|