Stencyl 3.4.0 is now out. Get it now!

Joints Extension

Demkamen

  • *
  • Posts: 124
This extension is amazing. The only thing missing is a gear joints. This joint is very popular in many puzzles games. Hopefully in the future it will be? I would like to use it now!)))

UnrealCanine

  • Posts: 242
How does the target setting for mouse work? It either seems to lock in place or wants to fly into space, and doesn't follow the mouse at all

captaincomic

  • *
  • Posts: 6108
You create a mouse joint with the actor you want to pull. Then (in "always") set the target to the location that you want to pull it to.

You can also take a look at the Drag with Mouse Joint behavior in the "Joints Sandbox" example game on StencylForge.

captaincomic

  • *
  • Posts: 6108
This extension is amazing. The only thing missing is a gear joints. This joint is very popular in many puzzles games. Hopefully in the future it will be? I would like to use it now!)))
I added blocks for pulley joints now, but I didn't get gear joints to work yet.

Demkamen

  • *
  • Posts: 124
perfectly. Nice to see that the extension is getting better

captaincomic

  • *
  • Posts: 6108
Btw. the code for gear joints is in the extension, commented out. If you want to try it you can uncomment it (in blocks.xml and Joints.hx). When I tried it, it just didn't do anything for some reason...

Demkamen

  • *
  • Posts: 124
I removed the "comments". Extension is not installed now  :( I read the FAQ about box2d http://www.box2d.org/manual.html:
"Here is an example gear joint. The bodies myBodyA and myBodyB are any bodies from the two joints, as long as they are not the same bodies."

b2GearJointDef jointDef;

jointDef.bodyA = myBodyA;

jointDef.bodyB = myBodyB;


jointDef.joint1 = myRevoluteJoint;

jointDef.joint2 = myPrismaticJoint;

jointDef.ratio = 2.0f * b2_pi / myLength;

I did not see the "body" in your code, can be the reason?

captaincomic

  • *
  • Posts: 6108
That may be the problem, but in the haxe port of Box2D, there are no body fields to set:
http://static.stencyl.com/api/31/types/box2D/dynamics/joints/B2GearJointDef.html
I think the bodies are taken from the joints, and have to be the first body of the joint.

mat0pad

  • Posts: 364
Thanks for making this!

How can I draw a joint (not debug draw). I want to draw a joint and fill it with a black color? Is this possible?
   


                              

UnrealCanine

  • Posts: 242
Do you think it's possible to use revolve joints as a make-shift skeletal animation system?

LIBERADO

  • *
  • Posts: 2068
This is an excellent extension with great potential.
I'm spanish, excuse me for my bad English.
I'm not a private teacher. Please, post your questions in the public forum.

LIBERADO

  • *
  • Posts: 2068
@captaincomic, please, help me.

When I was trying to create a pulley joint, I have found this issue:

« Last Edit: September 19, 2014, 06:46:33 pm by LIBERADO »
I'm spanish, excuse me for my bad English.
I'm not a private teacher. Please, post your questions in the public forum.

captaincomic

  • *
  • Posts: 6108
@UnrealCanine
I was playing around this that idea too. I think it could be possible but pretty hard to pull off. Performance might also be a problem with lots of joints, so it wouldn't be something to use for all animations in general. Maybe I try something in the future again...

@Liberado
Thanks. Looks like a bug in the block definition. I'll try to fix it soon. 

LIBERADO

  • *
  • Posts: 2068
@Liberado
Thanks. Looks like a bug in the block definition. I'll try to fix it soon. 
Ok, thanks you for responding. I'm glad you are going to fix it.

By the way, I have tried all types of joint, and I have found that the line and prismatic joints seem to not work.

In Stencyl 3.1.0 (b7305), even in the simplest situation, in an completely empty project, with only one actor (a simple 32x32 blue square created in Pencyl) manually placed in the empty scene with vertical gravity, and no other code blocks, only one of these code blocks placed in the scene or in the actor:

create line joint between [Actor] at ( x: 0 y: 0 ) and scene with axis (x: 10 y: 1 )
or
create prismatic joint between [Actor] at ( x: 0 y: 0 ) and scene with axis (x: 10 y: 1 )

I've tried both joints many times, using different coordinate values, but they always produce the same defective result: the actor disappears, blinks and abruptly jumps to random remote positions, or just the game inmediately crashes and displays only a black screen.

The other joint types (mouse, distance, revolute and weld) work well.

I am very interested in that these failures are repaired because this is a VERY important extension since it has a lot of potential and is very useful for many purposes.

So I would be very grateful to captaincomic if he fixes it.

« Last Edit: September 20, 2014, 09:46:13 pm by LIBERADO »
I'm spanish, excuse me for my bad English.
I'm not a private teacher. Please, post your questions in the public forum.

MeToo

  • Posts: 338
Such a great extension, enables a ton of cool ideas, and simplifies a lot of others.

Two questions:

1. Is there a way to add an elasticity to the revolute joints? Like a bungee jumper would experience from a tower?

2. What would you consider the best way to animate the invisible bond of such joints? Again using the bungee jumper and his bungee as an example.

Edit: Also, what do the "limits" of the revolute joints refer to?