Picking up object in Unity Quest makes me zoom around my gamespace - unity3d

I think it has something to do with trying to fix an object's collision. I have a box collider on a cube, and when I pick it up, sometimes I go zooming around (even can use it to move vertically!). It's annoying and not sure how to fix this.
Upon letting go of the object, there are no more issues.

Related

Don't animate hands in Unity 3D

There was a problem with the animation of the character's hands. I do animations in Blender, naturally I had a ready-made character, from which I cut out the arms and extra bones. Animated separately hands and exported to fbx. But there is one problem, the animation plays, but the hands do not move. As I understand it, you need to move towards the bones. But they are all right, which is strange. Simply I choose in the panel "Inspector" Rig - Genric. In fact, everything should have worked in the best way, but no matter how I tried, I did not fix this bug. Reworked the model and so on. Maybe I'm doing something wrong?
All I tried was to remake the bones of the arms, remake the arms themselves, I tried to experiment with "Rig", but I did not manage to achieve the desired result. If you turn on "Rig Bone", you can see the bones of the hands. But everything that was done did not help

Unity Engine. Rotation calculation issue. Rigidbodies and rotation with an object

I´ve got some problems with rotations. So, I´ve got a ship, imagine it as a container, I´m trying to get everything within that container to follow the position and rotation of that container. These internal objects are also rigidbodies that can freely move.
So imagine that within the ship there is a table and a cup, both objects rigidbodies. If you are within the ship you can push over both objects, but while the ship moves, it will "drag" them with it.
So the table and cup have to always stay in the correct position, no matter how much the ship moves and rotates. And to clarify, I won´t be able to parent them either, they have to stay separate in this case. Hope I explained that right!
So, for now, I was able to achieve the detection of objects within the ship and follow correctly the position. But the rotation, using rotateAround three times with each axis (Which in itself might be incredibly wrong already lol) even though it seemingly works, it´s always slightly off. And on bigger rotations just breaks fully.
Which does make sense I guess but I still don´t manage to think of a way to get this to behave right.
Is there any way to achieve this?
Thanks for any help!

Interactable script allows "Hand follow transform", defaults to transform of the attached object, ignoring offset

