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
63
S
22
G
14
Posts: 1,482
Reputation: 16,432

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
21
S
5
G
3
Posts: 65
Reputation: 3,789

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
55
S
15
G
5
Posts: 163
Reputation: 7,780

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
55
S
15
G
5
Posts: 163
Reputation: 7,780

Previous

Return to How do I....?

Who is online

Users browsing this forum: QuantumMMX and 11 guests