Hi! , I am currently making a 2D platformer, and i wanted to make a seesaw obstacle like the one in the new super Mario bros series. I tried using PinJoint but it does NOT seem to work...
JoboGol What is the problem with PinJoint and the expected behavior ?
MOSvisio there are two problems. 1 : when my player jumps on the platform the centre of the platform centre moves. 2 : the main problem is the fact that I don't know how to make the seesaw collide with other objects so that it does not rotate fully , and be upside down. I attached the platform ( RigidBody2D ) to an invisible StaticBody2D placed at the centre of the platform.
JoboGol 2 : the main problem is the fact that I don't know how to make the seesaw collide with other objects so that it does not rotate fully , and be upside down.
Is the PinJoint2D's Disable Collision property off?
I haven't used Godot joints, but I found a couple of tutorials. The second one is a video from 2015, so I don't know if it's still accurate.
http://kidscancode.org/godot_recipes/physics/joints_2d/
DaveTheCoder I tried it... but it does not work properly , I even tried doing the same thing with the seesaw from the godot tutorial and it doesn't work , but thanks for the reply, I'll make sure to watch the video you linked!
JoboGol I'm attaching a simple project I created to test PinJoint2D. It somewhat works. The lever collides with the fulcrum and the ball, although the lever becomes unstable afterwards. I'm using Godot 3.5.1-rc1.
https://godotforums.org/assets/files/2022-09-14/1663168378-197067-pinjoint2d.zip
DaveTheCoder Nice! you fixed the first problem, i got the collisions wrong , but , there is still one problem: the platform centre moves around when it hits the ball / player. Now I'll watch the vid and see if I can sort things out!
Thanks Again!
JoboGol the platform centre moves around when it hits the ball / player.
You mean after the ball passes past the lever and the lever starts flying around?
I couldn't figure out how to stop that. I was thinking of adding a script to the lever to limit its rotation and/or translation. This might be a solution: https://stackoverflow.com/questions/63461354/how-to-limit-rotation-on-a-rigidbody2d
DaveTheCoder after 2 weeks , i found a decent solution , I actually just used 2 area 2ds and 2 tweens to move the static body 2d instead of using physics, still thanks for the response!