Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help  How to move an obi rope to another scene
#3
(21-12-2020, 09:06 AM)josemendez Wrote: The Burst/OniColliderWorld is automatically managed by Obi, you shouldn't need to create or destroy it manually. If you move your rope to a new scene and there's no collider world there, one will be created.

All you need to move to the new scene is your ObiSolver, your ObiUpdater (or assign the solver to a new one) and of course, your rope. For more info see: http://obi.virtualmethodstudio.com/tutor...cture.html

UPDATE (Read First!): I played around with the phases of my Player's Obi Rope control points, and the rope no longer falls through the floor after the Player is moved to the new scene. I had first assumed that it had to do with the Player and the floor being in different scenes, but I realize now that it doesn't have anything to do with that. I probably don't even need to move the player from one scene to the other. However, when I spawn the player and deactivate it, once I reactivate it, the rope stops being attached to the 2 "Ends" (aka the 2 Obi Particle Attachments). So the rope does interact correctly with the environment of the new scene (even if the rope is on another scene), but it's somehow detached from the 2 "Ends". This problem doesn't seem to have anything to do with the scene stuff, but rather with the instantiating and deactivating, and then reactivating! Is there something going on where the Rope would maybe be trying to get the transforms of it's ObiParticleAttachment and not finding them because the whole thing is inactive?
Actually, after experimenting a bit, I notice the simply turning off and then on the game object makes the rope detach from it's ObiParticleAttachments, see the gif: https://i.imgur.com/YKQ6asY.gifv Is there something I should be doing to keep the attachments when I deactivate/reactivate?

Hi josemendez,

Thanks for your answer! My ObiSolver as well as my ObiUpdater are children of my player, and are thus moved at the same time as the player itself. Here is a picture of the hierarchy[Image: pB1u2xJ.png]
For context, here, End1 and End2 are transforms that the player controls and the Obi Rope is attached to these transforms with ObiParticleAttachment. The "Player" object here is just a container, it is really just the two Ends that move in the world, which makes the ObiRope move.
I spawn my player in my bootstrap scene and deactivate it, and then when the level scene is loaded, I teleport the player to a spawn point, move him from the bootstrap scene to the level scene, and then activate it.

Code:
    public RopeController playerPrefab;
   
    public RopeController PlayerRopeController { get; private set; }

    protected override void Awake()
    {
        base.Awake();

        PlayerRopeController = Instantiate(playerPrefab);
        PlayerRopeController.gameObject.SetActive(false);
    }

    public void TeleportAndActivate(Scene scene, Vector3 position, Quaternion rotation)
    {
        SceneManager.MoveGameObjectToScene(PlayerRopeController.gameObject, scene);
        PlayerRopeController.transform.position = position;
        PlayerRopeController.transform.rotation = rotation;

        PlayerRopeController.gameObject.SetActive(true);
    }

When I do this, the player is successfully moved to the right scene, as well as the Solver and Updater. However, while the two "ends" (End1 and End2) seem fine, the ObiRope itself seems to detach from the ObiParticleAttachement transforms (aka End1 and End2) and fall through the floor.

I have found though, that if my Player prefab is saved inactive instead of deactivated after spawning, everything is fine when the Player is moved to the level scene. However I would like to be able to keep my Player prefab active in editor to prevent oversight when editing (for example forgetting to set it to inactive after making changes)

Thanks again in advance!
Reply


Messages In This Thread
RE: How to move an obi rope to another scene - by KnotANumber - 21-12-2020, 02:58 PM