#Guys how do I detect collisions on an Instanciated Object?
1 messages · Page 1 of 1 (latest)
Theoretically yes but the simplest approach would be to use the physics engine - i.e. an OnTriggerENter or OnCollisionEnter callback. That would mean putting the script that detects the collision on the projectile itself or on the object the projectile collides with.
putting it on the projectile itself would be simplest
Then how could I transmit information from the script that shoots the sphere, like status effects and damage(I made more magics than just water)?
WIth a simple method call
e.g.
[SerializeField] Projectile projectilePrefab;
void Shoot() {
Projectile projectileInstance = Instantiate(projectilePrefab);
projectileInstance.Init(/*whatever data you want to pass to the projectile*/);
}```
just make a function with whatever inrformation you want to pass as parameters, and call it
Ok time to test that