0 Favourites

Problem with Physics behaviour

  • 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

  • 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.

  • Construct 3

    Buy Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Buy Now Construct 3 users don't see these ads
  • 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?

  • 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.

  • 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.

  • thank you, i'll give it a look

  • 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

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)