Use Parent Position but not rotation - unity3d

is there a way to make a GameObject use parent position but world rotation?

You can separate you rotation and translation into few objects, changing your hierarchy like so:
Moving Cube
- Parent Cube
- Child Cube
now, moving Moving Cube will move both Parent Cube and Child Cube and rotating Parent Cube won't affect Child Cube

Related

Rotate a body about a given point Unity2d

How to rotate a body relative to given dx dy in Unity? For example, I have a weapon sprite with a hand, and I was able to make it rotate relative to its center so that the weapon looks at the cursor, how can I rotate not relative to the center of the sprite, but relative to a given point?
The simplest way to achieve this is to set a gameobject at your desired point and make your object child of the created object. So when you rotate the parent, it will rotate relative to the parent point.
You can create an empty object and set the body as its child, then rotate the parent, the body will rotate around the parent like the parent be its pivot.
This is a practical way to set the pivot, and you can change it at any time.

How would I keep the rotation of the look of the object but make the rotation 0 Unity

How would I be able to have Wheel look the same but make the rotation 0.
As already commented you can rotate the mesh in 3D modeling software.
A faster way would be to parent the GameObject that represents the wheel under another GameObject, which will be acting as a pivot then. Just position it at the exact position of the wheel GameObject, but with a the desired rotation.

Rotate wheel collider object

I wanted to rotate a wheel collider object in unity.
I duplicated my back and front wheels objects to keep the position data.
It appeared perpendicular to the wheels. I cannot rotate it using the rotation tool or via the inspector.
As mentioned in this post: it could be solved using an empty game object for the rotation.
I tried to append it onto an Empty Game Object and rotate it. It did not work.
Thanks in advance
I had the same problem. The solution is simpler than the other answer suggests:
WheelCollider objects are dependent on the orientation of a rigid body they are attached to. Assuming that your bike has a rigid body, the solution is to make sure that the X-axis orientation of the bike matches the X-axis orientation of the wheel colliders.
Based on this post:
https://forum.unity.com/threads/unity-5-wheelcollider-wrong-rotation.349596/#post-2264801
WheelColliders always point in the "forward" and "down" direction as the rigidbody they're attached to. The steerAngle value is relative to the rigidbody's forward direction.
Please bear in mind, however, that your bike's model(the visuals that display bike's frame) might have a different orientation from the object that contains the rigidbody that wheel colliders are attached to.
In my case Hierarchy looked like so:
MainScene
CarRoot
CarModel
WheelColliders
Wheel_FR
Wheel_FL
Wheel_RR
Wheel_RL
The CarRoot had a rigid body on it. When I rotated it, that would also rotate my model. Which was not good. So I had to:
Unparent the CarModel and WheelColliders(made them children of MainScene)
Rotate the CarRoot by 90 degrees on the Y-axis(to align its X-axis with that of the WheelColliders)
Make CarModel and WheelColliders children of CarRoot again.
That did it for me.
1-) Create a capsule game object,
2-) Make it like whell.
3-) Delete capsule collider and add mesh collider, then select convex.,
Now you have a collider like whell.
4-) Put your whell game object under this, and fix sizes.
5-) Delete mesh filter and mesh renderer in capsule object.
6-) Use transform.rotate(vector3.right) or left on created base object.

Weird X and Y of gameobject in Unity

I have one problem. X and Y of gameobject are weird. I think that's because its parent isn't main camera. How to set parent without scripting?
To make a gameObject the child of another, look at your hierarchy and find the gameObject you want to make child, drag and drop it on the other object you want to make parent.
This will make the coordinates relative to the parent.

Does having Root Motion applied prevent moving a transform position relative to world coordinates?

I have "GameObject 0" (GO0) with an animation controller that used parameters to transform states and is used as a wrapper for "GameObject 1"(GO1). "GameObject 1" has an animation controller that has Root Motion applied. Within GO1 there are 3 game objects whos animation is in the same animation clip as GO1.
This allows me to place GO1 in world coordinates and animate GO1's children in local coordinates to maintain relative positioning.
However, I am wish to move one of the children of GO1 to a world coordinate that is not relative to GO1. I have used script and Vector3.Lerp / Vector3.MoveTowards functions, but they are not working as expected. Is the Root Motion interfering with the Lerps?
I have change the script to add a new parent to the child object and animating the new parent. This seems to work but the rotation of the new parent is causing a new issue.