We are building a 3D VR billiard, and we are struggling with the Cue-Stick.
We try to use the steamVR Interactable scripts as much as we can.
I attach the Cue stick to the hand with
hand.AttachObject(gameObject, GrabTypes.Grip, Hand.AttachmentFlags.VelocityMovement, Pivot.transform);
The Offset (Pivot.transform is important here because we want to attach to the object at the correct position (which is determined on runtime, depending on where the user puts his hand when grabbing).
Because the Cue stick is moved using velocities and not via parenting, the grab position will not always be on the stick (stick has drag, collision, etc). This is quite immersion breaking.
To compensate for this problem the Intractable script has a boolean for Hand Follow Transform which would be perfect for fixing this.
Sadly the Hand now jumps to the midpoint (origin) of the Cue, even though we grabbed it somewhere completely different. It still behaves like it should, but visually its very confusing.
SteamVR Intractable supports the offset when attaching, but it forgets about that offset when positioning the hand.
Is there something I am missing?
Or is this just not a thing?
I read though the script codes multiple times and it seams like the offset is not available in the scope where the hand is placed. So there seams no way this can work.
How can I solve this problem?
I tried falling back to just parenting to the hand, but this makes physics interactions between Cue and balls funky.
I also read through most of the Interactable and the Hand script to understand whats going on, other that valves naming conventions hurting me a bit I was not successful in finding a way.
I am quite overwhelmed by it though and I can see a good chance that I am missing something.
What probably is possible though, is to set the Hand attachment point to the correct place on the Cue, but this transform is placed in the RightHand (and left) prefab, it seams like a really bad idea to change this transform every frame, or parenting it to the Cue gameobject.
Is there a better way?

How do I stop two gameobjects from going through each other on unity3d

I have tried every from unchecking the matrix box , and removing the sphere collider . The problem I am having is the gameobjects wont stop going through each other .I dont know what is going on . I have a pic of what is going on : enter image description here
First of all, don't remove the colliders and make sure they are not set on Is Trigger (that makes the collider penetrable). Also, you are using sphere collider for quite a complex mesh, so I'd recommend using MeshCollider, which would generate it according to the mesh.
Secondly, recheck how you move the objects. If given too much force, it might bash through another collider and not get out of it (imagine that you breaking through a barrier and inside it you cannot get enough speed to break out of it again). That might happen if you use AddForce() and not increasing transform.velocity.
Thirdly, what controls these gameobjects? Player or NavMeshAgent? Because, I think, if they are controlled by AI (NavMeshAgent), they should avoid each other in their paths and shouldn't collide. However, I might be wrong on this one.

Unity3D: Recalculating collisions after Physics2D.IgnoreLayerCollision()?

I have my "player" gameObject standing atop a platform. He press a combination of keys, I verify that he's standing on the right kind of platform, and I run this code:
Physics2D.IgnoreLayerCollision(playerLayer, plataformLayer);
The intention being that he'd drop down from the platform. Instead, nothing happen immediately. The player is still atop the platform and can move around - only if he gets out of it and tries to get back to it, only at that point will he fall down from it.
So I made a temporary ugly workaround:
Physics2D.IgnoreLayerCollision(playerLayer, plataformLayer);
rigidbody2D.AddForce(transform.up * jump / 1.5f);
This will force the player to jump, making Unity "recalculate" the collisions and the player will, as I want to, pass through the platform. The even weirder part is: if the jump isn't high enough (100 force at 1 mass with 0.5 gravity scale seems to be the minimum), the player will still land on the platform, even though Unity is supposed to be ignoring those collisions.
I also tried pushing the player downwards, both with force and direct velocity, but no luck - he still collides with the platform, he only stops colliding with it after being away from it once.
Also, my player Rigidbody2D Detection Mode is set to Continuous, and I tried setting the platform up in many different ways, with and without a Rigidbody2D.
Any ideas on how to make the player instantly fall down from the platform as soon as collisions start being ignored? Thanks in advance.
I had been having the exact same issue. I have an alternative solution that you may find to your liking.
Rather than disabling or moving the terrain to be ignored, temporarily set the rigidbody2D of your player gameObject to kinematic. This will not cause you to 'drop' through the platform as you would like - but it will allow you to create the illusion that you are, by briefly using transform.Translate (or Vector3.Lerp, if you like) to move your character down via code.
This will disable Rigidbody2D.AddForce, but will still allow for set movement via rigibdody2D.velocity, if that is preferable to manipulating the transform directly.
Ensure the downward velocity lasts only as long as you are Kinematic, and try to let it match the gravity of your game, and it looks pretty seamless.
If you turn the rigidbody back on too quickly, it can (even with ignoreLayers :/ ) still jump back up to the platform - but if you leave it on too long, you can drop through more than one intended one-way platform, or even :O through the bottom of the stage!
This is easily avoided if you can be careful - personally I used both MonoBehaviour.Invoke to set a very short time limit on how long the player would remain Kinematic (about 0.5 seconds), AND I disabled Kinematic as soon as they moved 0.5 units from the point where the 'hopDown' was initiated.
If your gravity / platforms / character scale are vastly different than my own, you may have to experiment with some different numbers.
This has been my first attempt at an answer on stackoverflow, so I hope it has been helpful!
One easy way to do this is after calling
Physics2D.IgnoreLayerCollision(playerLayer, plataformLayer);
You reset the player's layer:
player.gameObject.layer = playerLayer;
It's sounds like you have covered a ton of possible solutions to this problem before coming here so, good job there. I listed a few alternative ideas below. I hope they help. Good luck!
Remove the collision object from the platform itself.
Offset the collision object to be in some remote location so it will not interact with the player. Offsetting the object may cause the collision to have a similar reaction to the jump you mentioned.