Jump to content

Independently Moving Parts


Recommended Posts

Hello,

I'm trying to make some cargo bay doors for my personal use. I've managed to rotate a part around an axis that goes through a given point.

All the children connected to the part rotates along with it, but the problem is the parent connected to the part try to rotate as well.

I've tried changing the attach node in the cfg from FIXED_JOINT to HINGE_JOINT, but that didn't seem to solve the problem.

What can I do to create this hinge?


using System;
using UnityEngine;

namespace PartTesting
{
public class TestPart: PartModule
{
Transform axle;
Transform topAttach;

public override void OnStart(StartState state)
{
axle = part.FindModelTransform("axle");
topAttach = part.FindModelTransform("topAttach");
}

public override void OnUpdate()
{
this.transform.RotateAround(axle.position, Vector3.up, Time.deltaTime*20);
}
}
}

Like I said, the problem is EVERYTHING connected to the door rotates along with it, rather than just the door itself. Some pointers would be nice!

Link to comment
Share on other sites

This thread is quite old. Please consider starting a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...