rotation object

when i pick up an object the rotation is wrong. i cant fix it with the unity inspector. i only want to rotate it, i dont want to make it spin. this is the script i use for every interactable item:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;alt text

public class HeldObject : MonoBehaviour
public Controller parent;

public bool dropOnRelease;


note: i’m making a vr game so i’m using SteamVR. also i’m new to unity and C#. i only have experiance with html and css, so sorry if this is a stupid question.


@dirk_z U can make it rotate to a certain extent using a script

thank you, do you know what kind of script and how i would implement into my project.

I’m not sure what your asking here, but my guess is that you don’t understand why your gun is facing up and not forward when you pick it up.

Assuming you’re just attaching the gun to the controller object as a child and aren’t giving it any rotation, I’d guess that the gun isn’t modeled in the same coordinate frame (Z forward, Y Up). You’ll need to set the child (gun) rotation to account for the offset once it’s under the controller parent.

If you’re trying to manually set the world position of the gun every frame and not parent the gun object under the controller, I would suggest using the parenting route. This is exactly the kind of situation for which it’s useful. Then figure out the rotational offset of the gun as mentioned previously.