025_Controls_OverviewNormalDoor objects e.g. ExampleWorldObjects->NormalDoor (inward normal)017_CameraRig_TouchpadWalkingNormalDoor into the scene.When you walk into door, the players view should be faded to black and be rewinded to his last known good position.
I am able to walk right through the door, without any fade to black occuring and without any position rewind taking place.
This is an issue with Unity collision tunnelling because the default box collider on the door is so thin and the play area is being moved with transform.position being updated it means you're passing straight through the door's collider.
A quick work around would be to make the collider of the door thicker.
I'm not sure if ideally the play area should be moved with the rigidbody rather than transform.position.
But another fix maybe would be to implement a raycast from the headset to the length of the next position and see if it collides with anything, if it does then prevent the walk in that direction (i think i'm going to look at this as the current fix as it should be easy to implement).
Thanks mate for looking into this, please keep me updated if you manage to come up with a solution, as this is a major issue currently with many VR games!
Unfortunately, making the door collider thicker is not really an option, because i would have to make it too thick and then there would be an issue with how far the player can get towards it from either side of the door and how far he can reach out to grab the handle.
Your second solution seems like it would be more suitable. But to be honest I'm still pretty new to Unity and C# so don't have much experience in this department.
One badly thought out solution i had thought of earlier was to add trigger box colliders on the other side of the room, this way i can see the player actually bounces off the this area. However, this is not a very good solution and means that i have to keep enabling and disabling trigger colliders which is pretty bad.
You don't have to make the collider that thick for it to work. I changed it from a z of 1 to a z of 4 and it worked ok. It's not the ideal solution though.
ok cool, the issue with increasing the box collider thickness with the doors is the physic interactions with the frames of the door and walls around it 馃槥 The Door script and hinge joint rotate the door using the box collider, if the box collider is too tightly fit inside the frame, then the door doesn't even move! LOL i learnt this the hard way when i really struggled to get the doors working in my house with VRTK for many days. In the end i had to actually reduce the box collider to be as small as possible so that it doesn't interact with anything else, but that was mostly from the sides of the door to avoid the frame of the door when the door is rotating around a pivot point.
Perhaps though i will try this out tonight when i get home then and try increase the Z and see if it works 馃憤 Thanks for the advice!!! I thought my doors themselves already were quite thick but i cant remember exactly how thick now.
I think this will be a problem for:
My suggestion in these scripts is to:
Right before the line that sets the transform.position to get a direction of where the play area will be moving to, cast a capsule cast in the direction to the new potential location (the capsule cast needs to be the height of the player to the floor).
If the cast doesn't hit anything then it's safe to move.
One problem with this is a capsule cast in a FixedUpdate (or Update) may be expensive
@nadimalam make the collider thicker, but also make it a bit smaller, that way it can rotate just fine anyways and still block the player. Thats probably the best work around atm.
@thestonefox sounds good to me, dont be afraid of casts, you can do 10k casts in a frame with no hitches at all. Its actually pretty cheap.
okay thanks, yeah @thestonefox and @virror you were both right, increasing the thickness of the door collider solved the issue somewhat, now when i walk into it the door opens when colliding with my head. Before it didnt and would just go through it. Obviously i had to cut the box collider around the edges of the door to allow it to rotate.
However, there is still one issue. Say if the door is locked and stationary or if i am colliding with it from the wrong side (ie, pushing against it in the opposite direction its supposed to open), then my head will collide with it maybe once, but if i keep pushing forward on the touchpad to keep going into it even for one second then i will still walk through it :(
Is there a way that i can stop the user from walking through it if they try to go into it from the wrong side or even if they try to go through a locked door?
One thing i recall from resident evil 7 now that was clever from capcom, they allowed the doors to open from both directions, so that the player can walk into the door from either way and the door would open up. However, i cant remember what they did for locked doors!
A PR that should resolve this: https://github.com/thestonefox/VRTK/pull/1266
You can now provide the touchpad control option (e.g. slide) with a body physics script and it will then use the new sweep method on body physics to check if a collision is about to happen and not move you forward.
Wow that sounds to good to be true :D i hope its working, as that would be really great!
Will hopefully get to try this out tonight! Which Body Physics script do i need to attach to the play area? Or is it already going to be in there?
There is only one bodyPhysics script, and you should never add scripts to the actual rig. The scripts are made to be put anywhere on your scene, they will find the relevant references themselves. I usually just make a child GO under the [VRTK] object and put my bodyPhysics, teleport , movement scripts and other stuff there. That way you will keep the rig clean making it easier to upgrade and to support both touch and rift.
ok cool, thank you. So as there is only one bodyphysics script needed, it will most likely be already attached from before. Does this mean once I've updated the VRTK codebase to the latest one from github, i don't actually need to do or change anything and can test this straight off the bat by just walking straight into the door/wall etc...???
Looks like it : )
Well you need to add a body physics script into your scene, and then apply that body physics script to the touch pad control action script so it can use the colliders to do a collision sweep.
It's basically dragging and dropping though :)
Ahh, missed that you had to drag the control script on
add a body physics script into your scene
Does that mean to just drag and drop the script to any object in the scene? or the actual door/wall etc..?
didnt you have the bodyPhysics already in the scene on the player somewhere?
okay just got home, i tried it out but saw no difference :( im still just walking through a door, after a slight stutter.
Ive checked and yes the bodyphysics is already attached to my play area. Im not sure if im missing something else?
My controllers have the touchpad control scripts attached. Theres one property in there that is unassigned called "control override object", do i have to drag something into this one ie. my playArea?
Did you do this as @thestonefox said?
"and then apply that body physics script to the touch pad control action script so it can use the colliders to do a collision sweep"
@virror nope thats the bit i dont understand at all :(
the touchpad script has no input called action script where i can drag in the playareas body physics.
Please can one of you explain this bit a bit more?
thanks
@nadimalam the VRTK_SlideObjectControlAction script that listens for the touchpad control axis event is the thing that actually moves the play area around. It's that script that you need to apply your body physics script to.
Thanks you for providing this update. It is better now then it was before with this, however if you keep the forward button held down for something like 3-5 seconds, the player still sometimes goes through the door. Another thing that i saw happen a few times, is that when the door wouldnt allow me to go througth, the the player area simply went on top of the door and over it (if the door was on the second floor of my house), otherwise if it was a door on the ground floor then i simply ended up in a room upstairs when i was trying to push through the door.
Is there anyway to prevent the player from going over the door?
@thestonefox @virror any help with the above guys please? Is there anyway for me to lock the playarea so that it doesn't start climbing on top of objects in the level such as tables, doors etc.. but can still use stairs and slopes?
@nadimalam you'll have to provide steps to reproduce in an example scene.
If we cannot recreate the issue then we cannot understand it to look into it further.
ok thanks @thestonefox i will do once i get a chance to when I'm home.
But basically what i meant was that like you advised above, i attached the body physics scripts to my controllers. When i do this, if i keep walking towards an object, it will start bouncing me back (like its supposed to), but if i keep walking towards it for a few seconds (sometimes much less) with the controller then i will generally end up on top of that object. (ie. the playArea will end up at the top of it, which would obviously also change my location on that height axis).
The object in this case could be anything, i.e.. a door, a cube, a table... Anything solid with a collider on it.
Im sure there must be a way for me to lock so that the play area can not end up on top of colliding objects?