'Thrust' Physics

For questions about using Classic.

Post » Fri Dec 10, 2010 6:23 am

[quote="Davioware":2o396juc]use custom movement for thrust based physics.[/quote:2o396juc]

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"

[code:2o396juc]+ 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!
B
4
S
1
G
2
Posts: 64
Reputation: 980

Post » Fri Dec 10, 2010 8:08 am

I guess I should be using something like this, from earlier in the thread:

[quote="R0J0hound":6idciyi5]

For angular deceleration:
[code:6idciyi5]+ 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.[/quote:6idciyi5]

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.
B
4
S
1
G
2
Posts: 64
Reputation: 980

Post » Fri Dec 10, 2010 6:37 pm

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

[quote="R0J0hound":23e4zr41]

For angular deceleration:
[code:23e4zr41]+ 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 .
[/quote:23e4zr41]

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:
[code:23e4zr41]+ 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:23e4zr41]http://www.mediafire.com/file/qhidv6b1efk1auh/ShipControl.cap[/url:23e4zr41]
B
4
S
1
G
2
Posts: 64
Reputation: 980

Previous

Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 0 guests