Magic

devomage

Member
How do you spawn multiple MagicProjectile?

For example, if you want to spawn 2 Fireball side-by-side in the same cast? The prefab didn't look friendly in this aspect. Should I override Cast and spawn multiple prefabs?
Add more than one cast action. !

Also, how would you handle a spell like "Tornado" where I previously used UnityEngine.CharacterController. The spell falls to gravity, when IsGrounded it moves (up stairs, etc) until impact.
 
Last edited:
You can still use UnityEngine.CharacterController for your tornado effect. In this case you can either use the Spawn Object action, or if you need some initialization you could duplicate the Spawn Object action and modify it a bit for those initialization parameters.
 
Thanks for the Tornado advice.

Follow-up question. When spawning more than one "Spawn Projectile" - the projectiles converge at the target point. Is there a way to make the target point keep the position offset? For example, if 2 projectiles spaced 1 Y and -1 Y were shot at an enemy and the enemy was 1 unit in diameter. the projectiles would then pass by him.
 
Also, if you spawn 2 Fireball with (0,1,0) and (0,-1,0) offset. In 3rd person the projectiles appear horizontal and in 1st person they appear vertical.

I replaced the Fireball particle with a 0.2 scaled sphere for easier visual debugging.

Edit: I notice that the positioning of the projectiles are not uniform. In 3rd person the left side is slightly elevated compared to the right. 1st is also out of position. It almost looks like the camera position also makes a difference - aiming up vs aiming down. Shooting in the same spot shows the left projectile moving it's start position.

If you try to cast into empty space it doesn't work. I tried to set the collision layer to Everything and still no cast.

projectiles_gone_mad.gif
 
Last edited:
When spawning more than one "Spawn Projectile" - the projectiles converge at the target point. Is there a way to make the target point keep the position offset? For example, if 2 projectiles spaced 1 Y and -1 Y were shot at an enemy and the enemy was 1 unit in diameter. the projectiles would then pass by him.

Right now there isn't, but these are exactly the feature requests that I'm looking for with the magic items since it is so new. Version 2.2.1 is all about fixing existing features, but I should be able to get this in 2.2.2.

Also, if you spawn 2 Fireball with (0,1,0) and (0,-1,0) offset. In 3rd person the projectiles appear horizontal and in 1st person they appear vertical.

I replaced the Fireball particle with a 0.2 scaled sphere for easier visual debugging.

Edit: I notice that the positioning of the projectiles are not uniform. In 3rd person the left side is slightly elevated compared to the right. 1st is also out of position. It almost looks like the camera position also makes a difference - aiming up vs aiming down. Shooting in the same spot shows the left projectile moving it's start position.
The spawn origin is different between first and third person. Are the transforms in the same relative position between perspectives?

If you try to cast into empty space it doesn't work. I tried to set the collision layer to Everything and still no cast.
If target can't find a target then the cast will not happen. Maybe it should have a fallback?
 
If target can't find a target then the cast will not happen. Maybe it should have a fallback?

I think the only time a Cast should not happen is if there is not enough resource/power. However that happens, idk. In any case, a "nocast" sound of some sort is mandatory.

The spawn origin is different between first and third person. Are the transforms in the same relative position between perspectives?

I'll spend more time with this and post a new thread if needed. There should be no change between perspectives? For example, if you want 2 projectiles side by side horizontally. I'll also be trying for a fan of projectiles (8-12?) where there will be no position offset; but have a 15 or so degree difference from left to right.


Debug of a new SpawnBolt CastAction! Work in progress...

BoltDebug.png
 
Last edited:
Top