How do I make an object travel making a parable.

Get help using Construct 2

Post » Thu Nov 12, 2015 11:22 am

Could you please reupload this file again? I have the same problem as OP.
B
3
Posts: 4
Reputation: 181

Post » Thu Nov 12, 2015 11:47 am

@davy421

davy421 wrote:Could you please reupload this file again? I have the same problem as OP.


You need to tag the person in question or they will never know you are asking them. In this case, it looks like you want @Colludium to re-upload the file.
If your vision so exceeds your ability, then look to something closer.
Moderator
B
124
S
29
G
70
Posts: 4,977
Reputation: 49,691

Post » Thu Nov 12, 2015 12:02 pm

Hi @davy421, I'll see if I can find the file for you. However, I fear that some over-zealous folder clearing on a new computer might have sent it to oblivion... In which case give me a while and I'll create a new one.
B
63
S
16
G
63
Posts: 2,170
Reputation: 39,987

Post » Thu Nov 12, 2015 4:25 pm

@Colludium I'm willing to wait, thank you for responding.
B
3
Posts: 4
Reputation: 181

Post » Thu Nov 12, 2015 5:13 pm

@day421, I had deleted the original demo, so try this capx for an alternative method. I actually think that this is better as it gives you the option of having a shadow as well :).
B
63
S
16
G
63
Posts: 2,170
Reputation: 39,987

Post » Thu Nov 12, 2015 9:05 pm

.
Last edited by davy421 on Fri Nov 13, 2015 7:06 am, edited 1 time in total.
B
3
Posts: 4
Reputation: 181

Post » Thu Nov 12, 2015 9:17 pm

@davy421

davy421 wrote:Thank you @Colludium this works great! What I'm trying to do now, is translate this into code into Unity. I'm not sure if you're familiar with it, but I get a bug where the arrows just fly off into space, like rockets. For now, to avoid complexity, I'm not using shadows, but still, no luck. This is the code I'm using:

To set up the arrow (left click in your demo):

Code: Select all
        angleTowardX = target.position.x;
        angleTowardY = target.position.y;
        lastX = transform.position.x; // Get the possition of the arrow
        lastY = transform.position.y;
        launch_time = Time.time;
        Vector2 launcher = new Vector2(transform.position.x, transform.position.y);
        Vector2 aimpoint = new Vector2(target.position.x, target.position.y);
        flight_time = Vector2.Distance(launcher, aimpoint) ; // Not using the shadow bullet speed here
        Y_init_velocity = (float)0.5 * flight_time; // Not using the accelerator here


Each frame I do:

Code: Select all
         time_of_flight = launch_time - Time.time;

        // Set the position of the arrow
        transform.position = new Vector3(transform.position.x, (float)(transform.position.y - Y_init_velocity * time_of_flight + 0.5 * Y_accel * Mathf.Pow(time_of_flight, 2)), transform.position.z);

        // Calculating the rotation
        Vector2 last = new Vector2(lastX, lastY);
        Vector2 current = new Vector2(transform.position.x, transform.position.y);
        // Not sure if this line works correctly, could this be it?
        Quaternion rotation = Quaternion.Euler(Vector2.Angle(last, current), 0, 0);
        transform.rotation = rotation;

        lastX = transform.position.x;
        lastY = transform.position.y;



This forum, and particularly this section, is for questions on C2. If you have questions on Unity, then you should be asking on their forums, rather than here.

Getting a C2 user to go out of their way to create something for you just so you can convert it to Unity is quite frankly a disgrace.
If your vision so exceeds your ability, then look to something closer.
Moderator
B
124
S
29
G
70
Posts: 4,977
Reputation: 49,691

Post » Thu Nov 12, 2015 10:05 pm

:roll:
B
63
S
16
G
63
Posts: 2,170
Reputation: 39,987

Post » Fri Nov 13, 2015 8:58 am

@davy421

Editing out what you posted is pointless - that's why I quoted it. This just puts you in an even worse light.

It would have been better just to apologize and move on.
If your vision so exceeds your ability, then look to something closer.
Moderator
B
124
S
29
G
70
Posts: 4,977
Reputation: 49,691

Previous

Return to How do I....?

Who is online

Users browsing this forum: Miketheboss224, R0J0hound and 1 guest