Problem with Physics behaviour

Get help using Construct 2

Post » Wed Sep 21, 2016 9:27 am

Hey guys, i'm having a problem:

I'm doing a game where you can control the vertical position of an object like a plane (just vertical because the background will scroll continually at a constant speed).
Obviously the object is gravity affected, my problem is that i don't know how make the plane points toward the direction is flying.
I could make something like "every x sec/every tick rotate the plane to position ..." but like this isn't real and it's ugly to see.

I hope you can help me
B
4
Posts: 6
Reputation: 212

Post » Wed Sep 21, 2016 11:19 am

I suppose you have the forces right. Wich in my head is not that easy. You have the lift force, a vector 180 degrees on the gravity vector. And the force that make it move, vector aligned with the plane. Because they happen at the same time, you should combine both vectors in 1 force. Think my math will try and error and mostly error a while before i get that right.

The angle of the plane, on the other hand, seems easy. When its falling, it turns clockwise. When its gooing up, it turns counter clockwise. The physics expression VelocityY tells you if it goes up or down. I geuss you set the angular velocity arcording to the VelocityY. something like (-1 * VelocityY) / x. Where you have to find out what x must be to have a nice rotation.
B
33
S
18
G
28
Posts: 2,493
Reputation: 20,950

Post » Wed Sep 21, 2016 6:35 pm

99Instances2Go wrote:I suppose you have the forces right. Wich in my head is not that easy. You have the lift force, a vector 180 degrees on the gravity vector. And the force that make it move, vector aligned with the plane. Because they happen at the same time, you should combine both vectors in 1 force. Think my math will try and error and mostly error a while before i get that right.

The angle of the plane, on the other hand, seems easy. When its falling, it turns clockwise. When its gooing up, it turns counter clockwise. The physics expression VelocityY tells you if it goes up or down. I geuss you set the angular velocity arcording to the VelocityY. something like (-1 * VelocityY) / x. Where you have to find out what x must be to have a nice rotation.



Thank you for the reply.
Yes i'm currently using forces, i was thinking about using the bullet behaviour, i saw that the rotation is already integrated... it's possible to affect the path of a bullet like object?
B
4
Posts: 6
Reputation: 212

Post » Wed Sep 21, 2016 9:00 pm

Bullet has the action 'Set angle of motion'. Effect its path = effecting the angle of motion.
Bullet also can have gravity. With the action 'Set gravity'.

I suppose you can set the gravity to something like (1/ Sprite.bullet.Speed) * (x^2), the x you have to try and error your self. (some math maniacs in here dont geuss)
Got to make an exception for when Sprite.bullet.Speed = zero, to avoid dividing by zero. So, how bigger the speed, how smaller the gravity.

Assuming that you try to fly the thing.

The rotation, i indeed think, aligns to path.
B
33
S
18
G
28
Posts: 2,493
Reputation: 20,950

Post » Wed Sep 21, 2016 9:14 pm

Then again. That interface will be to difficult. You ask about physics, and i got my mind set on physics. Just forgot that a plane can be steered at full speed into the ground.

So, when the thing travels always at the same speed, a bullet would be the easy way. Just point it up to climb, or down to fall.

If you make a new project, and type 'endless' in the searchbox, there is a flyer template.
B
33
S
18
G
28
Posts: 2,493
Reputation: 20,950

Post » Thu Sep 22, 2016 7:43 am

thank you, i'll give it a look
B
4
Posts: 6
Reputation: 212

Post » Thu Sep 22, 2016 8:40 am

Hey, i'd like to thank you for the support, at the end i made it. I used 2 variables to memorize x and y, then at every tick i set the angle at atan((Player.Y-yp)/(Player.X-xp)) in this way you perform a little calc on the segment between the old position and the actual position and with atan you find the angle. Math enthusiast here too.

Bye
B
4
Posts: 6
Reputation: 212


Return to How do I....?

Who is online

Users browsing this forum: Team EternaL and 25 guests