'Thrust' Physics

This forum is currently in read-only mode.
From the Asset Store
Simple yet very life-like rag doll made with Physics!
  • Also found this which outlines the necessary formula from the looks of it - however it might also use parts of Box2d that aren't implemented in the Construct physics behaviour... unless there's a workaround?

    http://www.box2d.org/forum/viewtopic.php?f=3&t=3071

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • A solution for the jitter would be to stop the motion and point to the target when the angle difference and angular velocity are lower than some thresholds.

    Add this event to the "targeting" group:

    + System: AngleDiff(turret.Angle, turret ('target')) Lower than 0.5
    + System: abs(turret[Physics].AngularVelocity) Lower than 0.2
    -> turret: Set torque 0
    -> turret: Set angular velocity to 0
    -> turret: Set angle to 'target'[/code:1pqycuqz]
  • Going back to the original topic of this post, (and reviving an old thread, sorry)--

    I modified the original file as per ROJOhound's suggestions here:

    The nice thing about using behaviors is you don't need to worry about TimeDelta, because it's handled within the behavior.

    You can simplify your events and it will behave exactly the same and be more readable:

    + MouseKeyboard: Key Up arrow is down
    -> Sprite: Set force Sprite.value('Thrust') towards (Sprite.X + cos(Sprite.Angle), Sprite.Y + sin(Sprite.Angle))
    + MouseKeyboard: Key Left arrow is down
    -> Sprite: Set torque 0-Sprite.value('Rotation')
    + MouseKeyboard: Key Right arrow is down
    -> Sprite: Set torque Sprite.value('Rotation')[/code:1xvb5vvc]
    

    But I'm still confused as to how to use behaviors to slow the ship down QUICKLY once you let go of either the left or right arrows... There are two private variables in this CAP. Thrust and Rotation. Should I be trying to subtract from Rotation over time once the left or right key is no longer pressed??

    How would that look?

    Sorry for the new-b questions... It's just that I am, in fact, a new-b... Just found this site yesterday. Trying to learn what I can.

    Thanks!

    Also, for completeness sake, here is the file I modified according to the above suggestions:

    http://www.mediafire.com/file/yvlw4fo5sfqfuj5/Ast_Physics_4.cap

  • use custom movement for thrust based physics.

  • use custom movement for thrust based physics.

    I know a little about Custom Movement... I went ahead and added it to the Sprite. There are settings for adding friction to motion rotation. But that doesn't seem to be getting me anywhere...

    Is there a separate Custom Movement for thrust based physics that I just don't know about??

    I can get the ship to STOP COLD when I release the left or right key -- by adding"

    + MouseKeyboard: [negated] Key Left arrow is down
    + MouseKeyboard: [negated] Key Right arrow is down
    -> Sprite: Set angular velocity to 0[/code:2o396juc]
    
    But again... I just want it to slow down the rotation faster once you let go of the left or right key.
    
    I'm happy to go check out any tutorials/examples/faqs or whatever if you could point me in the right direction... Thanks!
  • I guess I should be using something like this, from earlier in the thread:

    For angular deceleration:

    + MouseKeyboard: [negated] Key Left arrow is down
    + MouseKeyboard: [negated] Key Right arrow is down
    -> Sprite: Subtract 2*'AngularVelocity'*TimeDelta from 'AngularVelocity'
    [/code:6idciyi5]
    2 is the deceleration amount .
    
    On a side note the physics behavior is way better suited for this type of movement, as it takes very little to set up.
    

    But I can't seem to find the "Subtract from Angular Velocity" action anywhere under physics or custom movement... The only Subtract I can find is for Private Variables.

  • I figured it out... For future generations, here is how I did it... Taking a cue from this post:

    For angular deceleration:

    + MouseKeyboard: [negated] Key Left arrow is down
    + MouseKeyboard: [negated] Key Right arrow is down
    -> Sprite: Subtract 2*'AngularVelocity'*TimeDelta from 'AngularVelocity'
    [/code:23e4zr41]
    2 is the deceleration amount .
    
    

    But unable to find a "Subtract from" action that I could apply to the Angular Velocity (the system action Subtract Value didn't seem to due anything!) I ended up just using the Set Angular Velocity action provided in physics and writing it this way:

    + MouseKeyboard: [negated] Key Left arrow is down
    + MouseKeyboard: [negated] Key Right arrow is down
    -> Sprite: Set Angular Velocity to Sprite[Physics].AngularVelocity-2*Sprite[Physics].AngularVelocity*TimeDelta [/code:23e4zr41]
    
    Same math, reversed. Works like a charm... I upped the 2 to 6 in the final version, as I was really just looking for a tiny bit of oversteer...
    
    Here is the final file for completeness sake... Thanks for the help!
    [url]http://www.mediafire.com/file/qhidv6b1efk1auh/ShipControl.cap[/url]
Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)