Stencyl 3.4.0 is now out. Get it now!

Joints Extension

id8games

  • *
  • Posts: 184
Hi Captaincomic,

Is there a way to create a "stretchy" distance joint? Almost like a spring action?
Also what are the minimum and maximum limiting values for [set damping ration of distance joint] ?
This extension is brilliant!

captaincomic

  • *
  • Posts: 6109
Hi

I think this will answer both your questions:
Quote from: Box2D manual
The distance joint can also be made soft, like a spring-damper connection. See the Web example in the testbed to see how this behaves.

Softness is achieved by tuning two constants in the definition: frequency and damping ratio. Think of the frequency as the frequency of a harmonic oscillator (like a guitar string). The frequency is specified in Hertz. Typically the frequency should be less than a half the frequency of the time step. So if you are using a 60Hz time step, the frequency of the distance joint should be less than 30Hz. The reason is related to the Nyquist frequency.

The damping ratio is non-dimensional and is typically between 0 and 1, but can be larger. At 1, the damping is critical (all oscillations should vanish).
Note that the smaller frequency the softer the joint. The manual gives an example with frequency = 4, which creates a nice spring-like effect.

id8games

  • *
  • Posts: 184
I'm loving this extension - just got one small question in relation to the mouse joint.
When I destroy the mouse joint there seems to be a lag in the time the destroy mouse joint is executed and what is displayed in the game. Is there a way to remove this lag? just curious.

captaincomic

  • *
  • Posts: 6109
Could you post a screenshot of your behavior? I'm not noticing any lag when deleting a mouse joint.
You can also try the Drag with Mouse Joint behavior from the Joints Sandbox on Stencylforge to see if that causes lag as well.

id8games

  • *
  • Posts: 184
I've attached screenshot of the behaviour which is attached to an Actor.
Something interesting I noticed is that this lag is only apparent when I test the game in the Flash Player on a Mac Book Pro. On a PC (thru Flash Player) there is no lag and running on an Android device (Galaxy S3) no lag either.

captaincomic

  • *
  • Posts: 6109
Hm, no idea what could be causing the lag. Any errors in the log viewer?

id8games

  • *
  • Posts: 184
I just worked out what the lag is from. On a Mac Book Pro, if you use a mouse while playing the game, then there i no lag. But if you use the touch pad, then there is a lag.

So this lag issue is not from your awesome extension; it's due to how the Mac touch pad works....

Demkamen

  • *
  • Posts: 124
When I turn on this extension, I get the error message: your game could not be built. if nothing shows below, run the game again to see why it failed. My game is not compiled ((

id8games

  • *
  • Posts: 184
captaincomic - have I told you about my game that I developed using your extension?
https://play.google.com/store/apps/details?id=com.id8games.soccer

Many thanks for creating an amazing extension!!

captaincomic

  • *
  • Posts: 6109
@Demkamen
Please post the full error message and your logs. (Debug -> Logs -> Generate Logs)

@id8games
Cool! Looks fun. I'm glad to see this used in a game. :)

Demkamen

  • *
  • Posts: 124
I use a stencyl version of 7372. So I tried many other versions.

captaincomic

  • *
  • Posts: 6109
I think the problem is the folder name of the parent of StencylFolder on F:
Quote
[LOG] Error: "F:\Мои документы\StencylFolder\stencylworks\engine-extensions/joints" does not appear to be a valid <include /> path

Try putting your workspace in a path with only ASCII characters.

Demkamen

  • *
  • Posts: 124
incredible. it worked! Thank you. thank you so much!  :)

captaincomic

  • *
  • Posts: 6109
Great! :)

Out of curiosity and for potentially fixing it at some point, what language was that folder?