0 Favourites

How do I rotate rocket's angle smoothly towards object?

  • Hi,

    I am working on a project and I need some of you talented people to help me out a little. First Download and run the .capx file I'm attaching with this post to have a better idea of what i'm asking for.

    So Basically, My rocket is floating in Space where's there's no gravity. The controls are keyboard "UP Arrow" to fly upwards and Keyboard "Down Arrow" to fly downwards to avoid obstacles. I have added physics, set world gravity to 0 and added Linear Damping to my Spaceship so if you move upwards, you will keep going.

    However, I can't figure out one thing. I want to achieve this

    [quote:m509inac]1. Whenever I press and hold the direction button (Up or Down), lets say for example 'Up Arrow', I want the tip of the spaceship's nose to start tilting towards the marked point A on the layout. As long as I keep holding down the UP Arrow, the ship should smoothly tilt towards the A mark. Similarly, Holding down the 'Down Arrow' button should do the same but starting to tilt the nose of the spaceship towards marker B on the layout.

    I don't want it to be a sudden thing, I want it be in a flow and gradually start curving down as long as i'm pressing the button. If opposite button is pressed then the force of angle should shift upwards smoothly incriminating.

    Construct 2 Working File

    goo.gl/JAidbt

    I hope you guys understand what i'm trying to say. If not then download the .capx file and you will be absolutely clear on what I want.

    Screenshot

    Full Screenshot: s17.postimg.org/sapc3pp7z/Capture.png

    Construct 2 Working File

    goo.gl/JAidbt (Dropbox Download)

    Example Game

    youtube.com/watch

    Watch it from the middle when the rocket is flying. However, in my game there's no gravity so the ship should only turn downwards when down arrow is pressed.

    Any help will be greatly appreciated.

  • Is there a specific reason why you use physics behaviour for this and not bullet?

    Of you were to use bullet behaviour, I would just use rotate clockwise or counterclockwise, depeniding on up ot down pushed..

  • Is there a specific reason why you use physics behaviour for this and not bullet?

    Of you were to use bullet behaviour, I would just use rotate clockwise or counterclockwise, depeniding on up ot down pushed..

    Physics Behavior is given to create space environment because I wanted to set the gravity to zero. Watch the youtube video I posted at the end of my post. You can see how the rocket start turning up and down tilting it from the nose.

  • I saw the video and as far as I can see, there is no need for physics behaviour, that is why I asked..

    In Construct2 the bullet-behaviour and the platform behaviour also have gravity, but you said you set the gravity to 0 in your game, so even gravity wouldn't be a reason for the physics behaviour..

    A simple bullet- behaviour should work just fine in my opinion..

    Rotate 1 degrees counter-clockwise when pushing up

    Rotate 1 degrees clockwise when pushing down

  • 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 saw the video and as far as I can see, there is no need for physics behaviour, that is why I asked..

    In Construct2 the bullet-behaviour and the platform behaviour also have gravity, but you said you set the gravity to 0 in your game, so even gravity wouldn't be a reason for the physics behaviour..

    A simple bullet- behaviour should work just fine in my opinion..

    Rotate 1 degrees counter-clockwise when pushing up

    Rotate 1 degrees clockwise when pushing down

    But if I don't use the physics behavior, how would I create the linear damping. Secondly, the platform scrolls and the player stays stable on the screen because I want to generate random obstacles.

    I have found the solution to my problem though. I used when key "up" is pressed > Rotate Toward Angle

  • hi ganich , are you found the solution? if yes, say the way please.

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