I am new to Unity and am trying to create a simple 2d platformer. I have applied a box collider to my player sprite and the floor/platform its standing on. Now when I go over the platform, it toppes off of it as expected, but I want it to simple fall off it instead of toppling. How can I do this?
Also I saw a video of Unity Live Training in which he was using a separate circular collider for the player's feet.When I did this ,the sprite started rolling. Can anybody help me with this?
There is an "fixed angle" option on Rigidbody2D component, try enabling that
Related
I want to make the OVRCameraRig hands from the Oculus Integration SDK sample to collide with objects. I mean I want it to use realistic physics and have the hand stopped by a cube or any gameobject without going throught it to make it much more realistic.
I tried to use the "Hand Physics Capsules" built in script for the right and left hand, that puts colliders and rigidbodys on the hand but it does not works as I want it. This method just pushes away the cube but does not stops the vr hands from going throught the cube and I don't want the cube to do any movement.
Thank you all for the help in advance.
Unity version: 2021.3.15f1
Oculus Integration SDK: 46.0
Um I'm making a game in unity I got a problem I made a picture as the ground but it doesn't work I put if to default and put what is ground to default to I use rigid body as physics and I already put a collision box and collision circle
Your question is not a clear question
But be sure to add the rigidbody to the ground and the box colliser for the player and the ground
You can review the images in this question showing how you can add the rigidbody and the box collider
Adding on to the responder above me, even if you did add the colliders, you may not have made the right size.
For my game, the player character requires to climb up and down ladders those are placed in the gameplay area.
At present, I can able to climb up for my player character to climb down at present I don't have anyway. Because platform box collider applied with platform effector, so for the climb up, effector does not create any problem but now after reaching the top, it becomes solid platform so now I can't able to move downside.
For climbing up, I have followed this tutorial: How To Make 2D Ladders In Unity - Easy Tutorial
I am looking to implement some physics so I can reach downside to the ladder after reaching top.
You need 2 boolean variables isClimbingUp and isClimbingDown which depend on pressed key and a second ray, which will check -Vector2.up direction. Then just add one more 'else if' statement for down direction.
Yes, I have managed to solve this, and the game is published in the stores.
You can check using the below link:
Humpty Trumpty's Border Wall
This is my overall physics setup for the stair:
I have applied a trigger collider to my stair object and disable player gravity scale when the player within the stair.
Then after within the trigger enter and exist, I have done this:
Physics2D.IgnoreCollision(m_CapsuleCollider, myStair.platformCollider, false);
Disable collision between player and platform colliders when the player is within the stair.
I don't think, Platform Effect 2D becomes useful to me in this process but I didn't remove this to remain in the safer side.
So you have to keep a reference of the platform object which is attached to Stair.
I hope you will get a general idea to solve this problem.
I want to make a plank game in VR with Unity. So when the player walk outside of the plank, he falls. Right now the only way to make it work is by using VRTK which is another physics system and it makes a lot of things complicated.
I've put a rigidbody on the CameraRig and uncheck "is kinematic". The player falls, but the colliders on other objects are not working anymore...
Is there a way to use Unity's physics with SteamVR and without VRTK ??
Thank you !
Firstly I would read up on Rigidbodies and Colliders/Trigger Colliders - here's a link.
Here's a useful table from that website:
You will need to use this to understand why the player is falling. Is the CameraRig actually colliding with the ground? Is it a Trigger Collider (which has a callback method but doesn't do any physical collision). There's many possibilities for why.
I wrote a script that you can drag in two objects and see if they collide. You could use that if it helps.
The issue in VR with Vive is that determining where someone walks can be difficult, as we are only tracking their head and their hands. If you have a Vive Tracker available and it fits your use case you could use that to track someones foot.
What I have done in the past is use the Camera(eyes) GameObject within the CameraRig and get it's transform.position.x and transform.position.z value to determine if it has gone outside of the boundaries of the object the user is standing on.
Hope this helps,
Liam
I'm learning how to use mecanim and followed a tutorial using the Raw Mocap animation set from the unity store. But the default rig would walk through cubes and fall through the plane. I've added colliders to the cube and plane but it still wouldn't work. Any guidance will be appreciated.
your character should have colliders too and if it has a rigidbody component attached to it set IsTrigger=false and it it has player controller attached to it it will only collide if the other object has player controller too