How do imported objects behave?

  • Could someone explain how these objects behave inside Rising World? Is it possible to destroy them or that they consists of different materials? Could they be available inside the crafting menu or as building blocks?

  • s it possible to destroy them or that they consists of different materials?

    Objects behave very similar to Java version, but in much more complex way. Basically in API you are working with GameObjects, which are technically Unity GameObjects, so they have hierarchy, different Unity components, colliders and materials. Objects can have different materials in submeshes or childrens and can be attached to each other.


    Objects can be added and removed for individual players, there are player.addGameObject and player.removeGameObject methods for that.


    You can load object from Unity Bundle, from external resource or from plugin itself. I'm not sure about the last two, but importing from bundle is very simple. You just need to make a bundle in Unity using this tutorial, load it inside you plugin with AssetBundle.loadFromFile method and use any prefab with loadFromAssetBundle method:


    Java
    private void createCrystalObject(Player player) {
    Prefab prefab = new Prefab();
    prefab.setPrefab(PrefabAsset.loadFromAssetBundle(bundle, "crystal_object"));
    prefab.setLocalPosition(player.getPosition());
    prefab.setLocalRotation(new Quaternion().fromAngles(0, random.nextFloat() * 6, 0));
    float scale = random.nextFloat() + 0.5F;
    prefab.setLocalScale(scale, scale, scale);
    player.addGameObject(prefab);
    player.sendTextMessage("Crystal summoned!");
    }

    Object collider is visible for entities and other things:

    Could they be available inside the crafting menu or as building

    Looks like no at this moment, but if we will get ability to register default types of objects (like plants and furniture) with definitions it will be possible. Right now you will need a custom GUI, key, command or another way to create them. For example for my tests I used chat messages:

Participate now!

Don’t have an account yet? Create a new account now and be part of our community!