unity3d - C# - variable speed when using turning joystick -


i making game, using onscreen/virtual joystick. joystick self works fine.

what want when turn joystick, bullet fired in direction. got working too. problems arises when shooting bullet when joystick not @ edge/radius.

when joystick @ edge/radius, bullet move @ maximum speed, want. when joystick is, lets say, somewhere between radius , center of joystick, bullets move slower. logical because of radians , stuff.

but not want. should happen bullets move @ maximum speed.

does know how achieved? stuck @ this.

thanks!

edit: since still dont understand @ all, want have point in radians within circle , want position of point @ edge of circle.

so let's have vector2 in radians.

    vector2(-0.3, 0.3); 

and radius of circle 40.

the length center of circle vector2 point propably somewhere around

    radius = 40 * 0.3 = 12 

now vector2 point when length 40?

i can't seems figure out. trigonometry definetely not strongest point.

i fixed it! multiplied localposition of joystick large number, localposition woul fall outside of radius. use clampmagnitude @ edge of radius. correct behaviour.


Comments

Popular posts from this blog

Unable to remove the www from url on https using .htaccess -