Topic: Projectile Offset Issue

http://youtu.be/GCAo5gmKg-w

Im currently creating sprite for the fireballs for the game.....
when i add the projectile, they always fire from the same physical point in the scene.

Here are my settings
http://i.imgur.com/Xu4xtas.jpg

Share

Thumbs up Thumbs down

Re: Projectile Offset Issue

Ah, I think I figured this out.  Do you have your Right Hand assigned in your hitbox set up?  The projectile is trying to instantiate from the right hand, but if no right hand has been assigned then it will default to world 0 on instantiating.  I just tested my projectile by assigning to Custom 7 which isn't assigned to anything and got the same results in your video. wink

Since you have two heights of fireballs, my guess is the yellow one isn't a prefab at world 0?  Check all child objects of your prefab.

Share

Thumbs up +1 Thumbs down

Re: Projectile Offset Issue

you sir..... are a genius

Share

Thumbs up Thumbs down

Re: Projectile Offset Issue

another issue...
ha..... getting there....  when i jump tyo the other side of the opponent the fireballs are backwards... they are not mirroring..

another amazing video:
http://youtu.be/FfX2N9EFwq0

Share

Thumbs up Thumbs down

5 (edited by YumChaGames 2015-04-03 21:41:03)

Re: Projectile Offset Issue

That is correct, projectiles do not mirror. 

Test your projectile in Scene view by dragging it around:

  • If trail follows behind it correctly, then you're fine.

  • If the trail does not follow behind and stays in set orientation, either modify particle effect so it follows behind or you'll need to modify some code to get it working.

Looking at ProjectileMoveScript.cs, I think adding:

transform.localScale = new Vector3(transform.localScale.x * -mirror, transform.localScale.y, transform.localScale.z);

// below line is in case angled projectiles don't mirror correctly
transform.localEulerAngles = new Vector3(transform.localEulerAngles.x, transform.localEulerAngles.y, transform.localEulerAngles.z * -mirror);

in the Start() method just after the transform.Translate() line should work.  But depending on how your projectile is generating its effect, this might not be enough for it to look right.  Yours looks to be 2D, so this might work for you.  Just make sure the pivot of the projectile object is the middle of the ball part and not the flame part.

EDIT: added line for angled projectiles.

Share

Thumbs up Thumbs down

Re: Projectile Offset Issue

the effect is baked into the sprites...
i cant code btw... this is a hatchet job. lol.
ill have a go at putting it in but i doubt ill be able to... lol.

Share

Thumbs up Thumbs down

Re: Projectile Offset Issue

https://www.evernote.com/shard/s31/sh/a2fcde27-9e63-41d2-9457-6279f996b696/ead897c2dfaac02522ca674e1a239984/res/4355906f-6502-4f7a-8cb4-dbfa7f9c41ff/sheet2.png?resizeSmall&width=832&alpha=

Share

Thumbs up Thumbs down

Re: Projectile Offset Issue

im on pro not source so cant edit the code it would seem.

Share

Thumbs up Thumbs down

Re: Projectile Offset Issue

Ah, damn.  OK, your best bet is to create your projectile as a particle effect that is independent of direction.  Look into Unity tutorials on how smoke trails and jet engine boosters are done using the Shuriken particle system, I think that's a good basis to start with and should translate easily to creating basic projectile.

It won't look like your 2D one though, but will work nicely in any direction.

Share

Thumbs up Thumbs down

Re: Projectile Offset Issue

I've updated the mod to consider angled projectiles.

Share

Thumbs up Thumbs down