Rotating platform out of center

Topics: Developer Forum, User Forum
Feb 14, 2012 at 9:35 AM

Hi,

The question is simple, how can i make a rotating platform out of the center, like on the side?

I tried with revolute joint andd so on, but I don't want the platform to get feedback from the other bodies

It must be static and still rotating around a point.

 

tyvm for any help

 

friendly regards.

Feb 15, 2012 at 12:49 PM

Hey,

So do you mean you want the platform to rotate ,but not to collide with other bodies ? If so then you can just use Collision group and categories and set it ,so that the collision between the platform and every other body isn't handled . Like

 platformBody.CollisionCategories = Category.None;

If you meant something else please clarify :)

Feb 15, 2012 at 1:18 PM

Hi,

 

ty for ur answer,

 

but what I mean is, I have a block, which an object can bounce against it, but I want that block to rotate, I can easily rotate the block with body.rotation, but then it turns in center, I want it to rotate at left side, Si to do that I used a revolutejoint, but when I use that joint and motor, when an object falls on it It cn give the motor a push back even if the motor has high torque

I hope that explains it more :)

 

tyvm :)

 

Feb 15, 2012 at 2:00 PM
Edited Feb 15, 2012 at 2:08 PM

Well i think you can make the Body kinematics  or use a Fixed revolution joint or change the body inertia .Or you can manually handle the collision with the platform .Wait i'll try it myself now and will tell you if i get any good results .

Feb 15, 2012 at 2:19 PM

 

Ok you can do something along this lines

            
            Body rollingPlatform = BodyFactory.CreateCircle(world, 1f, 1f);
            rollingPlatform.Position = new Vector2(0f, -36f);
            rollingPlatform.BodyType = BodyType.Kinematic;
            rollingPlatform.AngularVelocity = 0.1f * 3.4f;
            rollingPlatform.SleepingAllowed = false;
            rollingPlatform.Friction = 10f;
            Body s = BodyFactory.CreateRectangle(world, 10f, 2f,1f);
            s.BodyType = BodyType.Dynamic;
            WeldJoint jp = new WeldJoint(s, rollingPlatform,new Vector2(2.5f, 0.5f), new Vector2(0.5f, 0.5f));
            world.AddJoint(jp);
So in general you create a kinematic body which will do a fixed rotation then weld the platform to it at the position you want to and i think you get what you wanted.

I am sure there's a better way of doing this ,and it probably involves a fixed revolution joint ,but well .

Hope this helps .

 

Feb 15, 2012 at 2:27 PM

The inertia did the thing :D I have a fixedrev joint with intertia :) ty for ur help!

Feb 15, 2012 at 2:31 PM

Hehe nice  :) 

Feb 15, 2012 at 2:35 PM

oh one more thning :p the problem now is I cant make it kinematic IT says no body fixed rotationg blablabla, but it works with dynamic, but when the block turns against a static body, it automatics pushes his zelf up to keep turning :p Its hard to tell, but its pushes his self up. I just want it to go in "block mode" that It won't continue.

 

Any idea?

 

ty for everything ^^

Feb 15, 2012 at 2:47 PM

Hmm do you mean ,that you want it to stop moving when it hits a static body ?  Or ? I didnt fully understand ,what you're saying there  :)

Feb 15, 2012 at 2:56 PM

Yeah, I want it to stop forcing itself to push up and keep turning, because its forces so hard to rotate, the body gets out of his position and pushes himself to get up. Is it normal that I can't make a kinematic body with fixrevjoint ?

Feb 15, 2012 at 3:01 PM

Ya i think so you can only manually move a kinematic body .Well you can manually handle the collision between the bodies and stop the rotation in your code .