HingeJoint doesnt open the opposite direction - unity3d

I was wondering if you could tell me if this is possible. I've spent a couple hours to no avail trying to find a way to make a object with box collider swing inwards and outwards like a door. I used hinge joint, but it will only swing the gameobject inwards or outwards around the joint. I am trying to achieve a 'saloon door' effect that allows free rotation around the y axis. I have tried fiddling with the anchor position and axis values but no luck. I was surprised not to find any similar problems online, perhaps hinge joint is not meant for this purpose? Any clarification is much appreciated.

I'm not really sure how I fixed it, but I got the door to swing freely. One possible reason is surrounding colliders or terrain prevented it from swinging freely. sigh

Related

How to create a physics material with specific friction for the character to fall over faster?

I am making a 2.5d platformer with a pill as a character, which has a very specific movement. Instead of freezing its z rotation so it won't fall over, the pill tumbles over on and on.
So, the problem is that when I put a maxfriction physics material on the pill, it tumbles over great but the gravity when you let go of the move key is extremely slow which is pretty annoying.
However, when I assign a nofriction material on it, it doesn't rotate at all.
Does anyone know how to fix this problem, I know it is very specific, but I am a beginner in unity and I have no idea how to fix this.
Thank you! Emiel

How to implement trolley-like physics behaviour in Unity

I am stuck with two things while trying to simulate the physics setup for a trolley-like object (push powered vehicle with free rotating wheels on the front and fixed wheels on the back).
I have the RigidBody with its mesh and four WheelColliders, the object moves fine if I just apply torque to the wheels. However if I use the AddForce method on the RigidBody it won't move; I see the object being pushed (slightly balancing) but the wheels won't rotate so it stays in place. How can I get the wheels to move if the object is being pushed?
My other problem is to simulate the standard 360 degrees rotating wheels on the front of the trolley. What would be the best way to simulate this? I was thinking about a horizontal WheelCollider and a vertical one as a child but that seems really weird and I doubt it will actually work. Any ideas?
https://docs.unity3d.com/Manual/WheelColliderTutorial.html
This tutorial shows an example of how to use the wheel colliders and apply steering and torque to them.
It might be what you are looking for in regards to the adding force part.
I suspect it might allow the 360 degree rotation as well, but I am not familiar enough with these colliders to guarantee that.
EDIT:
In the guide there is the line:
public float maxSteeringAngle; // maximum steer angle the wheel can have
Which looks relevant for the 360 degree turning.

How to roll a cube on it's edges on Unity 3D

I want to move a cube by making it roll on it's edges. The cube will be standing on a x-z grid and each movement it takes will make it stand on a different square of the grid.
The player will controll the movement and will only be able to make the cube roll on one direction at a time (left, right, forward or back), but the cube must always stand exactly on top of one of the grid's squares.
I don't think applying a force to the cube will help cause it could move it a little bit too much or too little. I want to achieve something like this: https://www.youtube.com/watch?v=yaAIUYuNi84 but only on the x-z plane. Notice how on each corner the cube can stop and change direction with ease, because it never moves too much or too little.
Any ideas on how to approach this?
If you are new to the Unity it will be useless to trowing you a bunch of codes so i am telling you the way of doing it so you can implement your own codes.
You can create 4 empty game object which will always follow the cube on the floor and when you want to roll the cube you will rotate the cube around the empty objects.
You can find the codes for following the cube and rotating the cube on youtube, and for the starters searching is allways good.
So i hope you can manage it out, if you cant please write me again where did you stuck and i will be happy to answer you :)

SKPhysicsBody, rotate a sprite after applying impulse to change direction

I am looking for some info on how I can get my sprite to change its rotation by changing the angle of the sprite.
Basically here is how it is set up. Imagine a rocket that is sitting in a stationary position. The physics body is the shape of the rocket, with the tip pointing to the top. Now I apply an immediate impulse to the rocket to send it into the air. While in the air, I would like to use the accelerometer to rotate the sprite. With the rotation, I am expecting the direction of the sprite to change. Unfortunately, The sprite goes straight up and down instead of the direction it is rotated, even though the texture and physics body is rotated. I am having a hard time trying to find info on what techniques are used to achieve the results I want. Most examples have a continuous force, but I only have the initial force with no change after that. I have played around with linearDamping and angularDamping, but that was no help. I have also tried attaching another physics body to the tip to make the tip more heavy to see if the direction will change, but that didn't help either. My only work around that worked is to change the gravity direction, But I would like to avoid this. Any help or direction would be appreciated.
I think the solution you may be looking for is in Sprite Kits SKFieldNode class.
https://developer.apple.com/library/ios/documentation/SpriteKit/Reference/SKFieldNode_Ref/#//apple_ref/occ/clm/SKFieldNode/linearGravityFieldWithVector:
The linearGravityFieldWithVector: is probably your best bet. It applies a linear gravity field in a direction you set.
You can also check out electricField which is similar however you can change the charge to positive or negative.

Steering a car in CoronaSDK

Having a bit on an issue, what I want to achieve is a car that is drivable with a D-Pad. I am attempting physics joints on all 4 corners of the "frame" of the car. Then each "wheel" is applied a force to move it forward and backwards. Simple enough I think, can't even get the wheels to stay attached. I weld them to it, but then it won't move.
Second, steering?! How on earth is this accomplished?
Thank you very much, been stressed over getting it to work!
I'm not sure if this is helpful, but here's a link that may push you in the right direction: http://www.emanueleferonato.com/2009/04/06/two-ways-to-make-box2d-cars/. This is an example of what I believe you are looking for, but it's in AS3. However, it's using Box2D physics which is what the CoronaSDK uses. Should be able to translate.
Weld joins don't allow any kind of movement. Pivot joints would be a better choice and more realistic. As for the steering, if this is a top down game, you probably should apply force to the front region of the car and not each wheel as it could do weird things.