Unity Oculus - Rotating empty parent on character rotates on a weird axis when player isn't standing at origin - unity3d

Sorry I know the title is really confusing.
Basically the camera and hands are nested under an empty object. This empty object is then used to rotate the character and teleport the character. Thing is, the camera is able to freely move around and away the empty object. Making rotation seem like you're running in a circle instead of just rotating. Then when you teleport it's a little offset. Like if you shoot the teleport beam straight down you move because it's teleporting the empty object to the camera which moves the camera.
So if the headset and camera aren't exactly on top of the empty object everything gets wonky. I understand the problem just can't figure out a solution.
I tried resetting the position on every teleport but you can still move away and spin in circles. As well as resetting resets the orientation and that's not exactly what I need.
Any help would be greatly appreciated.

There's a few ways to approach this. A crude, and not very elegant solution would be to parent your camera parent to yet another object, created in runtime, that would assume the position of the actual player camera when the rotation starts. You can reparent objects dynamically, so you could rotate this newly spawned object, which would give you the desired effect, and then loose the top parent when the rotation stops.
Alternatively you could move your camera parent as you rotate it, based on transforming the position relative to the player camera position. A bit more elegant but there's probably a few lines of math that you would have to write

Related

Unity 2D: Alter sprite anchor point

I've got a plain 2D Capsule Sprite. I want it to rotate around a specific point instead of its very centre. In other programs, this point is called the anchor point. For context, I'm making a paddle for my 2D pinball game so obviously the paddle needs to move when you press a button, but I can't have it moving around its very centre... Well, I could but I don't want to.
So my questions are:
Is anchor point the correct term for Unity?
Can this be altered/moved and how?
So, I ended up getting an idea from a friend who does this stuff too.
I made an empty game object. Made it the parent of my paddle. Moved the paddle to the point of the game object where I want the paddle to rotate around, and now when I rotate the game object, it rotates the paddle around the pivot point that I want it to have.
Image of paddle, arrow pointing to the empty game object
Edit: Just works using UI components within a canvas
You can use the Anchor presets of the Rect Transform. Or define the Min/Max values for x/y coordinates in Anchors Property.

How to move a GameObject with the camera when picked up in Unity 3D?

I am a newbie in Unity. I have searched on the internet for tutorials on how to pick up GameObjects and followed them as it is. But here's the problem:
This here is when I set the Camera as a parent to GameObject, initially....
And here's what happens when I move the camera.
The problem here is that the Object doesn't stay on the crosshair
This happens only when moving the camera along the Up-and-Down Axis (not sure if x or y).
However, this doesn't seem to be a problem in any tutorials. Is there any part of the code missing?
P.S:- I have set the Camera as a parent to the GameObject in the hierarchy directly without any code.
It is difficult to know the exact problem without at least a video of it, but the first thing here is to make sure there's nothing messing with the object's transform outside of camera's parenting.

Unity how to animate object's position without freezing it's position

I am currently working on a unity project and I have a stickman built by Hinge Joints but when I animate his legs and activate the animation, the legs stays at the same position and the rest of the body is moving forward.
How can I animate the legs without freezing it's position?
This worked for me:
Anchor and Axis should be correct, if it works with a motor.
For testing, deactivate "Use Spring", "Use Limits" and "Use Motor".
If it still doesn't move, you should have a look at the rigidbody. "Is Kinematic" should be deactivated as well.
From here
A lot of time passed since I asked this question and when I read this question again I figured out that my mistake was animating the legs without a parent.
The legs hadn't a parent so their positions where the animation position.
But if I had setted the legs as children of an empty game object, their positions were relative to the empty game object, which I could move as I wish.

Unity 5.3.8 Animator - Glitch?

I created a bunch of non-AI animations for enemies that do basic back.forth or up/down motions. Everything was working perfect until I started working on the Boss of the level. The boss has his own tag "Boss" and enemies have their own tag as well. Anyway, the problem is when I click start, every enemy leaves the game board. I can see them animated above the game board still doing their routines.
Any clue as to why this happened and how to fix it? I'd really, really hate to have to scrap all the enemies and start from scratch...
I used the Animation tool inside unity.
Extra Note: I created an EMPTY and moved all of my enemies into that Empty object to clean the hierarchy panel up. The animations were fine before this.
************** Currently Resolved **************
Whew! Okay, so apparently Unity doesn't like it when you move your animated stuff into an empty AFTER being animated. I FIXED them by simply removing them from the EMPTY that I had placed them in. However, I'd still like to know why this is. So any useful resources, links, manuals, personal insight/observations or anywhere I can read up on this would be appreciated!
Here is an explanation what happened:
The moment you dragged them all into the empty GameObject I guess this object probably wasn't placed on 0,0,0 in the Scene.
So Unity automatically changed all the local position values of your enemy items to fit the current position offset to the empty object.
Result: In the editmode they don't change their actual global position in the scene but their local position. This is supposed to happen if you just want to organize stuff.
However, now when you start the game and the animations are played, the animators change all the local positions to whatever is stored in your animations.
Result: all objects jump back to their original localPosition which had an offset to the empty GameObject.
To solve this make sure the empty GameObject is at position 0,0,0 and optimally has rotation 0,0,0 and scale 1,1,1 before you drag anything into it.
Easiest way to achieve that is by clicking reset in the empty objects Transform component before starting to drag stuff into it.

Dragging a Sprite (Cocos2D) while Chipmunk is simulating

I have a simple project built with Cocos2D and Chipmunk. So far it's just a Ball (body, shape & sprite) bouncing on the Ground (a static line segment at the bottom of the screen).
I implemented the ccTouchesBegan/Moved/Ended methods to drag the ball around.
I've tried both:
cpBodySlew(ballBody, touchPoint, 1.0/60.0f);
and
ballBody->p = cgPointMake(touchPoint.x,touchPoint.y);
and while the Ball does follow my dragging, it's still being affected by gravity and it tries to go down (which causes velocity problems and others).
Does anyone know of the preferred way to Drag an active Body while the physics simulation is going on?
Do I need somehow to stop the simulation and turn it back on afterwards?
Thanks!
Temporarily remove the body from the space.
If you want the object to have inertia when you release it, that's a different story. The cleanest way is to attach a fairly stiff spring between the ball and a temporary sensor body that moves under the control of your finger. When you let go with your finger, the ball will retain whatever kinematics it had while you were dragging it. Be sure not to remove the ball from the space in this case.
You aren't updating the velocity of the object when you aren't using cpBodySlew(). That is why it falls straight down.
A better way to do it is to use a force clamped pivot joint like the official demos do to implement mouse control. http://code.google.com/p/chipmunk-physics/source/browse/trunk/Demo/ChipmunkDemo.c#296