#Courageandfire's issue

1 messages · Page 1 of 1 (latest)

steady rose
#

What is the purpose of public int number;?

#

@gray raven

gray raven
#

number of dots being created

steady rose
#

So, are those many little dots supposed to be some kind of targeting system? I'm wondering if none of this code was designed to launch a projectile.

gray raven
#

wait.

#

no

#

nvm. It is the number of balls. Got confused there for a minute

#

this code is to only create a projectile path. I am using another script for the projectile.

#

kind of like angry birds game?

steady rose
steady rose
#

Gotch!

gray raven
#

but i dont think i can get an animation. So trying to get movement

#

add*

steady rose
#

So, you need a reliable way to know when a ball is small enough to destroy, but what would probably do is just have a sort of code-first "animation" that doesn't really destroy balls, but rather just draws a known number of them with a bit of translation.

#

Are you familiar with Mathf.Lerp?

gray raven
#

I am not really supposed to share this. but oh well fuck it, u see the projectile right?

gray raven
#

I am trying to replicate the projectile path in this game

steady rose
# gray raven I am not really supposed to share this. but oh well fuck it, u see the projectil...

Okay, so what I would do is draw those balls along a spline. If we imagine that you have 10 balls, their relative placements would be like [0.0, 0.1, 0.2, 0.3 0.4, 0.5, 0.6, 0.7, 0.8, 0.9] This is the case when the nearest ball has just spawned. On a frame where the tenth ball is about to spawn out, their positions might be [0.09, 0.19 ... 0.99] etc. My point being that as the last ball disappears, a new ball spawns. This means you always have 10 balls to draw, so spawn/destroy logic is not needed.

gray raven
#

how about the position? how to make the 1st ball go to the 2nd position? lerp?

steady rose
#

Do you want the behaviour in that TapTap example where obstacles limit the length of the effect?

gray raven
#

ya?

steady rose
#

Okay, so if I understand how your object works, it lives at the world position where the projectile would fire from... is that correct?

#

So in other words, moving the mouse affects where in the world it lives if it's anchored to another object, like on a hinge.

gray raven
#

I am taking the sphere as the reference, and instantiating from its position, 0-10 balls spawning in the opposite direction of the sphere. on mouse down

steady rose
#

So a couple difficulties with your script as it stands now is that the length of your line isn't well known, which would make it hard to implement that blocker effect. We need to know the furthest point where the last ball will be drawn before we place any of the balls in order to achieve this - best even if the number of balls is variable according to the space available.

#

Second of all, your strategy is to multiply the scale towards zero, which will make it hard to determine at what final scale the last object is "close enough" to zero to avoid it popping out of existance. This is messy and will make your math more complicated as you try to animate it smoothly.

gray raven
#

not entirely, The length depends on the force being applied on the ball.

        new Vector2(-forceAtPlayer.x * forceFactor, -forceAtPlayer.y * forceFactor) * elapsedTime + //ut
        0.5f * Physics2D.gravity * elapsedTime * elapsedTime;```
#

endpos is the mouseposition.

#
        Vector3 birdForce = (currentPosition - center.position) * force * -1;
        bird.velocity = birdForce;

        bird.GetComponent<Bird>().Release();

        bird = null;
        birdCollider = null;
        StartCoroutine(CreatingBird());```
steady rose
#

OH okay, your comments got me there. That's your physics calculation for the projectile... perfect! We can just keep that and refactor the Update loop. The three lines + comments looked a bit hard to read in notepad++. Is that your IDE?

gray raven
#

no. VC community

steady rose
#

Ahh, the colours and font look like Notepad++.

gray raven
gray raven
steady rose
#

So can we assume that slightShotRef.currentPosition is the point where your aiming widget touches a blocker, or is it just the point where the user is aiming?

gray raven
#

this should help. its the slingshotref script.

#

u there dude?

steady rose
#

I am here.

gray raven
#

got any solution?

steady rose
#

Do you want the effect to aim where the cursor is or do you want the cursor to just inform the initial direction before gravity gets factored in?

gray raven
#

its already aims where the cursor is pointed at tho

gray raven
steady rose
gray raven
#

i am clamping the distance.

#

bro, is it okay if I can add u as a friend and just screen share? it's kind of getting complicated and confusing to explain. english isn't my forte. 😅