Math for projectile relative to speed and angle

Get help using Construct 2

Post » Mon Mar 12, 2012 5:06 am

@R0J0hound
Oh! Seeing your fix, I see how wrong the movement was now. And not using bullet for now will probably be simpler than a sprite following another sprite as I just suggested.
B
60
S
22
G
14
Posts: 1,479
Reputation: 16,346

Post » Tue Mar 13, 2012 12:39 am

@Yann & @R0J0hound

Thank you both for your help. I've got my missile working just the way I want it to. I'm glad to hear part of my problem is a bug because I was beginning to go crazy trying to figure out what was wrong. Hope it'll be fixed soon.
B
20
S
5
G
3
Posts: 65
Reputation: 3,764

Post » Sun Jan 27, 2013 5:57 am

This is probably a little late but I found an easier solution...

Add physics behavior to the bullet and spaceship behavior to the ship
The bullet's physics should have no friction or dampening or gravity (obviously)
When you spawn the bullet
Apply physics impulse (some small number like 3.5 or something)
Apply physics impulse (ship.Spaceship.VectorX/100,ship.Spaceship.VectorY/100)

It works perfectly and no trig or extra variables needed!
Follow my CZero development on twitter https://twitter.com/CaptainZeroGame
B
38
S
9
G
3
Posts: 149
Reputation: 5,986

Post » Sun Jan 27, 2013 6:02 am

...the first physics impulse is apply physics impulse at angle(ship.angle)
Follow my CZero development on twitter https://twitter.com/CaptainZeroGame
B
38
S
9
G
3
Posts: 149
Reputation: 5,986

Previous

Return to How do I....?

Who is online

Users browsing this forum: Mirlas, TELLES0808 and 22 guests