Page 1 of 1

Creating a sliding door with Rube

Posted: Mon Nov 11, 2013 12:39 am
by Coder_for_Life22
Could someone explain how to create a sliding door with rube?

Re: Creating a sliding door with Rube

Posted: Mon Nov 11, 2013 1:30 am
by iforce2d
This is probably a good place to start:
RUBE editor tutorial 13/17 - Prismatic joints

Re: Creating a sliding door with Rube

Posted: Mon Nov 11, 2013 2:32 am
by Coder_for_Life22
Yes, i watched this.

The problem is, i know how to enable the motor for going up or down, but i am not sure how to make it go up and down.

Re: Creating a sliding door with Rube

Posted: Mon Nov 11, 2013 6:06 am
by iforce2d
It's a good idea to mention these things when asking a question so that people don't waste their time (and yours) giving you suggestions for things that you already know:
1. What are you trying to do?
2. What have you tried already?
3. What went wrong?

Three settings work together to make a prismatic joint move. As long as you set the joint to be enabled, set the max force to a value high enough to move the bodies involved, and give it a non-zero speed, it should move. In your program, you can change the speed at runtime to make it move in different directions.

Re: Creating a sliding door with Rube

Posted: Fri Nov 15, 2013 11:42 pm
by Coder_for_Life22
Ok,

Here is the problem.

I am trying to create sliding door(opening and closing).

I have watched the video on prismatic joints and i have door closing.

I just cant figure out how to get it to open, then close, open, then close.

Help on creating this would be greatly appreciated.

Re: Creating a sliding door with Rube

Posted: Sat Nov 16, 2013 10:14 am
by iforce2d
Well as I mentioned already, you can change the speed at runtime to make it move in different directions. Did you try that?

For example:

Code: Select all

//moves joint one way
doorJoint->SetMotorSpeed( 1 );

//moves joint the other way
doorJoint->SetMotorSpeed( -1 );

Re: Creating a sliding door with Rube

Posted: Sat Nov 16, 2013 8:41 pm
by Coder_for_Life22
Awesome!

Works perfectly.